Use JavaExec instead of ant.java

This commit is contained in:
Ben Gruver 2012-09-15 23:17:12 -07:00
parent c9afead1a9
commit 9382ba8591
2 changed files with 25 additions and 33 deletions

View File

@ -34,12 +34,10 @@ gradle.taskGraph.whenReady {
} }
processResources.inputs.properties('version': { -> version}) processResources.inputs.properties('version': { -> version})
processResources.expand('version': { -> version}) processResources.expand('version': { -> version})
} }
task proguard(type: JavaExec, dependsOn: jar) { task proguard(type: JavaExec, dependsOn: jar) {
setStandardOutput(java.lang.System.out);
setErrorOutput(java.lang.System.err);
classpath = files(configurations.proguard.asPath) classpath = files(configurations.proguard.asPath)
main = 'proguard.ProGuard' main = 'proguard.ProGuard'
args '-libraryjars ' + System.properties['java.home'] + '/lib/rt.jar' args '-libraryjars ' + System.properties['java.home'] + '/lib/rt.jar'

View File

@ -31,51 +31,47 @@ dependencies {
proguard 'net.sf.proguard:proguard-base:4.8' proguard 'net.sf.proguard:proguard-base:4.8'
} }
task generateAntlrSource { task generateAntlrSource(type: JavaExec) {
inputs.dir file(antlrSource) inputs.dir file(antlrSource)
outputs.dir file(antlrOutput) outputs.dir file(antlrOutput)
doLast {
mkdir(antlrOutput)
def grammars = fileTree(antlrSource).include('**/*.g') mkdir(antlrOutput)
def grammars = fileTree(antlrSource).include('**/*.g')
ant.java(classname: 'org.antlr.Tool', classpath: configurations.antlr3.asPath, fork: true) { classpath = files(configurations.antlr3.asPath)
arg(line: '-fo ' + antlrOutput + '/org/jf/smali') main = 'org.antlr.Tool'
arg(line: grammars.files.join(" ")) args '-fo', relativePath(new File(antlrOutput, 'org/jf/smali'))
} args grammars.files
}
} }
task generateTestAntlrSource { task generateTestAntlrSource(type: JavaExec) {
inputs.dir file(testAntlrSource) inputs.dir file(testAntlrSource)
outputs.dir file(testAntlrOutput) outputs.dir file(testAntlrOutput)
doLast {
mkdir(testAntlrOutput)
def grammars = fileTree(testAntlrSource).include('**/*.g') mkdir(testAntlrOutput)
def grammars = fileTree(testAntlrSource).include('**/*.g')
ant.java(classname: 'org.antlr.Tool', classpath: configurations.antlr3.asPath, fork: true) { classpath = files(configurations.antlr3.asPath)
arg(line: '-fo ' + testAntlrOutput + '/org/jf/smali') main = 'org.antlr.Tool'
arg(line: grammars.files.join(" ")) args '-fo', relativePath(new File(testAntlrOutput, 'org/jf/smali'))
} args grammars.files.join(' ')
}
} }
task generateJflexSource { task generateJflexSource(type: JavaExec) {
inputs.dir file(jflexSource) inputs.dir file(jflexSource)
outputs.dir file(jflexOutput) outputs.dir file(jflexOutput)
doLast {
mkdir(jflexOutput)
def grammars = fileTree(jflexSource).include('**/*.flex') mkdir(jflexOutput)
def grammars = fileTree(jflexSource).include('**/*.flex')
ant.java(classname: 'JFlex.Main', classpath: configurations.jflex.asPath, fork: true) { classpath = files(configurations.jflex.asPath)
arg(line: '-d ' + jflexOutput + '/org/jf/smali') main = 'JFlex.Main'
arg(line: grammars.files.join(" ")) args '-q'
} args '-d', relativePath(new File(jflexOutput, 'org/jf/smali'))
} args grammars.files.join(' ')
} }
compileJava.dependsOn generateAntlrSource, generateJflexSource compileJava.dependsOn generateAntlrSource, generateJflexSource
compileTestJava.dependsOn generateTestAntlrSource compileTestJava.dependsOn generateTestAntlrSource
@ -92,7 +88,7 @@ gradle.taskGraph.whenReady {
} }
processResources.inputs.properties('version': version) processResources.inputs.properties('version': version)
processResources.expand('version': version) processResources.expand('version': version)
proguard { proguard {
def outFile = relativePath(buildDir) + '/libs/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension def outFile = relativePath(buildDir) + '/libs/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension
@ -106,8 +102,6 @@ gradle.taskGraph.whenReady {
} }
task proguard(type: JavaExec, dependsOn: jar) { task proguard(type: JavaExec, dependsOn: jar) {
setStandardOutput(java.lang.System.out);
setErrorOutput(java.lang.System.err);
classpath = files(configurations.proguard.asPath) classpath = files(configurations.proguard.asPath)
main = 'proguard.ProGuard' main = 'proguard.ProGuard'
args '-libraryjars ' + System.properties['java.home'] + '/lib/rt.jar' args '-libraryjars ' + System.properties['java.home'] + '/lib/rt.jar'