aboutsummaryrefslogtreecommitdiff
path: root/smali
diff options
context:
space:
mode:
authorBen Gruver <jesusfreke@jesusfreke.com>2015-03-01 20:31:10 -0800
committerBen Gruver <jesusfreke@jesusfreke.com>2015-03-01 20:31:10 -0800
commit57bd527d431e71ecf507e18d268d04e3f68c8085 (patch)
tree6dbe9813dc6c3e0df02880287c7e72f2fcd4c85e /smali
parent0f6f00a325cce70c1a396e3a97eb9be5aa1736f9 (diff)
downloadsmali-57bd527d431e71ecf507e18d268d04e3f68c8085.tar.gz
Use the antlr plugin for gradle
Diffstat (limited to 'smali')
-rw-r--r--smali/build.gradle71
-rw-r--r--smali/src/main/antlr/smaliParser.g (renamed from smali/src/main/antlr3/smaliParser.g)0
-rw-r--r--smali/src/main/antlr/smaliTreeWalker.g (renamed from smali/src/main/antlr3/smaliTreeWalker.g)0
-rw-r--r--smali/src/test/antlr/org/jf/smali/expectedTokensTestGrammar.g (renamed from smali/src/test/antlr3/org/jf/smali/expectedTokensTestGrammar.g)0
4 files changed, 14 insertions, 57 deletions
diff --git a/smali/build.gradle b/smali/build.gradle
index 92fb1db4..bcacaf73 100644
--- a/smali/build.gradle
+++ b/smali/build.gradle
@@ -29,12 +29,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+apply plugin: 'antlr'
apply plugin: 'jflex'
-configurations {
- antlr3
-}
-
buildscript {
repositories {
mavenCentral()
@@ -46,21 +43,15 @@ buildscript {
}
configurations {
+ // Remove the full antlr library that's added by the antlr plugin. We manually
+ // add the smaller antlr_runtime library instead
+ compile.exclude group: 'org.antlr', module: 'antlr'
+
// The jflex lexer doesn't have any runtime dependencies, so remove the dependency
// that gets added by the jflex plugin
compile.exclude group: 'de.jflex', module: 'jflex'
}
-ext.antlrSource = 'src/main/antlr3'
-ext.antlrOutput = file("${buildDir}/generated-sources/antlr3")
-
-ext.testAntlrSource = 'src/test/antlr3'
-ext.testAntlrOutput = file("${buildDir}/generated-test-sources/antlr3")
-
-sourceSets.main.java.srcDir antlrOutput
-
-sourceSets.test.java.srcDir testAntlrOutput
-
idea {
module {
excludeDirs -= buildDir
@@ -85,52 +76,10 @@ dependencies {
testCompile depends.junit
- antlr3 depends.antlr
+ antlr depends.antlr
jflex depends.jflex
}
-task generateParserAntlrSource(type: JavaExec) {
- inputs.dir file(antlrSource)
- outputs.dir file(antlrOutput)
-
- mkdir(antlrOutput)
- def grammars = fileTree(antlrSource).include('**/smaliParser.g')
-
- classpath = configurations.antlr3
- main = 'org.antlr.Tool'
- args '-fo', relativePath("${antlrOutput}/org/jf/smali")
- args grammars.files
-}
-
-task generateTreeWalkerAntlrSource(type: JavaExec) {
- inputs.dir file(antlrSource)
- outputs.dir file(antlrOutput)
-
- mkdir(antlrOutput)
- def grammars = fileTree(antlrSource).include('**/smaliTreeWalker.g')
-
- classpath = configurations.antlr3
- main = 'org.antlr.Tool'
- args '-fo', relativePath("${antlrOutput}/org/jf/smali")
- args grammars.files
-}
-
-task generateTestAntlrSource(type: JavaExec) {
- inputs.dir file(testAntlrSource)
- outputs.dir file(testAntlrOutput)
-
- mkdir(testAntlrOutput)
- def grammars = fileTree(testAntlrSource).include('**/*.g')
-
- classpath = configurations.antlr3
- main = 'org.antlr.Tool'
- args '-fo', relativePath("${testAntlrOutput}/org/jf/smali")
- args grammars.files.join(' ')
-}
-
-compileJava.dependsOn generateParserAntlrSource, generateTreeWalkerAntlrSource
-compileTestJava.dependsOn generateTestAntlrSource
-
processResources.inputs.property('version', version)
processResources.expand('version': version)
@@ -156,6 +105,14 @@ task fatJar(type: Jar, dependsOn: jar) {
}
tasks.getByPath('build').dependsOn(fatJar)
+generateTestGrammarSource {
+ outputDirectory = new File(outputDirectory, "org/jf/smali")
+}
+
+generateGrammarSource {
+ outputDirectory = new File(outputDirectory, "org/jf/smali")
+}
+
generateJFlexSource {
outputDirectory = new File(outputDirectory, "org/jf/smali")
}
diff --git a/smali/src/main/antlr3/smaliParser.g b/smali/src/main/antlr/smaliParser.g
index d057b4a4..d057b4a4 100644
--- a/smali/src/main/antlr3/smaliParser.g
+++ b/smali/src/main/antlr/smaliParser.g
diff --git a/smali/src/main/antlr3/smaliTreeWalker.g b/smali/src/main/antlr/smaliTreeWalker.g
index f49f10ef..f49f10ef 100644
--- a/smali/src/main/antlr3/smaliTreeWalker.g
+++ b/smali/src/main/antlr/smaliTreeWalker.g
diff --git a/smali/src/test/antlr3/org/jf/smali/expectedTokensTestGrammar.g b/smali/src/test/antlr/org/jf/smali/expectedTokensTestGrammar.g
index 6780b970..6780b970 100644
--- a/smali/src/test/antlr3/org/jf/smali/expectedTokensTestGrammar.g
+++ b/smali/src/test/antlr/org/jf/smali/expectedTokensTestGrammar.g