6.7.0 - Alpha6 - Gradle 构建脚本转换 (Groovy -> Kotlin DSL)
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
plugins {
|
||||
id 'org.autojs.build.utils'
|
||||
id 'org.autojs.build.properties'
|
||||
id 'org.autojs.build.jvm-convention'
|
||||
id 'com.android.library'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
}
|
||||
|
||||
ext {
|
||||
projectName = "Image Quantization"
|
||||
}
|
||||
|
||||
def versionMap = [
|
||||
"libimagequant": "2.17.0",
|
||||
"libpng" : "1.6.49",
|
||||
|
||||
"MIN_SDK" : props["MIN_SDK"] as Integer,
|
||||
"COMPILE_SDK" : props["COMPILE_SDK"] as Integer,
|
||||
"TARGET_SDK" : props["TARGET_SDK"] as Integer,
|
||||
|
||||
"NDK" : props["IMAGE_QUANT/NDK"],
|
||||
"CMAKE" : props["IMAGE_QUANT/CMAKE"],
|
||||
]
|
||||
|
||||
def nameMap = [
|
||||
"PROJECT": ext["projectName"],
|
||||
"NDK" : "NDK",
|
||||
"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"
|
||||
|
||||
ndkVersion versionMap.NDK
|
||||
compileSdk versionMap.COMPILE_SDK
|
||||
|
||||
defaultConfig {
|
||||
minSdk versionMap.MIN_SDK
|
||||
targetSdk versionMap.TARGET_SDK
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++17"
|
||||
|
||||
// @Hint by SuperMonster003 on Aug 28, 2025.
|
||||
// ! Moved into `target_link_libraries(pngquant_bridge ...)` in `CMakeLists.txt`.
|
||||
// ! zh-CN: 移至 `CMakeLists.txt` 文件 `target_link_libraries(pngquant_bridge ...)` 代码中.
|
||||
// # cFlags "-ljnigraphics"
|
||||
}
|
||||
}
|
||||
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
version versionMap.CMAKE
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
86
libs/imagequant/build.gradle.kts
Normal file
86
libs/imagequant/build.gradle.kts
Normal file
@@ -0,0 +1,86 @@
|
||||
plugins {
|
||||
id("org.autojs.build.utils")
|
||||
id("org.autojs.build.properties")
|
||||
id("org.autojs.build.jvm-convention")
|
||||
id("com.android.library")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
}
|
||||
|
||||
ext {
|
||||
set("projectName", "Image Quantization")
|
||||
}
|
||||
|
||||
val versionMap = mapOf(
|
||||
"libimagequant" to "2.17.0",
|
||||
"libpng" to "1.6.49",
|
||||
|
||||
"MIN_SDK" to props["MIN_SDK"].toInt(),
|
||||
"COMPILE_SDK" to props["COMPILE_SDK"].toInt(),
|
||||
"TARGET_SDK" to props["TARGET_SDK"].toInt(),
|
||||
|
||||
"NDK" to props["IMAGE_QUANT/NDK"],
|
||||
"CMAKE" to props["IMAGE_QUANT/CMAKE"],
|
||||
)
|
||||
|
||||
val nameMap = mapOf(
|
||||
"PROJECT" to extensions.extraProperties.get("projectName") as String,
|
||||
"NDK" to "NDK",
|
||||
"CMAKE" to "Cmake",
|
||||
)
|
||||
|
||||
utils.configureLibraryLifecycleHooks(
|
||||
project,
|
||||
nameMap["PROJECT"] as String,
|
||||
listOf("libimagequant", "libpng", "NDK", "CMAKE").map { "${nameMap[it] ?: it}: ${versionMap[it]}" },
|
||||
emptyList(),
|
||||
null,
|
||||
listOf(".cxx"),
|
||||
)
|
||||
|
||||
android {
|
||||
|
||||
namespace = "org.pngquant"
|
||||
|
||||
ndkVersion = versionMap["NDK"] as String
|
||||
compileSdk = versionMap["COMPILE_SDK"] as Int
|
||||
|
||||
defaultConfig {
|
||||
minSdk = versionMap["MIN_SDK"] as Int
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags += "-std=c++17"
|
||||
|
||||
// @Hint by SuperMonster003 on Aug 28, 2025.
|
||||
// ! Moved into `target_link_libraries(pngquant_bridge ...)` in `CMakeLists.txt`.
|
||||
// ! zh-CN: 移至 `CMakeLists.txt` 文件 `target_link_libraries(pngquant_bridge ...)` 代码中.
|
||||
// # cFlags "-ljnigraphics"
|
||||
}
|
||||
}
|
||||
|
||||
ndk {
|
||||
abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
|
||||
}
|
||||
|
||||
lint {
|
||||
targetSdk = versionMap["TARGET_SDK"] as Int
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path = file("CMakeLists.txt")
|
||||
version = versionMap["CMAKE"] as String
|
||||
}
|
||||
}
|
||||
}
|
||||
2
libs/imagequant/proguard-rules.pro
vendored
2
libs/imagequant/proguard-rules.pro
vendored
@@ -1,6 +1,6 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
# proguardFiles setting in build.gradle.kts.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
Reference in New Issue
Block a user