Add selectable Zhanxun signing profile for Android APK
This commit is contained in:
1 parent
208d37b7d8
commit
40ff016f6b
3 files changed
+13
-5
No files matched your search
@@ -8,3 +8,5 @@ app/src/main/jniLibs/
|
||||
signing.local.properties
|
||||
|
||||
agent.local.properties
|
||||
|
||||
signing.*.local.properties
|
||||
@@ -93,3 +93,7 @@ gradle :app:assembleRelease '-Pandroid.aapt2FromMavenOverride=F:/AndroidSDK/buil
|
||||
重新构建仍需本机 agent.local.properties;该文件和签名配置都不得提交。没有新增自动启动或自动开启 adbd 行为,仍需用户点击保存并启动。产物为 ../bin/apk/ads-android-agent-0.1.1-crosshatch.apk,versionCode=2,默认 Crosshatch 签名。
|
||||
|
||||
后续 APK 统一交付到仓库 `bin/apk/`,该目录只保存自动生成的 APK,无业务源码且不纳入 Git。
|
||||
|
||||
## 可选 Zhanxun 签名
|
||||
|
||||
默认保留 Crosshatch;使用 `gradle :app:assembleRelease -PadsSigning=zhanxun` 选择 Zhanxun。密钥参数放在 Git 忽略的 `signing.zhanxun.local.properties`,字段与默认签名相同。产物名称带 `-zhanxun`,输出到根目录 `bin/apk/`。
|
||||
@@ -1,7 +1,9 @@
|
||||
import java.util.Properties
|
||||
|
||||
plugins { id("com.android.application"); id("org.jetbrains.kotlin.android") }
|
||||
val signingFile = rootProject.file("signing.local.properties")
|
||||
val signingProfile = providers.gradleProperty("adsSigning").orElse("crosshatch").get()
|
||||
require(signingProfile in listOf("crosshatch", "zhanxun")) { "Unsupported adsSigning profile" }
|
||||
val signingFile = rootProject.file(if (signingProfile == "crosshatch") "signing.local.properties" else "signing.zhanxun.local.properties")
|
||||
val crosshatchProperties = Properties().apply {
|
||||
if (signingFile.isFile) signingFile.inputStream().use { load(it) }
|
||||
}
|
||||
@@ -22,7 +24,7 @@ android {
|
||||
buildConfigField("String", "AGENT_TOKEN", "\"" + agentToken.replace("\\", "\\\\").replace("\"", "\\\"") + "\"")
|
||||
applicationId = "com.ttstd.ads"; minSdk = 23; targetSdk = 35; versionCode = 2; versionName = "0.1.1"; ndk { abiFilters += listOf("arm64-v8a", "armeabi-v7a", "x86_64") } }
|
||||
signingConfigs {
|
||||
create("crosshatch") {
|
||||
create(signingProfile) {
|
||||
storeFile = file(signingValue("storeFile"))
|
||||
storePassword = signingValue("storePassword")
|
||||
keyAlias = signingValue("keyAlias")
|
||||
@@ -30,8 +32,8 @@ android {
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
getByName("debug") { signingConfig = signingConfigs.getByName("crosshatch") }
|
||||
getByName("release") { signingConfig = signingConfigs.getByName("crosshatch"); isMinifyEnabled = false }
|
||||
getByName("debug") { signingConfig = signingConfigs.getByName(signingProfile) }
|
||||
getByName("release") { signingConfig = signingConfigs.getByName(signingProfile); isMinifyEnabled = false }
|
||||
}
|
||||
compileOptions { sourceCompatibility = JavaVersion.VERSION_17; targetCompatibility = JavaVersion.VERSION_17 }
|
||||
kotlinOptions { jvmTarget = "17" }
|
||||
@@ -55,7 +57,7 @@ tasks.matching { it.name == "assembleRelease" || it.name == "assembleDebug" }.co
|
||||
copy {
|
||||
from(source)
|
||||
into(rootProject.file("../bin/apk"))
|
||||
rename { "ads-android-agent-${android.defaultConfig.versionName}-crosshatch${if (variant == "debug") "-debug" else ""}.apk" }
|
||||
rename { "ads-android-agent-${android.defaultConfig.versionName}-${signingProfile}${if (variant == "debug") "-debug" else ""}.apk" }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user