diff options
author | Jeff Smith <whydoubt@yahoo.com> | 2014-02-16 22:29:04 -0600 |
---|---|---|
committer | Jeff Smith <whydoubt@yahoo.com> | 2014-02-16 22:29:04 -0600 |
commit | bfecccf1139e5ce927276bd343dbba50214c6617 (patch) | |
tree | 2e77b6085a91b1b3dff8d4b5946660165adb8b37 /baksmali | |
parent | 86c677ba8462e26883a276d1420574001de842d4 (diff) | |
parent | 2d8cbfe6bc2d8ff2fcd7a0bf432cc808d842da4a (diff) | |
download | smali-bfecccf1139e5ce927276bd343dbba50214c6617.tar.gz |
Merge remote-tracking branch 'upstream/master' into floating-point-values
Diffstat (limited to 'baksmali')
-rw-r--r-- | baksmali/build.gradle | 30 | ||||
-rw-r--r-- | baksmali/src/main/java/org/jf/baksmali/baksmali.java | 32 | ||||
-rw-r--r-- | baksmali/src/main/java/org/jf/baksmali/baksmaliOptions.java | 2 | ||||
-rw-r--r-- | baksmali/src/main/java/org/jf/baksmali/main.java | 5 |
4 files changed, 48 insertions, 21 deletions
diff --git a/baksmali/build.gradle b/baksmali/build.gradle index 7e5c1384..1f2e47c8 100644 --- a/baksmali/build.gradle +++ b/baksmali/build.gradle @@ -28,7 +28,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + configurations { proguard } @@ -47,8 +47,14 @@ dependencies { processResources.inputs.property('version', version) processResources.expand('version': version) -// build a jar containing all dependencies +// This is the jar that gets uploaded to maven jar { + baseName = 'maven' +} + +// Build a separate jar that contains all dependencies +task fatJar(type: Jar) { + from sourceSets.main.output from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } manifest { @@ -61,15 +67,27 @@ jar { } } } +tasks.getByPath('build').dependsOn(fatJar) + +uploadArchives { + repositories.mavenDeployer { + pom.project { + description 'baksmali is a disassembler for dalvik bytecode' + scm { + url 'https://github.com/JesusFreke/smali/tree/master/baksmali' + } + } + } +} -task proguard(type: JavaExec, dependsOn: jar) { - def outFile = jar.destinationDir.getPath() + '/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension - inputs.file jar.archivePath +task proguard(type: JavaExec, dependsOn: fatJar) { + def outFile = fatJar.destinationDir.getPath() + '/' + fatJar.baseName + '-' + fatJar.version + '-small' + '.' + fatJar.extension + inputs.file fatJar.archivePath outputs.file outFile classpath = configurations.proguard main = 'proguard.ProGuard' - args '-injars ' + jar.archivePath + args '-injars ' + fatJar.archivePath args '-outjars ' + outFile args '-libraryjars ' + System.properties['java.home'] + '/lib/rt.jar' args '-dontobfuscate' diff --git a/baksmali/src/main/java/org/jf/baksmali/baksmali.java b/baksmali/src/main/java/org/jf/baksmali/baksmali.java index dc49640f..056ff486 100644 --- a/baksmali/src/main/java/org/jf/baksmali/baksmali.java +++ b/baksmali/src/main/java/org/jf/baksmali/baksmali.java @@ -34,6 +34,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Ordering; import org.jf.baksmali.Adaptors.ClassDefinition; import org.jf.dexlib2.analysis.ClassPath; +import org.jf.dexlib2.analysis.CustomInlineMethodResolver; import org.jf.dexlib2.iface.ClassDef; import org.jf.dexlib2.iface.DexFile; import org.jf.dexlib2.util.SyntheticAccessorResolver; @@ -67,6 +68,11 @@ public class baksmali { options.classPath = ClassPath.fromClassPath(options.bootClassPathDirs, Iterables.concat(options.bootClassPathEntries, extraClassPathEntries), dexFile, options.apiLevel); + + if (options.customInlineDefinitions != null) { + options.inlineResolver = new CustomInlineMethodResolver(options.classPath, + options.customInlineDefinitions); + } } catch (Exception ex) { System.err.println("\n\nError occurred while loading boot class path files. Aborting."); ex.printStackTrace(System.err); @@ -147,22 +153,24 @@ public class baksmali { } boolean errorOccurred = false; - for (Future<Boolean> task: tasks) { - while(true) { - try { - if (!task.get()) { - errorOccurred = true; + try { + for (Future<Boolean> task: tasks) { + while(true) { + try { + if (!task.get()) { + errorOccurred = true; + } + } catch (InterruptedException ex) { + continue; + } catch (ExecutionException ex) { + throw new RuntimeException(ex); } - } catch (InterruptedException ex) { - continue; - } catch (ExecutionException ex) { - throw new RuntimeException(ex); + break; } - break; } + } finally { + executor.shutdown(); } - - executor.shutdown(); return !errorOccurred; } diff --git a/baksmali/src/main/java/org/jf/baksmali/baksmaliOptions.java b/baksmali/src/main/java/org/jf/baksmali/baksmaliOptions.java index 48a9146b..1e83c288 100644 --- a/baksmali/src/main/java/org/jf/baksmali/baksmaliOptions.java +++ b/baksmali/src/main/java/org/jf/baksmali/baksmaliOptions.java @@ -36,6 +36,7 @@ import org.jf.dexlib2.analysis.ClassPath; import org.jf.dexlib2.analysis.InlineMethodResolver; import org.jf.dexlib2.util.SyntheticAccessorResolver; +import java.io.File; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -71,6 +72,7 @@ public class baksmaliOptions { public boolean deodex = false; public boolean ignoreErrors = false; public boolean checkPackagePrivateAccess = false; + public File customInlineDefinitions = null; public InlineMethodResolver inlineResolver = null; public int registerInfo = 0; public ClassPath classPath = null; diff --git a/baksmali/src/main/java/org/jf/baksmali/main.java b/baksmali/src/main/java/org/jf/baksmali/main.java index db059f8c..274f1441 100644 --- a/baksmali/src/main/java/org/jf/baksmali/main.java +++ b/baksmali/src/main/java/org/jf/baksmali/main.java @@ -31,7 +31,6 @@ package org.jf.baksmali; import com.google.common.collect.Lists; import org.apache.commons.cli.*; import org.jf.dexlib2.DexFileFactory; -import org.jf.dexlib2.analysis.CustomInlineMethodResolver; import org.jf.dexlib2.analysis.InlineMethodResolver; import org.jf.dexlib2.dexbacked.DexBackedDexFile; import org.jf.dexlib2.dexbacked.DexBackedOdexFile; @@ -217,7 +216,7 @@ public class main { options.ignoreErrors = true; break; case 'T': - options.inlineResolver = new CustomInlineMethodResolver(options.classPath, new File(commandLine.getOptionValue("T"))); + options.customInlineDefinitions = new File(commandLine.getOptionValue("T")); break; default: assert false; @@ -270,7 +269,7 @@ public class main { } } - if (options.inlineResolver == null && dexFile instanceof DexBackedOdexFile) { + if (options.customInlineDefinitions == null && dexFile instanceof DexBackedOdexFile) { options.inlineResolver = InlineMethodResolver.createInlineMethodResolver(((DexBackedOdexFile)dexFile).getOdexVersion()); } |