dont crash out if no .git folder is present

This commit is contained in:
Connor Tumbleson 2013-01-10 14:19:57 -06:00
parent 708564ff22
commit 7fc70058dc
2 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,7 @@
v1.5.2 (TBA)
-Fixed (issue #299) - output smali filename errors to screen during rebuild instead of filestream
-Only show the --aapt / -a info in verbose mode.
-Fixed (issue #392) - Don't crash out if .git folder isn't present. Use SNAPSHOT-DEV instead.
v1.5.1 PR3 (Released December 23 - 2012) Codename: Pre Release 3
-Reverted "Prevents removal of <uses-sdk> on decompile, but then throws warning on rebuild (issue #366)"

View File

@ -29,6 +29,7 @@ task wrapper(type: Wrapper) {
}
// If anyone uses this outside of GoogleCode (Apktool) developers. I will hunt you down and hurt you.
// This is for official releases only.
task release {
}
@ -93,9 +94,14 @@ subprojects {
// kudos #smali - JesusFreke, for how to build release task
if (!('release' in gradle.startParameter.taskNames)) {
ant.loadfile(srcFile: "../../.git/refs/heads/master", property: fullrev)
gitrev_version = ant.properties[fullrev].substring(0,10);
println "Building SNAPSHOT: " + gitrev_version;
ant.loadfile(srcFile: "../../.git/refs/heads/master", property: fullrev, failonerror: false);
if (ant.properties[fullrev] == null) {
gitrev_version = "SNAPSHOT_DEV";
println "Building SNAPSHOT (no .git folder found)";
} else {
gitrev_version = ant.properties[fullrev].substring(0,10);
println "Building SNAPSHOT: " + gitrev_version;
}
} else {
gitrev_version = '';
println "Building RELEASE: " + apktoolversion;