fix: nightly versioning
This commit is contained in:
parent
4dd8241fa1
commit
a9a49e3421
|
@ -21,8 +21,8 @@ android {
|
|||
applicationId = Constants.APP_ID
|
||||
minSdk = Constants.MIN_SDK
|
||||
targetSdk = Constants.TARGET_SDK
|
||||
versionCode = versionCode()
|
||||
versionName = versionName()
|
||||
versionCode = Constants.VERSION_CODE
|
||||
versionName = Constants.VERSION_NAME
|
||||
|
||||
ksp { arg("room.schemaLocation", "$projectDir/schemas") }
|
||||
|
||||
|
@ -67,12 +67,14 @@ android {
|
|||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro",
|
||||
)
|
||||
signingConfig = signingConfigs.getByName(signingConfigName())
|
||||
signingConfig = signingConfigs.getByName(Constants.RELEASE)
|
||||
}
|
||||
debug { isDebuggable = true }
|
||||
|
||||
create("nightly") {
|
||||
create(Constants.NIGHTLY) {
|
||||
initWith(getByName("release"))
|
||||
defaultConfig.versionName = nightlyVersionName()
|
||||
defaultConfig.versionCode = nightlyVersionCode()
|
||||
}
|
||||
}
|
||||
flavorDimensions.add(Constants.TYPE)
|
||||
|
@ -183,10 +185,10 @@ dependencies {
|
|||
implementation(libs.androidx.core.splashscreen)
|
||||
}
|
||||
|
||||
fun versionCode() : Int {
|
||||
return if(!isNightlyBuild()) Constants.VERSION_CODE else Constants.VERSION_CODE + Constants.NIGHTLY_CODE
|
||||
fun nightlyVersionCode() : Int {
|
||||
return Constants.VERSION_CODE + Constants.NIGHTLY_CODE
|
||||
}
|
||||
|
||||
fun versionName() : String {
|
||||
return if(!isNightlyBuild()) Constants.VERSION_NAME else Constants.VERSION_NAME + "-${grgitService.service.get().grgit.head().abbreviatedId}"
|
||||
fun nightlyVersionName() : String {
|
||||
return Constants.VERSION_NAME + "-${grgitService.service.get().grgit.head().abbreviatedId}"
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ object Constants {
|
|||
const val KEY_STORE_PATH_VAR = "KEY_STORE_PATH"
|
||||
|
||||
const val RELEASE = "release"
|
||||
const val NIGHTLY = "nightly"
|
||||
const val DEBUG = "debug"
|
||||
const val TYPE = "type"
|
||||
|
||||
|
|
|
@ -39,16 +39,6 @@ fun Project.isGeneralFlavor(gradle: Gradle): Boolean {
|
|||
return getCurrentFlavor(gradle) == "general"
|
||||
}
|
||||
|
||||
fun Project.isReleaseBuild(): Boolean {
|
||||
return (gradle.startParameter.taskNames.size > 0 &&
|
||||
gradle.startParameter.taskNames[0].contains(
|
||||
"Release",
|
||||
))
|
||||
}
|
||||
|
||||
fun Project.isNightlyBuild(): Boolean {
|
||||
return gradle.startParameter.taskNames.contains("Nightly")
|
||||
}
|
||||
|
||||
fun Project.getSigningProperties() : Properties {
|
||||
return Properties().apply {
|
||||
|
@ -80,10 +70,6 @@ fun Project.getSigningProperty(property: String) : String {
|
|||
)
|
||||
}
|
||||
|
||||
fun Project.signingConfigName() : String {
|
||||
return if(getSigningProperty(Constants.KEY_PASS_VAR).isBlank()) Constants.DEBUG else Constants.RELEASE
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue