From 5cf9fe7c0af588670265a5804dfae9ab8bb5c391 Mon Sep 17 00:00:00 2001 From: Ben Gruver Date: Sat, 15 Sep 2012 19:16:16 -0700 Subject: [PATCH] Generate fat jars for smali and baksmali --- baksmali/build.gradle | 15 ++++++++++++++- build.gradle | 13 +++++++++++-- smali/build.gradle | 15 ++++++++++++++- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/baksmali/build.gradle b/baksmali/build.gradle index 068da898..99858e6f 100644 --- a/baksmali/build.gradle +++ b/baksmali/build.gradle @@ -6,4 +6,17 @@ dependencies { } processResources.inputs.properties('version': { -> version}) -processResources.expand('version': { -> version}) \ No newline at end of file +processResources.expand('version': { -> version}) + +// We have to do this in taskGraph.whenReady, so that we use the correct +// version to resolve the project dependencies +gradle.taskGraph.whenReady { + // build a jar containing all dependencies + jar { + from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } + + manifest { + attributes("Main-Class": "org.jf.baksmali.main") + } + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2e51d46f..801014e5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,8 @@ subprojects { apply plugin: 'java' - version = "1.3.4" + ext.baseVersion = '1.3.4' + ext.jarVersion = baseVersion // For non-release builds, we want to append the commit and // dirty status to the version @@ -22,7 +23,15 @@ subprojects { versionSuffix = 'dev' } - version += '-' + versionSuffix + version = baseVersion + '-' + versionSuffix + + // use -dev for the jar name, rather than the + // full commit+dirty string + jarVersion = baseVersion + '-dev' + } + + jar { + version = jarVersion } } diff --git a/smali/build.gradle b/smali/build.gradle index 910fc3db..257c2703 100644 --- a/smali/build.gradle +++ b/smali/build.gradle @@ -79,4 +79,17 @@ compileJava.dependsOn generateAntlrSource, generateJflexSource compileTestJava.dependsOn generateTestAntlrSource processResources.inputs.properties('version': { -> version}) -processResources.expand('version': { -> version}) \ No newline at end of file +processResources.expand('version': { -> version}) + +// We have to do this in taskGraph.whenReady, so that we use the correct +// version to resolve the project dependencies +gradle.taskGraph.whenReady { + // build a jar containing all dependencies + jar { + from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } + + manifest { + attributes("Main-Class": "org.jf.smali.main") + } + } +}