6.7.0 - Alpha6 - Gradle 脚本由 buildSrc 迁移至 build-logic 并启用类型安全访问器

This commit is contained in:
SuperMonster003
2025-10-06 12:56:22 +08:00
parent 4235ffda82
commit aa603aac44
61 changed files with 165 additions and 180 deletions

View File

@@ -101,7 +101,7 @@ dependencies /* Unclassified */ {
implementation(libs.analytics) implementation(libs.analytics)
// Bugly // Bugly
implementation(project(":libs:com.tencent.bugly.crashreport-4.0.4")) implementation(project(":libs:com-tencent-bugly-crashreport-4_0_4"))
// OkHttp // OkHttp
implementation(libs.okhttp) implementation(libs.okhttp)
@@ -146,7 +146,7 @@ dependencies /* Unclassified */ {
// RootShell // RootShell
// implementation("com.github.Stericson:RootShell:1.6") // implementation("com.github.Stericson:RootShell:1.6")
implementation(project(":libs:root-shell-1.6")) implementation(project(":libs:root-shell-1_6"))
// JDeferred // JDeferred
implementation(libs.jdeferred) implementation(libs.jdeferred)
@@ -162,16 +162,16 @@ dependencies /* Unclassified */ {
implementation(libs.versioncompare) implementation(libs.versioncompare)
// Terminal Emulator // Terminal Emulator
implementation(project(":libs:jackpal.androidterm.libtermexec-1.0")) implementation(project(":libs:jackpal-androidterm-libtermexec-1_0"))
implementation(project(":libs:jackpal.androidterm.emulatorview-1.0.42")) implementation(project(":libs:jackpal-androidterm-emulatorview-1_0_42"))
implementation(project(":libs:jackpal.androidterm-1.0.70")) implementation(project(":libs:jackpal-androidterm-1_0_70"))
// Dex // Dex
implementation(files("$rootDir/libs/com.android.dx-1.14.jar")) implementation(files("$rootDir/libs/com-android-dx-1_14.jar"))
implementation(files("$rootDir/libs/com.legacy.android.dx-1.7.0.jar")) implementation(files("$rootDir/libs/com-legacy-android-dx-1_7_0.jar"))
// OpenCV // OpenCV
implementation(project(":libs:org.opencv-4.8.0")) implementation(project(":libs:org-opencv-4_8_0"))
// PaddleOCR // PaddleOCR
implementation(project(":libs:paddleocr")) implementation(project(":libs:paddleocr"))
@@ -183,7 +183,7 @@ dependencies /* Unclassified */ {
implementation(project(":libs:imagequant")) implementation(project(":libs:imagequant"))
// Android Job // Android Job
implementation(project(":libs:android-job-simplified-1.4.3")) implementation(project(":libs:android-job-simplified-1_4_3"))
// APK Parser // APK Parser
// implementation("com.jaredrummler:apk-parser:1.0.2") // implementation("com.jaredrummler:apk-parser:1.0.2")
@@ -191,18 +191,18 @@ dependencies /* Unclassified */ {
implementation(project(":modules:apk-parser")) implementation(project(":modules:apk-parser"))
// Prism4j // Prism4j
implementation(files("$rootDir/libs/prism4j-2.0.0.jar")) implementation(files("$rootDir/libs/prism4j-2_0_0.jar"))
implementation(files("$rootDir/libs/prism4j-bundler-2.0.0.jar")) implementation(files("$rootDir/libs/prism4j-bundler-2_0_0.jar"))
implementation(project(":libs:markwon-core-4.6.2")) implementation(project(":libs:markwon-core-4_6_2"))
implementation(project(":libs:markwon-syntax-highlight-4.6.2")) implementation(project(":libs:markwon-syntax-highlight-4_6_2"))
// Rhino // Rhino
implementation(files("$rootDir/libs/org.mozilla.rhino-1.8.1-SNAPSHOT.jar")) implementation(files("$rootDir/libs/org-mozilla-rhino-1_8_1-SNAPSHOT.jar"))
// Tasker Plugin // Tasker Plugin
implementation(project(":libs:android-spackle-9.0.0")) implementation(project(":libs:android-spackle-9_0_0"))
implementation(project(":libs:android-assertion-9.0.0")) implementation(project(":libs:android-assertion-9_0_0"))
implementation(project(":libs:android-plugin-client-sdk-for-locale-9.0.0")) implementation(project(":libs:android-plugin-client-sdk-for-locale-9_0_0"))
// JavaMail for Android // JavaMail for Android
implementation(files("$rootDir/libs/javamail-android/activation.jar")) implementation(files("$rootDir/libs/javamail-android/activation.jar"))
@@ -228,7 +228,7 @@ dependencies /* Unclassified */ {
implementation(project(":modules:jieba-analysis")) implementation(project(":modules:jieba-analysis"))
// Tiny Sign // Tiny Sign
implementation(files("$rootDir/libs/tiny-sign-0.9.jar")) implementation(files("$rootDir/libs/tiny-sign-0_9.jar"))
// Room // Room
implementation(libs.room.runtime) implementation(libs.room.runtime)
@@ -267,7 +267,7 @@ dependencies /* MIME */ {
// MIME Util // MIME Util
// implementation("eu.medsea.mimeutil:mime-util:2.1.3") // implementation("eu.medsea.mimeutil:mime-util:2.1.3")
implementation(files("$rootDir/libs/mime-util-2.1.3.jar")) implementation(files("$rootDir/libs/mime-util-2_1_3.jar"))
} }
dependencies /* Test */ { dependencies /* Test */ {
@@ -299,7 +299,7 @@ dependencies /* AppCompat */ {
implementation(libs.appcompat) implementation(libs.appcompat)
// AppCompat for legacy views (such as JsTextViewLegacy) // AppCompat for legacy views (such as JsTextViewLegacy)
implementation(project(":libs:androidx.appcompat-1.0.2")) { implementation(project(":libs:androidx-appcompat-1_0_2")) {
setVersion("1.0.2") setVersion("1.0.2")
} }
} }
@@ -326,14 +326,14 @@ dependencies /* Material Dialogs */ {
dependencies /* Layout */ { dependencies /* Layout */ {
// Expandable Layout // Expandable Layout
// implementation("com.github.aakira:expandable-layout:1.6.0") // implementation("com.github.aakira:expandable-layout:1.6.0")
implementation(project(":libs:expandable-layout-1.6.0")) implementation(project(":libs:expandable-layout-1_6_0"))
// Expandable RecyclerView // Expandable RecyclerView
implementation(libs.expandablerecyclerview) implementation(libs.expandablerecyclerview)
// Flexible Divider // Flexible Divider
// implementation("com.yqritc:recyclerview-flexibledivider:1.4.0") // implementation("com.yqritc:recyclerview-flexibledivider:1.4.0")
implementation(project(":libs:recyclerview-flexibledivider-1.4.0")) implementation(project(":libs:recyclerview-flexibledivider-1_4_0"))
} }
dependencies /* View */ { dependencies /* View */ {
@@ -349,7 +349,7 @@ dependencies /* View */ {
dependencies /* GitHub API */ { dependencies /* GitHub API */ {
// GitHub API // GitHub API
implementation(files("$rootDir/libs/github-api-1.306.jar")) implementation(files("$rootDir/libs/github-api-1_306.jar"))
// Commons IO // Commons IO
// @Hint by SuperMonster003 on Sep 25, 2025. // @Hint by SuperMonster003 on Sep 25, 2025.
@@ -394,7 +394,7 @@ dependencies /* Auto.js Extensions */ {
// Auto.js APK Builder // Auto.js APK Builder
// @Integrated by SuperMonster003 on Mar 30, 2023. // @Integrated by SuperMonster003 on Mar 30, 2023.
// # implementation(project(":libs:Auto.js-ApkBuilder-1.0.3")) // # implementation(project(":libs:Autojs-ApkBuilder-1_0_3"))
// Extracted from com.github.hyb1996:MutableTheme:1.0.0 // Extracted from com.github.hyb1996:MutableTheme:1.0.0
implementation(libs.recyclerview) implementation(libs.recyclerview)

View File

@@ -0,0 +1,98 @@
import java.util.Properties
plugins {
`kotlin-dsl` /* kotlin("jvm") */
`java-gradle-plugin`
}
repositories {
mavenCentral()
}
dependencies {
implementation(gradleApi())
implementation(libs.apache.commons.compress)
implementation(libs.tukaani.xz)
}
gradlePlugin {
plugins {
register("utils") {
id = "org.autojs.build.utils"
implementationClass = "org.autojs.build.UtilsPlugin"
displayName = "AutoJs6 Build Utils Plugin"
description = "Provides utilities for downloading, extracting archives, and version helpers."
}
register("versions") {
id = "org.autojs.build.versions"
implementationClass = "org.autojs.build.VersionsPlugin"
displayName = "AutoJs6 Versions Plugin"
description = "Provides version helpers."
}
register("signs") {
id = "org.autojs.build.signs"
implementationClass = "org.autojs.build.SignsPlugin"
displayName = "AutoJs6 Signs Plugin"
description = "Provides signing helpers."
}
register("properties") {
id = "org.autojs.build.properties"
implementationClass = "org.autojs.build.PropertiesPlugin"
displayName = "AutoJs6 Properties Plugin"
description = "Provides properties helpers."
}
register("jvmConvention") {
id = "org.autojs.build.jvm-convention"
implementationClass = "org.autojs.build.JvmConventionPlugin"
displayName = "AutoJs6 JVM Convention Plugin"
description = "Configures Java/Kotlin targets for Android modules using central Versions."
}
}
}
run determineBuildSrcJdk@{
val propsFile: File = rootDir.parentFile.resolve("version.properties")
val minSupported: Int = Properties().let { props ->
require(propsFile.isFile) {
"version.properties not found in root directory"
}
propsFile.inputStream().use { props.load(it) }
val minSupportedVersion = props.getProperty("JAVA_VERSION_MIN_SUPPORTED")
require(minSupportedVersion != null) {
"version.properties does not contain \"JAVA_VERSION_MIN_SUPPORTED\""
}
minSupportedVersion.toInt()
}
val current = JavaVersion.current().majorVersion.toIntOrNull() ?: minSupported
fun tryAdjustByKotlinJvmTarget(sourceVersion: Int): Int {
return runCatching {
val cls = Class.forName("org.jetbrains.kotlin.gradle.dsl.JvmTarget")
val enumConstants = cls.enumConstants ?: return sourceVersion
var tmpVersion = sourceVersion
while (tmpVersion > minSupported) {
val wanted = "JVM_$tmpVersion"
if (enumConstants.any { it?.toString().equals(wanted, ignoreCase = true) }) {
return tmpVersion
}
tmpVersion -= 1
}
return@runCatching sourceVersion
}.getOrDefault(sourceVersion)
}
tryAdjustByKotlinJvmTarget(maxOf(current, minSupported)).also {
println("Toolchain: selected [$it] / current [$current] / min [$minSupported]")
}
}.let { jdk ->
kotlin {
jvmToolchain(jdk)
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(jdk))
}
}

View File

@@ -0,0 +1,17 @@
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
dependencyResolutionManagement {
repositories {
mavenCentral()
google()
}
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
include(":convention")
rootProject.name = "build-logic"

View File

@@ -1,110 +0,0 @@
@file:Suppress("ObjectLiteralToLambda")
import java.util.*
plugins {
`kotlin-dsl` /* kotlin("jvm") */
`java-gradle-plugin`
}
repositories {
mavenCentral()
}
dependencies {
implementation(libs.apache.commons.compress)
implementation(libs.tukaani.xz)
implementation(gradleApi())
}
gradlePlugin {
plugins {
create("buildUtils", object : Action<PluginDeclaration> {
override fun execute(t: PluginDeclaration) {
t.id = "org.autojs.build.utils"
t.implementationClass = "org.autojs.build.UtilsPlugin"
t.displayName = "AutoJs6 Build Utils Plugin"
t.description = "Provides utilities for downloading, extracting archives, and version helpers."
}
})
create("buildVersions", object : Action<PluginDeclaration> {
override fun execute(t: PluginDeclaration) {
t.id = "org.autojs.build.versions"
t.implementationClass = "org.autojs.build.VersionsPlugin"
t.displayName = "AutoJs6 Versions Plugin"
t.description = "Provides version helpers."
}
})
create("buildSigns", object : Action<PluginDeclaration> {
override fun execute(t: PluginDeclaration) {
t.id = "org.autojs.build.signs"
t.implementationClass = "org.autojs.build.SignsPlugin"
t.displayName = "AutoJs6 Signs Plugin"
t.description = "Provides signing helpers."
}
})
create("buildProperties", object : Action<PluginDeclaration> {
override fun execute(t: PluginDeclaration) {
t.id = "org.autojs.build.properties"
t.implementationClass = "org.autojs.build.PropertiesPlugin"
t.displayName = "AutoJs6 Properties Plugin"
t.description = "Provides properties helpers."
}
})
create("jvmConvention", object : Action<PluginDeclaration> {
override fun execute(t: PluginDeclaration) {
t.id = "org.autojs.build.jvm-convention"
t.implementationClass = "org.autojs.build.JvmConventionPlugin"
t.displayName = "AutoJs6 JVM Convention Plugin"
t.description = "Configures Java/Kotlin targets for Android modules using central Versions."
}
})
}
}
run determineBuildSrcJdk@{
val propsFile: File = rootDir.parentFile.resolve("version.properties")
val minSupported: Int = Properties().let { props ->
require(propsFile.isFile) {
"version.properties not found in root directory"
}
propsFile.inputStream().use { props.load(it) }
val minSupportedVersion = props.getProperty("JAVA_VERSION_MIN_SUPPORTED")
require(minSupportedVersion != null) {
"version.properties does not contain \"JAVA_VERSION_MIN_SUPPORTED\""
}
minSupportedVersion.toInt()
}
val current = JavaVersion.current().majorVersion.toIntOrNull() ?: minSupported
fun tryAdjustByKotlinJvmTarget(sourceVersion: Int): Int {
return runCatching {
val cls = Class.forName("org.jetbrains.kotlin.gradle.dsl.JvmTarget")
val enumConstants = cls.enumConstants ?: return sourceVersion
var tmpVersion = sourceVersion
while (tmpVersion > minSupported) {
val wanted = "JVM_$tmpVersion"
if (enumConstants.any { it?.toString().equals(wanted, ignoreCase = true) }) {
return tmpVersion
}
tmpVersion -= 1
}
return@runCatching sourceVersion
}.getOrDefault(sourceVersion)
}
tryAdjustByKotlinJvmTarget(maxOf(current, minSupported)).also {
println("Toolchain: selected [$it] / current [$current] / min [$minSupported]")
}
}.let { jdk ->
kotlin {
jvmToolchain(jdk)
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(jdk))
}
}

View File

@@ -1,26 +0,0 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
google()
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
plugins {
// @Hint by SuperMonster003 on Sep 14, 2025.
// ! Enable JDK auto-resolution/download capability for build modules.
// ! zh-CN: 让构建模块具备 JDK 自动解析/下载能力.
id("org.gradle.toolchains.foojay-resolver-convention")
}

View File

@@ -163,7 +163,7 @@ android {
dependencies { dependencies {
implementation(fileTree(mapOf("include" to listOf("*.jar"), "dir" to "libs"))) implementation(fileTree(mapOf("include" to listOf("*.jar"), "dir" to "libs")))
implementation(project(mapOf("path" to ":libs:org.opencv-${versionMap["OPENCV"]}"))) implementation(project(mapOf("path" to ":libs:org-opencv-${versionMap["OPENCV"]}".replace(".", "_"))))
implementation(libs.core.ktx) implementation(libs.core.ktx)
implementation(libs.preference.ktx) implementation(libs.preference.ktx)
} }

View File

@@ -10,29 +10,29 @@ private val modules = listOf(
) )
private val libs = listOf( private val libs = listOf(
"android-job-simplified-1.4.3", "android-job-simplified-1_4_3",
"androidx.appcompat-1.0.2", "androidx-appcompat-1_0_2",
"apk-parser-1.0.2", "apk-parser-1_0_2",
"com.tencent.bugly.crashreport-4.0.4", "com-tencent-bugly-crashreport-4_0_4",
"org.opencv-4.8.0", "org-opencv-4_8_0",
"paddleocr", "paddleocr",
"rapidocr", "rapidocr",
"imagequant", "imagequant",
"jackpal.androidterm-1.0.70", "jackpal-androidterm-1_0_70",
"jackpal.androidterm.emulatorview-1.0.42", "jackpal-androidterm-emulatorview-1_0_42",
"jackpal.androidterm.libtermexec-1.0", "jackpal-androidterm-libtermexec-1_0",
"android-spackle-9.0.0", "android-spackle-9_0_0",
"android-assertion-9.0.0", "android-assertion-9_0_0",
"android-plugin-client-sdk-for-locale-9.0.0", "android-plugin-client-sdk-for-locale-9_0_0",
"markwon-core-4.6.2", "markwon-core-4_6_2",
"markwon-syntax-highlight-4.6.2", "markwon-syntax-highlight-4_6_2",
"root-shell-1.6", "root-shell-1_6",
"expandable-layout-1.6.0", "expandable-layout-1_6_0",
"recyclerview-flexibledivider-1.4.0" "recyclerview-flexibledivider-1_4_0"
) )
include( include(
@@ -799,3 +799,9 @@ plugins {
// ! zh-CN: 让构建模块具备 JDK 自动解析/下载能力. // ! zh-CN: 让构建模块具备 JDK 自动解析/下载能力.
id("org.gradle.toolchains.foojay-resolver-convention") id("org.gradle.toolchains.foojay-resolver-convention")
} }
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
includeBuild("build-logic")
rootProject.name = "AutoJs6"

View File

@@ -1,5 +1,5 @@
#Sun Oct 05 13:27:08 CST 2025 #Mon Oct 06 12:48:51 CST 2025
BUILD_TIME=1759642028837 BUILD_TIME=1759726131752
COMPILE_SDK_VERSION=36 COMPILE_SDK_VERSION=36
IMAGE_QUANT_CMAKE_VERSION=3.22.1 IMAGE_QUANT_CMAKE_VERSION=3.22.1
IMAGE_QUANT_NDK_VERSION=26.1.10909125 IMAGE_QUANT_NDK_VERSION=26.1.10909125
@@ -27,6 +27,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3 RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
TARGET_SDK_VERSION=36 TARGET_SDK_VERSION=36
TARGET_SDK_VERSION_INRT=29 TARGET_SDK_VERSION_INRT=29
VERSION_BUILD=3404 VERSION_BUILD=3405
VERSION_NAME=6.7.0 Alpha6 VERSION_NAME=6.7.0 Alpha6
VSCODE_EXT_REQUIRED_VERSION=1.0.8 VSCODE_EXT_REQUIRED_VERSION=1.0.8