1
0
Fork 0

AndroidManifest.xml versionCode is now automatically updated (required for pushing to F-droid)

This commit is contained in:
sspanak 2024-02-13 19:02:42 +02:00 committed by Dimo Karaivanov
parent a3e72283f8
commit d91740c222
2 changed files with 18 additions and 1 deletions

View file

@ -60,3 +60,12 @@ ext.getDebugVersion = { ->
ext.getReleaseVersion = { ->
return "${generateVersionName()} (${getCurrentGitHash()})"
}
ext.updateManifestVersion = { currentVersion ->
def manifestFile = file("src/main/AndroidManifest.xml")
def pattern = ~"versionCode=\"([^\"]+)\""
def matcher = pattern.matcher(manifestFile.getText())
matcher.find()
def newManifest = matcher.replaceAll("versionCode=\"" + (currentVersion + 1) + "\"")
manifestFile.write(newManifest)
}