blob: 4f9b6be5e63cf42b31234b8392f2b5f21d0fd1fc [file] [log] [blame]
import com.google.common.collect.ImmutableMap
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'sdk-java-lib'
evaluationDependsOn(':base:dvlib')
group = 'com.android.tools'
archivesBaseName = 'sdklib'
version = rootProject.ext.baseVersion
dependencies {
compile project(':base:layoutlib-api')
compile project(':base:dvlib')
compile project(':base:repository')
compile 'com.google.code.gson:gson:2.2.4'
compile 'org.apache.commons:commons-compress:1.8.1'
compile 'org.apache.httpcomponents:httpclient:4.1.1'
compile 'org.apache.httpcomponents:httpmime:4.1'
testCompile project(':base:dvlib').sourceSets.test.output
testCompile 'junit:junit:4.12'
}
test {
testLogging {
showStandardStreams = true
showStackTraces = true
exceptionFormat = "full"
}
}
sourceSets {
main.resources.srcDir 'src/main/java'
test.resources.srcDir 'src/test/java'
}
task initSdkForTests(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = "com.android.sdklib.tool.SdkDownloader"
if (project.hasProperty('downloaderArgs')) {
args(downloaderArgs.split(','))
} else {
def sdk_home = System.getenv("ANDROID_HOME")
if (sdk_home == null) {
throw new GradleException('Required ANDROID_HOME environment variable not set.')
}
args = [sdk_home, '--channel=3',
'tools', 'platform-tools', //'platform-tools-preview',
'build-tools;24.0.0', 'build-tools;23.0.2', 'build-tools;23.0.1',
'build-tools;23.0.0', 'build-tools;22.0.1', 'build-tools;21.1.2', 'build-tools;21.1.1',
'build-tools;21.1.0', 'build-tools;21.0.0', 'build-tools;20.0.0', 'build-tools;19.1.0',
'platforms;android-24', 'platforms;android-23', 'platforms;android-22',
'platforms;android-21', 'platforms;android-20', 'platforms;android-19',
'platforms;android-18', 'platforms;android-15',
'add-ons;addon-google_apis-google-21', 'add-ons;addon-google_apis-google-22',
'add-ons;addon-google_apis-google-23',
'extras;android;support', 'extras;google;m2repository', 'extras;android;m2repository',
'cmake;3.6']
}
}
def offline_repo_files = ["extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha4",
"extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha4"]
def offline_sdk_targets = [["macosx", "64", "darwin-x86_64"],
["macosx", "32", "darwin-x86"],
["windows", "64", "windows-x86_64"],
["windows", "32", "windows"],
["linux", "64", "linux-x86_64"],
["linux", "32", "linux-x86"]]
// Parent task to update the packages in prebuilts/tools/*/offline-sdk
// based on the values of offline_repo_files and offline_sdk_targets above.
task updateOfflineRepo {}
offline_sdk_targets.each { config ->
def os = config[0]
def arch = config[1]
def dest = "$rootDir/../prebuilts/tools/" + config[2] + "/offline-sdk"
task "updateOfflineRepo$os$arch"(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = "com.android.sdklib.tool.OfflineRepoCreator"
args = ["--dest", dest] + offline_repo_files
environment("REPO_OS_OVERRIDE", os)
systemProperties(ImmutableMap.of("os.arch", arch))
}
updateOfflineRepo.dependsOn "updateOfflineRepo$os$arch"
}
// TODO: needed?
task copyXsd(type: Copy) {
from sourceSets.main.resources.srcDirs
include '**/*.xsd'
into new File(rootProject.buildDir, "repository-xsd")
eachFile { details ->
details.path = details.name
}
}
// delete the destination folder first
copyXsd.doFirst {
File destFolder = file(rootProject.buildDir + "/repository-xsd")
destFolder.deleteDir()
destFolder.mkdirs()
}
// clean up after the copy task which creates empty folders.
copyXsd.doLast {
File destFolder = file(rootProject.buildDir + "/repository-xsd/com")
destFolder.deleteDir()
}
//packageJavaLib.dependsOn copyXsd
project.ext.pomName = 'Android Tools sdklib'
project.ext.pomDesc = 'A library to parse and download the Android SDK.'
apply from: "$rootDir/buildSrc/base/publish.gradle"
apply from: "$rootDir/buildSrc/base/bintray.gradle"
apply from: "$rootDir/buildSrc/base/javadoc.gradle"