合并打包功能代码

autoJS打包目前只能兼容V1版本的签名,而由于谷歌的限制,如果targetSdk为30或以上的话,打包的应用就无法安装,所以打包(构建时选择inrt分支)时需要将TARGET_SDK_VERSION设置为29或以下。
This commit is contained in:
Ai
2023-09-30 13:51:10 +08:00
committed by SuperMonster003
parent 4481f539f9
commit 330ae87f4c
23 changed files with 1141 additions and 182 deletions

View File

@@ -288,6 +288,45 @@ android {
minSdk = versions.sdkVersionMin
targetSdk = versions.sdkVersionTarget
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("boolean", "isInrt", "false")
}
flavorDimensions.add("channel")
productFlavors {
create("app") {
dimension = "channel"
versionCode = versions.appVersionCode
versionName = versions.appVersionName
buildConfigField("String", "CHANNEL", "\"app\"")
buildConfigField("boolean", "isInrt", "false")
manifestPlaceholders.putAll(
mapOf(
"CHANNEL" to "app",
"appName" to "@string/app_name",
"intentCategory" to "android.intent.category.LAUNCHER",
"intentCategoryInrt" to "android.intent.category.DEFAULT",
"authorities" to "org.autojs.autojs6.fileprovider"
)
)
}
create("inrt") {
dimension = "channel"
applicationIdSuffix = ".inrt"
versionCode = versions.appVersionCode
versionName = versions.appVersionName
buildConfigField("String", "CHANNEL", "\"inrt\"")
buildConfigField("boolean", "isInrt", "true")
manifestPlaceholders.putAll(
mapOf(
"CHANNEL" to "inrt",
"appName" to "AutoJs6.inrt",
"intentCategory" to "android.intent.category.DEFAULT",
"intentCategoryInrt" to "android.intent.category.LAUNCHER",
"authorities" to "org.autojs.autojs6.inrt.fileprovider"
)
)
}
}
compileOptions {
@@ -312,6 +351,9 @@ android {
"META-INF/ASL2.0",
"META-INF/*.kotlin_module",
).let { resources.pickFirsts.addAll(it) }
jniLibs {
useLegacyPackaging = true
}
}
kotlinOptions {
@@ -369,13 +411,22 @@ android {
javaCompileOptions {
annotationProcessorOptions {
mapOf(
"resourcePackageName" to (this@defaultConfig.applicationId ?: this@Build_gradle.applicationId),
"resourcePackageName" to (this@defaultConfig.applicationId
?: this@Build_gradle.applicationId),
"androidManifestFile" to ("$projectDir/src/main/AndroidManifest.xml")
).let { arguments(it) }
}
}
buildConfigField("String", "VERSION_DATE", "\"${Utils.getDateString("MMM d, yyyy", "GMT+08:00")}\"")
buildConfigField("String", "VSCODE_EXT_REQUIRED_VERSION", "\"${versions.vscodeExtRequiredVersion}\"")
buildConfigField(
"String",
"VERSION_DATE",
"\"${Utils.getDateString("MMM d, yyyy", "GMT+08:00")}\""
)
buildConfigField(
"String",
"VSCODE_EXT_REQUIRED_VERSION",
"\"${versions.vscodeExtRequiredVersion}\""
)
}
applicationVariants.all {