diff --git a/brut.apktool/apktool-cli/build.gradle b/brut.apktool/apktool-cli/build.gradle index 20dbd91d..9cd987ad 100644 --- a/brut.apktool/apktool-cli/build.gradle +++ b/brut.apktool/apktool-cli/build.gradle @@ -13,6 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import proguard.gradle.ProGuardTask + apply plugin: 'com.github.johnrengelman.shadow' dependencies { @@ -43,7 +45,7 @@ task cleanOutputDirectory(type: Delete) { delete fileTree(dir: jar.getDestinationDirectory().getAsFile(), exclude: "apktool-cli-all.jar") } -task proguard(type: proguard.gradle.ProGuardTask, dependsOn: shadowJar) { +task proguard(type: ProGuardTask, dependsOn: shadowJar) { injars shadowJar.getArchiveFile() // Java 9 and prior uses merged package for runtime, later uses split jmod files. diff --git a/build.gradle b/build.gradle index 5b5ec5d6..bc32facc 100644 --- a/build.gradle +++ b/build.gradle @@ -69,25 +69,25 @@ allprojects { } if (!('release' in gradle.startParameter.taskNames)) { - def hash = getCheckedOutGitCommitHash(); + def hash = getCheckedOutGitCommitHash() if (hash == null) { project.ext.set("hash", "dirty") project.ext.set("apktool_version", apktoolversion_major + "-dirty") - println "Building SNAPSHOT (no .git folder found)"; + println "Building SNAPSHOT (no .git folder found)" } else { - project.ext.set("hash", hash); - project.ext.set("apktool_version", apktoolversion_major + "-" + hash + "-SNAPSHOT"); - println "Building SNAPSHOT (" + getCheckedOutBranch() + "): " + hash; + project.ext.set("hash", hash) + project.ext.set("apktool_version", apktoolversion_major + "-" + hash + "-SNAPSHOT") + println "Building SNAPSHOT (" + getCheckedOutBranch() + "): " + hash } } else { project.ext.set("hash", "") if (apktoolversion_minor.length() > 0) { - project.ext.set("apktool_version", apktoolversion_major + "-" + apktoolversion_minor); + project.ext.set("apktool_version", apktoolversion_major + "-" + apktoolversion_minor) } else { - project.ext.set("apktool_version", apktoolversion_major); + project.ext.set("apktool_version", apktoolversion_major) } - println "Building RELEASE (" + getCheckedOutBranch() + "): " + project.ext.apktool_version; + println "Building RELEASE (" + getCheckedOutBranch() + "): " + project.ext.apktool_version } build.doFirst { @@ -99,7 +99,7 @@ build.doFirst { "We found a " + javaVersion + " JDK\n" + "Please update JAVA_HOME to use at least a 1.8 JDK\n" + "Currently it is set to: " + System.getProperty("java.home") - ); + ) } } diff --git a/gradle/functions.gradle b/gradle/functions.gradle index 00289a93..8c5a1d89 100644 --- a/gradle/functions.gradle +++ b/gradle/functions.gradle @@ -1,3 +1,5 @@ +import org.codehaus.groovy.runtime.MethodClosure + /** * Copyright 2014 Ryszard Wiśniewski * @@ -21,8 +23,8 @@ def getCheckedOutGitCommitHash() { def head try { head = new File(gitFolder + "HEAD").text.split(":") - } catch(Exception e) { - return null; + } catch(Exception ignored) { + return null } def isCommit = head.length == 1 @@ -38,13 +40,13 @@ def getCheckedOutBranch() { def head try { head = new File(gitFolder + "HEAD").text.split("/") - return head[2].trim(); - } catch(Exception e) { - return "SNAPSHOT"; + return head[2].trim() + } catch(Exception ignored) { + return "SNAPSHOT" } } ext { - getCheckedOutGitCommitHash = this.&getCheckedOutGitCommitHash - getCheckedOutBranch = this.&getCheckedOutBranch + getCheckedOutGitCommitHash = this.&getCheckedOutGitCommitHash as MethodClosure + getCheckedOutBranch = this.&getCheckedOutBranch as MethodClosure } \ No newline at end of file