diff --git a/xwords4/android/.gitignore b/xwords4/android/.gitignore index 717c4d20d..40ab85a30 100644 --- a/xwords4/android/.gitignore +++ b/xwords4/android/.gitignore @@ -5,4 +5,4 @@ XWords4-gcm/ **.iml local.properties .idea - +app/src/main/assets/build-info.txt diff --git a/xwords4/android/app/build.gradle b/xwords4/android/app/build.gradle index 12f4adce8..d4f11e336 100644 --- a/xwords4/android/app/build.gradle +++ b/xwords4/android/app/build.gradle @@ -232,25 +232,13 @@ task cleanNDK(type: Exec) { commandLine lst } -// def getVersionName() { -// try { -// def stdout = new ByteArrayOutputStream() -// exec { -// commandLine 'git', 'describe', '--dirty' -// standardOutput = stdout -// } -// return stdout.toString().trim() -// } -// catch (ignored) { -// return null; -// } -// } +task makeBuildAssets() { + def assetsDir = android.sourceSets.main.assets.srcDirs.toArray()[0] + String path = new File(assetsDir, 'build-info.txt').getAbsolutePath() + File file = new File(path); + file.write("git: ${GITREV}\n"); +} -// def renameArtifact(variant) { -// variant.outputs.each { output -> -// def name = String.format( "XWords4-%s-%s.apk", variant.name, -// getVersionName() ) -// output.outputFile = new File( (String)output.outputFile.parent, -// (String)name ) -// } -// } +gradle.projectsEvaluated { + build.dependsOn(makeBuildAssets) +}