Skip to content

Commit

Permalink
Write the generated version out to a file for use in other build steps
Browse files Browse the repository at this point in the history
  • Loading branch information
alanwoolley committed Aug 5, 2023
1 parent 7c17f60 commit cc5acf9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions build.gradle
Expand Up @@ -142,6 +142,13 @@ android {
}
}


task saveVersion {
new File(projectDir, "version.txt").text = project.ext.buildVersion
}

preBuild.dependsOn(saveVersion)

// Create ZIP of CorsixTH game assets
task createGameZip(type: Zip) {

Expand Down
4 changes: 2 additions & 2 deletions versioning.gradle
@@ -1,6 +1,6 @@
ext {
buildVersionCode = Integer.parseInt(System.getenv("BUILD_NUMBER") ?: "999999")
offsetBuildVersionCode = 100000000 + buildVersionCode
isSnapshot = Boolean.parseBoolean(System.getenv("IS_SNAPSHOT") ?: "false")
buildVersion = "1.0.0." + buildVersionCode.toString() + (isSnapshot ? "-SNAPSHOT" : "")
isSnapshot = Boolean.parseBoolean(System.getenv("IS_SNAPSHOT") ?: "false") || (System.getenv("BUILD_NUMBER") == null)
buildVersion = "1.0.0" + (isSnapshot ? "-SNAPSHOT" : ("." + buildVersionCode.toString()))
}

0 comments on commit cc5acf9

Please sign in to comment.