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.
This commit is contained in:
Eric House 2017-05-24 07:09:11 -07:00
parent 340a559eb7
commit d58c601bf3
2 changed files with 10 additions and 22 deletions

View file

@ -5,4 +5,4 @@ XWords4-gcm/
**.iml
local.properties
.idea
app/src/main/assets/build-info.txt

View file

@ -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)
}