1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
buildscript {
dependencies {
classpath 'com.google.guava:guava:debian'
}
}
import com.google.common.collect.ImmutableMap
apply plugin: 'java'
apply plugin: 'jacoco'
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'
compile 'javax.xml.bind:jaxb-api:debian'
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'
}
compileJava {
options.compilerArgs << '--add-exports' << 'java.base/sun.security.pkcs=ALL-UNNAMED' << '--add-exports' << 'java.base/sun.security.x509=ALL-UNNAMED' << '--add-exports' << 'java.base/sun.security.util=ALL-UNNAMED'
}
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.1', 'build-tools;23.0.2', 'build-tools;23.0.1',
'build-tools;23.0.0', 'build-tools;22.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']
}
}
def offline_repo_files = ["extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha7",
"extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha7"]
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) {
print "Update $os $arch"
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.'
|