6.7.0 - Alpha6 - 使用 Gradle 约定插件简化本地 AAR 库加载逻辑

This commit is contained in:
SuperMonster003
2025-10-09 17:51:09 +08:00
parent b83ce13d0e
commit 35fbcbda42
22 changed files with 147 additions and 149 deletions

View File

@@ -46,6 +46,7 @@
"Gradle 构建脚本支持自动生成 VersionCodesList 类所需数据以降低脚本启动延迟",
"使用版本目录 (Version Catalogs) 集中管理 Gradle 依赖和插件版本",
"模块化 Gradle 构建脚本, 将共享构建逻辑迁移至 buildSrc 并抽象为约定插件",
"使用 Gradle 约定插件简化本地 AAR 库加载逻辑",
"使用 Toolchain 替代 sourceCompatibility/targetCompatibility 以降低构建环境差异"
],
"dependency": [

View File

@@ -47,6 +47,12 @@ gradlePlugin {
displayName = "AutoJs6 JVM Convention Plugin"
description = "Configures Java/Kotlin targets for Android modules using central Versions."
}
register("localAarRegisterConvention") {
id = "org.autojs.build.local-arr-register-convention"
implementationClass = "org.autojs.build.LocalAarRegisterConventionPlugin"
displayName = "AutoJs6 Local AAR Register Convention Plugin"
description = "Provides local AAR register helpers."
}
}
}

View File

@@ -0,0 +1,26 @@
@file:Suppress("unused")
package org.autojs.build
import org.gradle.api.Plugin
import org.gradle.api.Project
open class LocalAarExtension {
val files = mutableListOf<String>()
var configurationName: String? = null
}
class LocalAarRegisterConventionPlugin : Plugin<Project> {
override fun apply(project: Project) {
val ext = project.extensions.create("localAars", LocalAarExtension::class.java)
project.afterEvaluate {
val configName = ext.configurationName ?: "default"
configurations.maybeCreate(configName)
ext.files.forEach { path ->
val aar = file(path)
require(aar.exists()) { "File not found: \"$path\"" }
artifacts.add(configName, aar)
}
}
}
}

View File

@@ -4,8 +4,6 @@
// ! Blocks "buildscript" and "plugins" have been moved to "settings.gradle.kts".
// ! zh-CN: 代码块 "buildscript" 以及 "plugins" 已迁移至 "settings.gradle.kts".
extra["configurationName"] = "default"
allprojects {
repositories {
mavenCentral()

View File

@@ -1,9 +1,7 @@
"android-assertion-9.0.0.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "android-assertion-9.0.0.aar"
}

View File

@@ -1,12 +1,10 @@
// @Modified
// ! Current library (Android Job) was simplified by SuperMonster003 on Jun 30, 2022.
"android-job-simplified.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "android-job-simplified.aar"
}

View File

@@ -1,9 +1,7 @@
"android-plugin-client-sdk-for-locale-9.0.0.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "android-plugin-client-sdk-for-locale-9.0.0.aar"
}

View File

@@ -1,9 +1,7 @@
"android-spackle-9.0.0.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "android-spackle-9.0.0.aar"
}

View File

@@ -1,9 +1,7 @@
"appcompat-legacy.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "appcompat-legacy.aar"
}

View File

@@ -1,9 +1,7 @@
"apk-parser-1.0.2.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "apk-parser-1.0.2.aar"
}

View File

@@ -1,9 +1,7 @@
"crashreport-4.0.4.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "crashreport-4.0.4.aar"
}

View File

@@ -1,9 +1,7 @@
"expandable-layout-1.6.0.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "expandable-layout-1.6.0.aar"
}

View File

@@ -1,9 +1,7 @@
"term-debug.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "term-debug.aar"
}

View File

@@ -1,9 +1,7 @@
"emulatorview-release.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "emulatorview-release.aar"
}

View File

@@ -1,9 +1,7 @@
"libtermexec-release.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "libtermexec-release.aar"
}

View File

@@ -1,9 +1,7 @@
"markwon-core-4.6.2.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "markwon-core-4.6.2.aar"
}

View File

@@ -1,9 +1,7 @@
"markwon-syntax-highlight-4.6.2.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "markwon-syntax-highlight-4.6.2.aar"
}

View File

@@ -1,12 +1,10 @@
// @Reference
// ! Current library (OpenCV) was referred to TonyJiangWJ/Auto.js (https://github.com/TonyJiangWJ/Auto.js) on Oct 18, 2022.
"opencv-4.8.0.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "opencv-4.8.0.aar"
}

View File

@@ -1,9 +1,7 @@
"recyclerview-flexibledivider-1.4.0.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "recyclerview-flexibledivider-1.4.0.aar"
}

View File

@@ -1,9 +1,7 @@
"root-shell-1.6.aar"
.let { path ->
rootProject.extra["configurationName"].toString().let { name ->
configurations.maybeCreate(name)
file(path).takeIf { it.exists() }?.also {
artifacts.add(name, it)
} ?: throw Exception("File not found: \"$path\"")
plugins {
id("org.autojs.build.local-arr-register-convention")
}
localAars {
files += "root-shell-1.6.aar"
}

View File

@@ -1,6 +1,5 @@
@file:Suppress("SpellCheckingInspection")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
rootProject.name = "root"

View File

@@ -1,5 +1,5 @@
#Thu Oct 09 17:07:45 CST 2025
BUILD_TIME=1760000865200
#Thu Oct 09 17:46:30 CST 2025
BUILD_TIME=1760003190056
COMPILE_SDK_VERSION=36
IMAGE_QUANT_CMAKE_VERSION=3.22.1
IMAGE_QUANT_NDK_VERSION=26.1.10909125