From d58c601bf3bc27ca4522ace40634770f6390efe4 Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 24 May 2017 07:09:11 -0700 Subject: [PATCH] include git revision in assets/ dir (.gitignore it) Makes it easier to see what's been built into an apk if the file's name has changed. --- xwords4/android/.gitignore | 2 +- xwords4/android/app/build.gradle | 30 +++++++++--------------------- 2 files changed, 10 insertions(+), 22 deletions(-) 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) +}