6.7.0 - Alpha6 - 模块化 Gradle 脚本, 将共享构建逻辑迁移至 buildSrc 并抽象为约定插件

This commit is contained in:
SuperMonster003
2025-09-24 16:31:06 +08:00
parent 038f4a5ad9
commit 4778794e0e
31 changed files with 1893 additions and 1235 deletions

View File

@@ -1,23 +1,24 @@
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'
apply from: '../utils.build.gradle'
plugins {
id 'org.autojs.build.utils'
id 'org.autojs.build.properties'
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}
ext {
projectName = "Image Quantization"
}
def versions = Utils.newVersions(project)
def versionMap = [
"libimagequant": "2.17.0",
"libpng" : "1.6.49",
"MIN_SDK" : versions["MIN_SDK"] as Integer,
"COMPILE_SDK" : versions["COMPILE_SDK"] as Integer,
"TARGET_SDK" : versions["TARGET_SDK"] as Integer,
"MIN_SDK" : props["MIN_SDK"] as Integer,
"COMPILE_SDK" : props["COMPILE_SDK"] as Integer,
"TARGET_SDK" : props["TARGET_SDK"] as Integer,
"NDK" : versions["IMAGE_QUANT/NDK"],
"CMAKE" : versions["IMAGE_QUANT/CMAKE"],
"NDK" : props["IMAGE_QUANT/NDK"],
"CMAKE" : props["IMAGE_QUANT/CMAKE"],
]
def nameMap = [
@@ -26,6 +27,13 @@ def nameMap = [
"CMAKE" : "Cmake",
]
utils.configureLibraryLifecycleHooks(project, nameMap.PROJECT, [
"libimagequant",
"libpng",
"NDK",
"CMAKE",
].collect { "${nameMap[it] ?: it}: ${versionMap[it]}" }, Collections.emptyList(), null, [".cxx"])
android {
namespace = "org.pngquant"
@@ -75,20 +83,5 @@ android {
version versionMap.CMAKE
}
}
}
clean.doFirst {
delete project.layout.buildDirectory
['.cxx'].forEach { delete file(it) }
}
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it.name == "clean" }) return
Utils.newFormatted("Version information for ${nameMap.PROJECT} Library", [
"libimagequant",
"libpng",
"NDK",
"CMAKE",
].collect { "${nameMap[it] ?: it}: ${versionMap[it]}" }).print()
}