提交 c59b65e7 编写于 作者: S Skylot

build: add 'dist' task

上级 bd4c61d3
......@@ -3,7 +3,7 @@ jdk:
- oraclejdk7
- openjdk7
- openjdk6
script: gradle clean build samples
script: gradle clean build
notifications:
email:
- skylot@gmail.com
......@@ -16,7 +16,7 @@ Latest version available at
git clone https://github.com/skylot/jadx.git
cd jadx
./gradlew clean build
./gradlew dist
(on Windows, use `gradlew.bat` instead of `./gradlew`)
......@@ -37,13 +37,13 @@ Run **jadx** on itself:
```
jadx[-gui] [options] <input file> (.dex, .apk or .jar)
options:
-d, --output-dir - output directory
-j, --threads-count - processing threads count
-f, --fallback - make simple dump (using goto instead of 'if', 'for', etc)
--cfg - save methods control flow graph
--raw-cfg - save methods control flow graph (use raw instructions)
-v, --verbose - verbose output
-h, --help - print this help
-d, --output-dir - output directory
-j, --threads-count - processing threads count
-f, --fallback - make simple dump (using goto instead of 'if', 'for', etc)
--cfg - save methods control flow graph to dot file
--raw-cfg - save methods control flow graph (use raw instructions)
-v, --verbose - verbose output
-h, --help - print this help
Example:
jadx -d out classes.dex
```
......
......@@ -12,16 +12,17 @@ subprojects {
gradle.projectsEvaluated {
tasks.withType(Compile) {
options.compilerArgs << "-Xlint" << "-Xlint:unchecked" << "-Xlint:deprecation"
if (!"${it}".contains(":jadx-samples:")) {
options.compilerArgs << "-Xlint" << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
jar {
version = jadxVersion
}
manifest {
mainAttributes('jadx-version' : jadxVersion)
manifest {
mainAttributes('jadx-version' : jadxVersion)
}
}
dependencies {
......@@ -48,10 +49,16 @@ task pack(type: Zip, dependsOn: copyArtifacts) {
from copyArtifacts.destinationDir
}
task build(dependsOn: pack) {
task dist(dependsOn: pack) {
description = 'Build jadx distribution zip'
}
task samples(dependsOn: 'jadx-samples:samples') {
}
task build(dependsOn: [dist, samples]) {
}
task clean(type: Delete) {
delete buildDir
}
......@@ -59,4 +66,3 @@ task clean(type: Delete) {
task wrapper(type: Wrapper) {
gradleVersion = '1.8'
}
package jadx.core;
import jadx.core.utils.Utils;
public class Consts {
public static final String JADX_VERSION = Utils.getJadxVersion();
public static final String JADX_VERSION = Jadx.getVersion();
public static final boolean DEBUG = false;
......
......@@ -19,10 +19,15 @@ import jadx.core.dex.visitors.regions.ProcessVariables;
import jadx.core.dex.visitors.regions.RegionMakerVisitor;
import jadx.core.dex.visitors.typeresolver.FinishTypeResolver;
import jadx.core.dex.visitors.typeresolver.TypeResolver;
import jadx.core.utils.Utils;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.jar.Manifest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -73,4 +78,19 @@ public class Jadx {
passes.add(new CodeGen(args));
return passes;
}
public static String getVersion() {
try {
Enumeration<URL> resources = Utils.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
while (resources.hasMoreElements()) {
Manifest manifest = new Manifest(resources.nextElement().openStream());
String ver = manifest.getMainAttributes().getValue("jadx-version");
if (ver != null)
return ver;
}
} catch (IOException e) {
LOG.error("Can't get manifest file", e);
}
return "dev";
}
}
......@@ -3,14 +3,10 @@ package jadx.core.utils;
import jadx.core.utils.exceptions.JadxRuntimeException;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URL;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.jar.Manifest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -126,22 +122,6 @@ public class Utils {
return end;
}
public static String getJadxVersion() {
try {
Enumeration<URL> resources =
Utils.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
while (resources.hasMoreElements()) {
Manifest manifest = new Manifest(resources.nextElement().openStream());
String ver = manifest.getMainAttributes().getValue("jadx-version");
if (ver != null)
return ver;
}
} catch (IOException e) {
LOG.error("Can't get manifest file", e);
}
return "dev";
}
public static void makeDirsForFile(File file) {
File dir = file.getParentFile();
if (!dir.exists()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册