blob: c91cdd2ca36d93fa813f2a3661b602ca690533a4 [file] [log] [blame]
apply plugin: 'clone-artifacts'
// Currently, the minimum requirement to run Android SDK tools is Java 1.6
// So make sure that we are compiling with 1.6
def jvmVersion = System.getProperty('java.version')
if (!jvmVersion.startsWith('1.6')) {
throw new RuntimeException("Tools need to be compiled with Java 1.6, you are using Java $jvmVersion")
}
// artifact cloning destinations
cloneArtifacts {
repository = "$rootDir/../prebuilts/tools/common/m2/repository"
}
/*
* With the build server you are given two env variables.
* The OUT_DIR is a temporary directory you can use to put things during the build.
* The DIST_DIR is where you want to save things from the build.
*
* The build server will copy the contents of DIST_DIR to somewhere and make it available.
*/
if (System.env.DIST_DIR != null && System.env.OUT_DIR != null) {
ext.androidHostOut = file(System.env.OUT_DIR)
ext.androidHostDist = file(System.env.DIST_DIR)
} else {
// ext.androidHostOut is shared by all tools/{base,build,swt} gradle projects/
ext.androidHostOut = file("$rootDir/../out")
ext.androidHostDist = new File(ext.androidHostOut, "dist")
}
// rootProject.buildDir is specific to this gradle build.
buildDir = new File(ext.androidHostOut, "build/root")
// apply this after the buildDir has been changed.
apply plugin: 'sdk-tools'
ext.localRepo = project.hasProperty('localRepo') ? localRepo : "$ext.androidHostOut/repo"
apply from: "$rootDir/buildSrc/base/version.gradle"
subprojects { Project project ->
// Change buildDir first so that all plugins pick up the new value.
project.buildDir = project.file("$project.parent.buildDir/../$project.name/build")
}
// delay evaluation of this project before all subprojects have been evaluated.
subprojects.each { subproject -> evaluationDependsOn(subproject.path) }
def testTasks = subprojects.collect { it.tasks.withType(Test) }.flatten()
task aggregateResults(type: Copy) {
from { testTasks*.binResultsDir*.parentFile*.parentFile }
into { file("$buildDir/results") }
}
task prepareRepo(type: Copy) {
from { rootProject.cloneArtifacts.repository }
into { "$rootProject.ext.androidHostOut/repo" }
}
task copyGradleProperty(type: Copy) {
from { "${System.env.HOME}/.gradle/gradle.properties" }
into { gradle.gradleUserHomeDir }
}
tasks.create(name: 'publishLocal')
subprojects { project ->
if (project.tasks.findByName('publishLocal') != null) {
rootProject.publishLocal.dependsOn project.publishLocal
}
}
task setupGradleInIde << {
File dir = gradle.gradleHomeDir
String link = dir.path.substring(project.ext.androidHostOut.path.length() + 1)
String command = "ln -s $link ${new File(project.ext.androidHostOut, "gradle-dist-link").path}"
command.execute()
}
// The hierarchy viewer tests require loading SWT jar files.
// That fails with the error saying "can't load 32 bit library on 64 bit JVM
// Disable these tests from running until that is fixed
tasks.findByPath(':swt:hierarchyviewer2lib:test').enabled = false