1apply plugin: 'java'
2
3import com.android.internal.BuildUtils
4
5sourceSets {
6    main {
7        java {
8            srcDirs = ['src/']
9        }
10        resources {
11            srcDirs = ['res/']
12        }
13    }
14}
15
16// TODO put this function in a plugin
17// TODO remove when prebuilt's case will always properly work with BuildUtils's version.
18String findToolsJar() {
19    new ByteArrayOutputStream().withStream { os ->
20        project.exec {
21            executable "../../build/core/find-jdk-tools-jar.sh"
22
23            standardOutput = os
24        }
25        return os.toString().trim()
26    }
27}
28
29if (project.hasProperty("usePrebuilts") && project.usePrebuilts == "true") {
30    repositories {
31        maven { url '../../prebuilts/tools/common/m2/repository' }
32    }
33
34    // TODO refactor to allow referencing the "gradle way"
35    dependencies {
36        compile files(findToolsJar())
37        compile files('../../prebuilts/misc/common/antlr/antlr-3.4-complete.jar')
38        compile 'com.google.jsilver:jsilver:1.0.0'
39        // TODO add tagsoup to prebuils to fully support building using prebuilts
40        compile project(':tagsoup')
41        // required by jsilver
42        compile 'com.google.guava:guava:15.0'
43        //compile project(path: ':junit', configuration: 'target')
44    }
45} else {
46    dependencies {
47        compile files(BuildUtils.findToolsJar(project))
48        compile project(path: ':antlr', configuration: 'antlrRuntime')
49        compile project(':jsilver')
50        compile project(':tagsoup')
51    }
52}
53