build: 配置 release 签名(keystore.properties 已 .gitignore),支持 assembleRelease/bundleRelease
This commit is contained in:
1 parent
231ee78ac2
commit
92d497886e
2 files changed
+24
No files matched your search
@@ -6,3 +6,7 @@ local.properties
|
||||
!apk/*.apk
|
||||
tools/
|
||||
notes.txt
|
||||
keystore.properties
|
||||
*.jks
|
||||
*.keystore
|
||||
*.aab
|
||||
@@ -1,8 +1,16 @@
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
}
|
||||
|
||||
// release 签名:从仓库根的 keystore.properties 读取(该文件已 .gitignore,缺失时不影响 debug 构建)
|
||||
val ksProps = Properties().apply {
|
||||
val f = rootProject.file("keystore.properties")
|
||||
if (f.exists()) f.inputStream().use { load(it) }
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.iptv807.tv"
|
||||
compileSdk = 35
|
||||
@@ -15,9 +23,21 @@ android {
|
||||
versionName = "9.3.0"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
if (ksProps.isNotEmpty()) {
|
||||
create("release") {
|
||||
storeFile = rootProject.file(ksProps.getProperty("storeFile", ""))
|
||||
storePassword = ksProps.getProperty("storePassword")
|
||||
keyAlias = ksProps.getProperty("keyAlias")
|
||||
keyPassword = ksProps.getProperty("keyPassword")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
signingConfig = signingConfigs.findByName("release")
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user