Don't assume dx is on-path. Rather, grab it from maven central

The version of dx in maven central seems to be fairly old, but it works
well enough for our purposes.

Conflicts:
	build.gradle
This commit is contained in:
Ben Gruver 2015-03-16 19:54:57 -07:00 committed by Connor Tumbleson
parent 58b7c27316
commit 757e1dac45
2 changed files with 17 additions and 12 deletions

View File

@ -31,6 +31,7 @@
configurations { configurations {
accessorTestGenerator accessorTestGenerator
dx
} }
dependencies { dependencies {
@ -41,6 +42,8 @@ dependencies {
testCompile depends.junit testCompile depends.junit
accessorTestGenerator project('accessorTestGenerator') accessorTestGenerator project('accessorTestGenerator')
dx depends.dx
} }
ext.testAccessorOutputDir = file("${buildDir}/generated-accessor-test-sources") ext.testAccessorOutputDir = file("${buildDir}/generated-accessor-test-sources")
@ -69,23 +72,12 @@ task generateAccessorTestSource(type: JavaExec) {
} }
compileTestJava.dependsOn generateAccessorTestSource compileTestJava.dependsOn generateAccessorTestSource
task generateAccessorTestDex(type: Exec, dependsOn: compileTestJava) { task generateAccessorTestDex(type: JavaExec, dependsOn: compileTestJava) {
def outputDex = file(new File(sourceSets.test.output.resourcesDir, 'accessorTest.dex')) def outputDex = file(new File(sourceSets.test.output.resourcesDir, 'accessorTest.dex'))
doFirst { doFirst {
file(outputDex.parent).mkdirs() file(outputDex.parent).mkdirs()
}
inputs.dir(project.sourceSets.test.output.classesDir)
outputs.file outputDex
workingDir project.sourceSets.test.output.classesDir
executable 'dx'
args '--dex'
args '--no-strict'
args "--output=${outputDex}"
doFirst {
// this has to be done in doFirst, so that the generated classes will be available. // this has to be done in doFirst, so that the generated classes will be available.
// otherwise, it the tree will be populated while the build is being configured, // otherwise, it the tree will be populated while the build is being configured,
// which is before the compileTestJava has run // which is before the compileTestJava has run
@ -95,6 +87,18 @@ task generateAccessorTestDex(type: Exec, dependsOn: compileTestJava) {
args file args file
} }
} }
inputs.dir(project.sourceSets.test.output.classesDir)
outputs.file outputDex
main 'com.android.dx.command.Main'
classpath = configurations.dx
workingDir project.sourceSets.test.output.classesDir
//executable 'dx'
args '--dex'
args '--no-strict'
args "--output=${outputDex}"
} }
test.dependsOn generateAccessorTestDex test.dependsOn generateAccessorTestDex

View File

@ -93,6 +93,7 @@ subprojects {
commons_cli: 'commons-cli:commons-cli:1.2', commons_cli: 'commons-cli:commons-cli:1.2',
commons_io: 'commons-io:commons-io:2.4', commons_io: 'commons-io:commons-io:2.4',
commons_lang: 'org.apache.commons:commons-lang3:3.1', commons_lang: 'org.apache.commons:commons-lang3:3.1',
dx: 'com.google.android.tools:dx:1.7',
findbugs: 'com.google.code.findbugs:jsr305:1.3.9', findbugs: 'com.google.code.findbugs:jsr305:1.3.9',
guava: 'com.google.guava:guava:14.0', guava: 'com.google.guava:guava:14.0',
jflex: 'de.jflex:jflex:1.4.3', jflex: 'de.jflex:jflex:1.4.3',