diff options
author | Ben Gruver <bgruv@google.com> | 2012-09-15 11:56:29 -0700 |
---|---|---|
committer | Ben Gruver <bgruv@google.com> | 2012-09-15 19:20:12 -0700 |
commit | 480c79aeeaf53d196965481e9cabc2d270f0d497 (patch) | |
tree | 582f2b06365639cef73ef73522b1f5b258b03be3 | |
parent | 1026c6c10c20eb351a0e1d7a2e8af6686ebbeca5 (diff) | |
download | smali-480c79aeeaf53d196965481e9cabc2d270f0d497.tar.gz |
gradleize smali project
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | settings.gradle | 2 | ||||
-rw-r--r-- | smali/.gitignore | 1 | ||||
-rw-r--r-- | smali/build.gradle | 78 | ||||
-rw-r--r-- | smali/pom.xml | 198 | ||||
-rw-r--r-- | smali/src/main/antlr3/smaliLexer.g (renamed from smali/src/main/antlr3/org/jf/smali/smaliLexer.g) | 0 | ||||
-rw-r--r-- | smali/src/main/antlr3/smaliParser.g (renamed from smali/src/main/antlr3/org/jf/smali/smaliParser.g) | 0 | ||||
-rw-r--r-- | smali/src/main/antlr3/smaliTreeWalker.g (renamed from smali/src/main/antlr3/org/jf/smali/smaliTreeWalker.g) | 0 |
8 files changed, 80 insertions, 201 deletions
@@ -1,7 +1,7 @@ /.gradle /baksmali/build /dexlib/build -/smali/target +/smali/build /util/build /maven-smali-plugin/target /smali-integration-tests/target diff --git a/settings.gradle b/settings.gradle index 695e3e6c..56639a8b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include 'util', 'dexlib', 'baksmali'
\ No newline at end of file +include 'util', 'dexlib', 'baksmali', 'smali'
\ No newline at end of file diff --git a/smali/.gitignore b/smali/.gitignore deleted file mode 100644 index ea8c4bf7..00000000 --- a/smali/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/smali/build.gradle b/smali/build.gradle new file mode 100644 index 00000000..1da62084 --- /dev/null +++ b/smali/build.gradle @@ -0,0 +1,78 @@ +configurations { + antlr3 + jflex +} + +ext.antlrSource = 'src/main/antlr3' +ext.antlrOutput = file(new File(buildDir, '/generated-sources/antlr3')) + +ext.jflexSource = "src/main/jflex" +ext.jflexOutput = file(new File(buildDir, '/generated-sources/jflex')) + +ext.testAntlrSource = 'src/test/antlr3' +ext.testAntlrOutput = file(new File(buildDir, '/generated-test-sources/antlr3')) + +sourceSets.main.java.srcDir antlrOutput +sourceSets.main.java.srcDir jflexOutput + +sourceSets.test.java.srcDir testAntlrOutput + +dependencies { + compile project(':util') + compile project(':dexlib') + compile 'org.antlr:antlr-runtime:3.2' + compile 'commons-cli:commons-cli:1.2' + + testCompile 'junit:junit:4.6' + + antlr3 'org.antlr:antlr:3.2' + jflex 'de.jflex:jflex:1.4.3' +} + +task generateAntlrSource { + inputs.dir file(antlrSource) + outputs.dir file(antlrOutput) + doLast { + mkdir(antlrOutput) + + def grammars = fileTree(antlrSource).include('**/*.g') + + ant.java(classname: 'org.antlr.Tool', classpath: configurations.antlr3.asPath, fork: true) { + arg(line: '-fo ' + antlrOutput + '/org/jf/smali') + arg(line: grammars.files.join(" ")) + } + } +} + +task generateTestAntlrSource { + inputs.dir file(testAntlrSource) + outputs.dir file(testAntlrOutput) + doLast { + mkdir(testAntlrOutput) + + def grammars = fileTree(testAntlrSource).include('**/*.g') + + ant.java(classname: 'org.antlr.Tool', classpath: configurations.antlr3.asPath, fork: true) { + arg(line: '-fo ' + testAntlrOutput + '/org/jf/smali') + arg(line: grammars.files.join(" ")) + } + } +} + +task generateJflexSource { + inputs.dir file(jflexSource) + outputs.dir file(jflexOutput) + doLast { + mkdir(jflexOutput) + + def grammars = fileTree(jflexSource).include('**/*.flex') + + ant.java(classname: 'JFlex.Main', classpath: configurations.jflex.asPath, fork: true) { + arg(line: '-d ' + jflexOutput + '/org/jf/smali') + arg(line: grammars.files.join(" ")) + } + } +} + +compileJava.dependsOn generateAntlrSource, generateJflexSource +compileTestJava.dependsOn generateTestAntlrSource diff --git a/smali/pom.xml b/smali/pom.xml deleted file mode 100644 index 030dfaa7..00000000 --- a/smali/pom.xml +++ /dev/null @@ -1,198 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.jf</groupId> - <artifactId>smali</artifactId> - <version>${aversion}</version> - <parent> - <groupId>org.jf</groupId> - <artifactId>smali-pom</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - <build> - <plugins> - <plugin> - <groupId>de.jflex</groupId> - <artifactId>maven-jflex-plugin</artifactId> - <version>1.4.3</version> - <executions> - <execution> - <goals> - <goal>generate</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.antlr</groupId> - <artifactId>antlr3-maven-plugin</artifactId> - <version>3.2</version> - <executions> - <execution> - <id>smaliLexer</id> - <goals> - <goal>antlr</goal> - </goals> - <configuration> - <includes> - <include>org/jf/smali/smaliLexer.g</include> - </includes> - </configuration> - </execution> - <execution> - <id>smaliParser</id> - <goals> - <goal>antlr</goal> - </goals> - <configuration> - <includes> - <include>org/jf/smali/smaliParser.g</include> - </includes> - </configuration> - </execution> - <execution> - <id>smaliTreeWalker</id> - <goals> - <goal>antlr</goal> - </goals> - <configuration> - <includes> - <include>org/jf/smali/smaliTreeWalker.g</include> - </includes> - </configuration> - </execution> - <execution> - <id>expectedTokensTestGrammar</id> - <phase>generate-test-sources</phase> - <goals> - <goal>antlr</goal> - </goals> - <configuration> - <sourceDirectory>src/test/antlr3</sourceDirectory> - <outputDirectory>target/generated-test-sources/antlr3</outputDirectory> - <includes> - <include>org/jf/smali/expectedTokensTestGrammar.g</include> - </includes> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptorRefs> - <descriptorRef>jar-with-dependencies</descriptorRef> - </descriptorRefs> - <archive> - <manifest> - <mainClass>org.jf.smali.main</mainClass> - </manifest> - </archive> - </configuration> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <version>1.2</version> - <executions> - <execution> - <id>add generated test sources</id> - <phase>generate-sources</phase> - <goals> - <goal>add-test-source</goal> - </goals> - <configuration> - <sources> - <source>target/generated-test-sources</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>com.github.wvengen</groupId> - <artifactId>proguard-maven-plugin</artifactId> - <version>2.0.5</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>proguard</goal> - </goals> - </execution> - </executions> - <configuration> - <proguardVersion>4.8</proguardVersion> - <obfuscate>false</obfuscate> - <includeDependency>false</includeDependency> - <injar>${project.build.finalName}-jar-with-dependencies.jar</injar> - <outjar>${project.build.finalName}-jar-with-dependencies-small.jar</outjar> - <outputDirectory>${project.build.directory}</outputDirectory> - <options> - <option>-dontoptimize</option> <!--optimization takes *forever* for smali--> - <option>-keep public class org.jf.smali.main { - public static void main(java.lang.String[]); - }</option> - <option>-keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); - }</option> - <option>-dontwarn junit.**</option> - <option>-dontnote junit.**</option> - <option>-dontwarn org.junit.**</option> - <option>-dontnote org.junit.**</option> - <option>-dontwarn com.google.common.base.**</option> - <option>-dontnote com.google.common.base.**</option> - </options> - <libs> - <lib>${java.home}/lib/rt.jar</lib> - </libs> - </configuration> - <dependencies> - <dependency> - <groupId>net.sf.proguard</groupId> - <artifactId>proguard-base</artifactId> - <version>4.8</version> - </dependency> - </dependencies> - </plugin> - </plugins> - <resources> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - </resource> - </resources> - </build> - <dependencies> - <dependency> - <groupId>org.antlr</groupId> - <artifactId>antlr-runtime</artifactId> - <version>3.2</version> - </dependency> - <dependency> - <groupId>org.jf</groupId> - <artifactId>dexlib</artifactId> - <version>${version}</version> - </dependency> - <dependency> - <groupId>org.jf</groupId> - <artifactId>util</artifactId> - <version>${version}</version> - </dependency> - <dependency> - <groupId>commons-cli</groupId> - <artifactId>commons-cli</artifactId> - <version>1.2</version> - </dependency> - </dependencies> -</project>
\ No newline at end of file diff --git a/smali/src/main/antlr3/org/jf/smali/smaliLexer.g b/smali/src/main/antlr3/smaliLexer.g index 872e1065..872e1065 100644 --- a/smali/src/main/antlr3/org/jf/smali/smaliLexer.g +++ b/smali/src/main/antlr3/smaliLexer.g diff --git a/smali/src/main/antlr3/org/jf/smali/smaliParser.g b/smali/src/main/antlr3/smaliParser.g index 3d272b0e..3d272b0e 100644 --- a/smali/src/main/antlr3/org/jf/smali/smaliParser.g +++ b/smali/src/main/antlr3/smaliParser.g diff --git a/smali/src/main/antlr3/org/jf/smali/smaliTreeWalker.g b/smali/src/main/antlr3/smaliTreeWalker.g index 22338594..22338594 100644 --- a/smali/src/main/antlr3/org/jf/smali/smaliTreeWalker.g +++ b/smali/src/main/antlr3/smaliTreeWalker.g |