blob: 31fb40565ca29ceec738599ef1ddacbe5e7eb4e5 [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
Xavier Ducrohet9dc44802014-03-20 14:15:16 -070041 into 'm2repository'
42 baseName = "android-m2repository-${project.ext.supportVersion}"
Xavier Ducrohet020e4322014-03-18 16:41:30 -070043}
44
45// prepare repo.
46task prepareRepo(type: Copy) {
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080047 from "$rootDir/../../prebuilts/maven_repo/android"
Xavier Ducrohet855a9222014-01-02 19:00:43 -080048 into project.ext.supportRepoOut
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080049}
50
Xavier Ducrohet020e4322014-03-18 16:41:30 -070051prepareRepo.doFirst {
52 project.ext.supportRepoOut.deleteDir()
53 project.ext.supportRepoOut.mkdirs()
54}
55
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080056subprojects {
57 // Change buildDir first so that all plugins pick up the new value.
Xavier Ducrohet616b95d2014-02-12 09:09:43 -080058 project.buildDir = project.file("$project.parent.buildDir/../$project.name/build")
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080059
60 apply plugin: 'maven'
61
Xavier Ducrohet855a9222014-01-02 19:00:43 -080062 version = rootProject.ext.supportVersion
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080063 group = 'com.android.support'
64
65 task release(type: Upload) {
66 configuration = configurations.archives
67 repositories {
68 mavenDeployer {
Xavier Ducrohet855a9222014-01-02 19:00:43 -080069 repository(url: uri("$rootProject.ext.supportRepoOut"))
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080070 }
71 }
72 }
Xavier Ducrohet020e4322014-03-18 16:41:30 -070073
74 release.dependsOn rootProject.tasks.prepareRepo
75 mainUpload.dependsOn release
Xavier Ducrohet86fb8ef2013-02-22 15:04:37 -080076}
77
78FileCollection getAndroidPrebuilt(String apiLevel) {
79 files("$rootDir/../../prebuilts/sdk/$apiLevel/android.jar")
80}
Xavier Ducrohet855a9222014-01-02 19:00:43 -080081