Commit 1f21760b authored by Skylot's avatar Skylot

rename jadx-cli, update build scripts

parent 67eb55a9
...@@ -16,7 +16,7 @@ Latest version available at ...@@ -16,7 +16,7 @@ Latest version available at
git clone https://github.com/skylot/jadx.git git clone https://github.com/skylot/jadx.git
cd jadx cd jadx
./gradlew clean build pack ./gradlew clean build
(on Windows, use `gradlew.bat` instead of `./gradlew`) (on Windows, use `gradlew.bat` instead of `./gradlew`)
...@@ -28,15 +28,14 @@ and also packed to `build/jadx-<version>.zip` ...@@ -28,15 +28,14 @@ and also packed to `build/jadx-<version>.zip`
Run **jadx** on itself: Run **jadx** on itself:
cd build/jadx/ cd build/jadx/
bin/jadx-cli -d out lib/jadx-core-*.jar bin/jadx -d out lib/jadx-core-*.jar
or #or
bin/jadx-gui lib/jadx-core-*.jar bin/jadx-gui lib/jadx-core-*.jar
### Usage ### Usage
``` ```
jadx [options] <input files> (.dex, .apk or .jar) jadx[-gui] [options] <input file> (.dex, .apk or .jar)
options: options:
-d, --output-dir - output directory -d, --output-dir - output directory
-j, --threads-count - processing threads count -j, --threads-count - processing threads count
......
apply plugin: 'idea'
ext.jadxVersion = file('version').readLines().get(0) ext.jadxVersion = file('version').readLines().get(0)
subprojects { subprojects {
...@@ -17,7 +15,7 @@ subprojects { ...@@ -17,7 +15,7 @@ subprojects {
} }
manifest { manifest {
mainAttributes("jadx-version" : jadxVersion) mainAttributes('jadx-version' : jadxVersion)
} }
dependencies { dependencies {
...@@ -31,7 +29,7 @@ subprojects { ...@@ -31,7 +29,7 @@ subprojects {
} }
} }
task copyArtifacts (type: Sync, dependsOn: ["jadx-cli:installApp", "jadx-gui:installApp"]) { task copyArtifacts (type: Sync, dependsOn: ['jadx-cli:installApp', 'jadx-gui:installApp']) {
destinationDir file("$buildDir/jadx") destinationDir file("$buildDir/jadx")
['jadx-cli', 'jadx-gui'].each { ['jadx-cli', 'jadx-gui'].each {
from tasks.getByPath(":${it}:installApp").destinationDir from tasks.getByPath(":${it}:installApp").destinationDir
...@@ -44,6 +42,10 @@ task pack (type: Zip, dependsOn: copyArtifacts) { ...@@ -44,6 +42,10 @@ task pack (type: Zip, dependsOn: copyArtifacts) {
from copyArtifacts.destinationDir from copyArtifacts.destinationDir
} }
task build (dependsOn: pack) {
description = 'Build jadx distribution zip'
}
task clean(type: Delete) { task clean(type: Delete) {
delete buildDir delete buildDir
} }
......
apply plugin: 'application' apply plugin: 'application'
mainClassName = "jadx.cli.JadxCLI" mainClassName = 'jadx.cli.JadxCLI'
applicationName = 'jadx'
dependencies { dependencies {
compile(project(":jadx-core")) compile(project(':jadx-core'))
compile 'com.beust:jcommander:1.30' compile 'com.beust:jcommander:1.30'
} }
build.dependsOn distZip
build.dependsOn installApp
startScripts { startScripts {
doLast { doLast {
// increase default max heap size // increase default max heap size
......
...@@ -80,6 +80,7 @@ public class JadxArgs implements IJadxArgs { ...@@ -80,6 +80,7 @@ public class JadxArgs implements IJadxArgs {
processArgs(); processArgs();
} catch (JadxException e) { } catch (JadxException e) {
LOG.error(e.getMessage()); LOG.error(e.getMessage());
printUsage();
System.exit(1); System.exit(1);
} }
} }
...@@ -103,10 +104,13 @@ public class JadxArgs implements IJadxArgs { ...@@ -103,10 +104,13 @@ public class JadxArgs implements IJadxArgs {
if (input.isEmpty()) { if (input.isEmpty()) {
if (inputRequired) if (inputRequired)
throw new JadxException("Please specify at least one input file"); throw new JadxException("Please specify input file");
else else
return; return;
} }
if (input.size() > 1) {
throw new JadxException("Only one input file is supported");
}
if (outDirName == null) { if (outDirName == null) {
File file = new File(files.get(0)); File file = new File(files.get(0));
...@@ -129,6 +133,7 @@ public class JadxArgs implements IJadxArgs { ...@@ -129,6 +133,7 @@ public class JadxArgs implements IJadxArgs {
JCommander jc = new JCommander(this); JCommander jc = new JCommander(this);
// print usage in not sorted fields order (by default its sorted by description) // print usage in not sorted fields order (by default its sorted by description)
PrintStream out = System.out; PrintStream out = System.out;
out.println();
out.println("jadx - dex to java decompiler, version: " + Consts.JADX_VERSION); out.println("jadx - dex to java decompiler, version: " + Consts.JADX_VERSION);
out.println(); out.println();
out.println("usage: jadx [options] " + jc.getMainParameterDescription()); out.println("usage: jadx [options] " + jc.getMainParameterDescription());
......
...@@ -2,11 +2,7 @@ package jadx.cli; ...@@ -2,11 +2,7 @@ package jadx.cli;
import jadx.api.Decompiler; import jadx.api.Decompiler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JadxCLI { public class JadxCLI {
private static final Logger LOG = LoggerFactory.getLogger(JadxCLI.class);
public static void main(String[] args) { public static void main(String[] args) {
JadxArgs jadxArgs = new JadxArgs(args, true); JadxArgs jadxArgs = new JadxArgs(args, true);
......
...@@ -8,9 +8,6 @@ dependencies { ...@@ -8,9 +8,6 @@ dependencies {
compile 'com.fifesoft:rsyntaxtextarea:2.0.7' compile 'com.fifesoft:rsyntaxtextarea:2.0.7'
} }
build.dependsOn distZip
build.dependsOn installApp
startScripts { startScripts {
doLast { doLast {
// increase default max heap size // increase default max heap size
......
...@@ -4,7 +4,6 @@ import javax.swing.Icon; ...@@ -4,7 +4,6 @@ import javax.swing.Icon;
import java.awt.Component; import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
public class OverlayIcon implements Icon { public class OverlayIcon implements Icon {
...@@ -48,10 +47,6 @@ public class OverlayIcon implements Icon { ...@@ -48,10 +47,6 @@ public class OverlayIcon implements Icon {
icons.add(icon); icons.add(icon);
} }
public void addAll(Collection<Icon> icons) {
icons.addAll(icons);
}
public List<Icon> getIcons() { public List<Icon> getIcons() {
return icons; return icons;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment