Skip to content

Commit

Permalink
Allow versionCode customization through local properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhilkinSerg committed Nov 1, 2023
1 parent c1e506d commit 3d6a0eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ if (localProperties.getProperty('override_ndkVersion') != null) {
override_ndkVersion = localProperties.getProperty('override_ndkVersion')
}

def override_versionCode = getProperty("override_versionCode")
if (localProperties.getProperty('override_versionCode') != null) {
override_versionCode = localProperties.getProperty('override_versionCode')
} else {
override_versionCode=Integer.valueOf(System.env.UPSTREAM_BUILD_NUMBER ?: 1)
}

println("Using [ njobs]: $njobs")
println("Using [ localize]: $localize")
println("Using [ deps]: $deps")
Expand All @@ -114,6 +121,7 @@ println("Using [ minSdkVersion]: $override_minSdkVersion")
println("Using [ targetSdkVersion]: $override_targetSdkVersion")
println("Using [ndkBuildAppPlatform]: $override_ndkBuildAppPlatform")
println("Using [ ndkVersion]: $override_ndkVersion")
println("Using [ versionCode]: $override_versionCode")
println("Using [ abi_arm_32]: $abi_arm_32")
println("Using [ abi_arm_64]: $abi_arm_64")
println("Using [ abi_x86_32]: $abi_x86_32")
Expand Down Expand Up @@ -245,7 +253,7 @@ android {
defaultConfig {
minSdkVersion override_minSdkVersion
targetSdkVersion override_targetSdkVersion
versionCode Integer.valueOf(System.env.UPSTREAM_BUILD_NUMBER ?: 1)
versionCode Integer.valueOf(override_versionCode)
versionName new File("$version_header_path").text.split('\"')[1]
if (buildAsApplication) {
applicationId "com.cleverraven.cataclysmdda"
Expand Down
4 changes: 4 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@ override_ndkBuildAppPlatform=android-21
# This property controls which ndkVersion should be used
# You can override this from the command line by passing "-Poverride_ndkVersion=#"
override_ndkVersion=25.2.9519653

# This property controls which versionCode should be used
# You can override this from the command line by passing "-Poverride_versionCode=#"
override_versionCode=1

0 comments on commit 3d6a0eb

Please sign in to comment.