diff --git a/CHANGES b/CHANGES index ef039269..34d250dd 100644 --- a/CHANGES +++ b/CHANGES @@ -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 on decompile, but then throws warning on rebuild (issue #366)" diff --git a/build.gradle b/build.gradle index 7ba3fcfb..c4db61c4 100644 --- a/build.gradle +++ b/build.gradle @@ -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;