|
@@ -1,3 +1,13 @@
|
|
|
|
+import com.android.build.gradle.internal.api.BaseVariantOutputImpl
|
|
|
|
+import java.text.SimpleDateFormat
|
|
|
|
+import java.util.Date
|
|
|
|
+
|
|
|
|
+fun getVersionCode(): Int {
|
|
|
|
+ val dateFormat = SimpleDateFormat("yyyyMMdd")
|
|
|
|
+ val versionCodeStr = dateFormat.format(Date())
|
|
|
|
+ return versionCodeStr.toInt()
|
|
|
|
+}
|
|
|
|
+
|
|
plugins {
|
|
plugins {
|
|
alias(libs.plugins.android.application)
|
|
alias(libs.plugins.android.application)
|
|
alias(libs.plugins.kotlin.android)
|
|
alias(libs.plugins.kotlin.android)
|
|
@@ -13,8 +23,8 @@ android {
|
|
applicationId = "com.hzliuzhi.applet.container"
|
|
applicationId = "com.hzliuzhi.applet.container"
|
|
minSdk = 26
|
|
minSdk = 26
|
|
targetSdk = 35
|
|
targetSdk = 35
|
|
- versionCode = 1
|
|
|
|
- versionName = "1.0"
|
|
|
|
|
|
+ versionCode = getVersionCode()
|
|
|
|
+ versionName = "2.0.0"
|
|
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
}
|
|
}
|
|
@@ -24,7 +34,34 @@ android {
|
|
isMinifyEnabled = false
|
|
isMinifyEnabled = false
|
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
|
}
|
|
}
|
|
|
|
+ create("aio") {
|
|
|
|
+ resValue("string", "build_type_tag", "AIO")
|
|
|
|
+ initWith(getByName("debug"))
|
|
|
|
+ matchingFallbacks += listOf("debug")
|
|
|
|
+ }
|
|
|
|
+ create("aio-test") {
|
|
|
|
+ initWith(getByName("aio"))
|
|
|
|
+ matchingFallbacks += listOf("aio", "debug")
|
|
|
|
+ }
|
|
|
|
+ create("aio-CQ") {
|
|
|
|
+ initWith(getByName("aio-test"))
|
|
|
|
+ matchingFallbacks += listOf("aio-test", "aio", "debug")
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ applicationVariants.all {
|
|
|
|
+ outputs.all {
|
|
|
|
+ val appName = "six" // 你的自定义名称
|
|
|
|
+ val buildType = buildType.name
|
|
|
|
+ val versionName = versionName
|
|
|
|
+ val versionCode = versionCode
|
|
|
|
+
|
|
|
|
+ val fileName = "${appName}.${buildType}-${versionName}-${versionCode}.apk"
|
|
|
|
+ (this as BaseVariantOutputImpl).apply {
|
|
|
|
+ outputFileName = fileName
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
compileOptions {
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_11
|