blob: e6e78f9734f57565ee8f3aeb1aeb4e5138b01dda [file] [log] [blame]
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -08001buildscript {
2 repositories {
3 maven { url '../../prebuilts/gradle-plugin' }
4 maven { url '../../prebuilts/tools/common/m2/repository' }
5 maven { url '../../prebuilts/tools/common/m2/internal' }
6 }
7 dependencies {
Xavier Ducrohet020e4322014-03-18 16:41:30 -07008 classpath 'com.android.tools.build:gradle:0.9.+'
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -08009 }
10}
11
Xavier Ducrohet020e4322014-03-18 16:41:30 -070012ext.supportVersion = '19.1.0'
13ext.supportRepoOut = ''
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080014
Xavier Ducrohet020e4322014-03-18 16:41:30 -070015/*
16 * With the build server you are given two env variables.
17 * The OUT_DIR is a temporary directory you can use to put things during the build.
18 * The DIST_DIR is where you want to save things from the build.
19 *
20 * The build server will copy the contents of DIST_DIR to somewhere and make it available.
21 */
22if (System.env.DIST_DIR != null && System.env.OUT_DIR != null) {
23 buildDir = file(System.env.OUT_DIR + '/gradle/frameworks/support/build')
24 project.ext.distDir = file(System.env.DIST_DIR)
25} else {
26 buildDir = file('../../out/host/gradle/frameworks/support/build')
27 project.ext.distDir = file('../../out/dist')
28}
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080029
Xavier Ducrohet020e4322014-03-18 16:41:30 -070030ext.supportRepoOut = new File(buildDir, 'support_repo')
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080031
Xavier Ducrohet020e4322014-03-18 16:41:30 -070032// upload anchor for subprojects.
33task mainUpload() {
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080034
Xavier Ducrohet020e4322014-03-18 16:41:30 -070035}
36
37// main task for release
38task createArchive(type: Zip, dependsOn: mainUpload) {
39 from project.ext.supportRepoOut
40 destinationDir project.ext.distDir
41 baseName = "support-${project.ext.supportVersion}"
42}
43
44// prepare repo.
45task prepareRepo(type: Copy) {
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080046 from "$rootDir/../../prebuilts/maven_repo/android"
Xavier Ducrohet855a9222014-01-02 19:00:43 -080047 into project.ext.supportRepoOut
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080048}
49
Xavier Ducrohet020e4322014-03-18 16:41:30 -070050prepareRepo.doFirst {
51 project.ext.supportRepoOut.deleteDir()
52 project.ext.supportRepoOut.mkdirs()
53}
54
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080055subprojects {
56 // Change buildDir first so that all plugins pick up the new value.
Xavier Ducrohet616b95d2014-02-12 09:09:43 -080057 project.buildDir = project.file("$project.parent.buildDir/../$project.name/build")
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080058
59 apply plugin: 'maven'
60
Xavier Ducrohet855a9222014-01-02 19:00:43 -080061 version = rootProject.ext.supportVersion
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080062 group = 'com.android.support'
63
64 task release(type: Upload) {
65 configuration = configurations.archives
66 repositories {
67 mavenDeployer {
Xavier Ducrohet855a9222014-01-02 19:00:43 -080068 repository(url: uri("$rootProject.ext.supportRepoOut"))
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080069 }
70 }
71 }
Xavier Ducrohet020e4322014-03-18 16:41:30 -070072
73 release.dependsOn rootProject.tasks.prepareRepo
74 mainUpload.dependsOn release
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080075}
76
77FileCollection getAndroidPrebuilt(String apiLevel) {
78 files("$rootDir/../../prebuilts/sdk/$apiLevel/android.jar")
79}
Xavier Ducrohet855a9222014-01-02 19:00:43 -080080