Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 1 | buildscript { |
| 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 Ducrohet | 020e432 | 2014-03-18 16:41:30 -0700 | [diff] [blame] | 8 | classpath 'com.android.tools.build:gradle:0.9.+' |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 9 | } |
| 10 | } |
| 11 | |
Xavier Ducrohet | 020e432 | 2014-03-18 16:41:30 -0700 | [diff] [blame] | 12 | ext.supportVersion = '19.1.0' |
| 13 | ext.supportRepoOut = '' |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 14 | |
Xavier Ducrohet | 020e432 | 2014-03-18 16:41:30 -0700 | [diff] [blame] | 15 | /* |
| 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 | */ |
| 22 | if (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 Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 29 | |
Xavier Ducrohet | 020e432 | 2014-03-18 16:41:30 -0700 | [diff] [blame] | 30 | ext.supportRepoOut = new File(buildDir, 'support_repo') |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 31 | |
Xavier Ducrohet | 020e432 | 2014-03-18 16:41:30 -0700 | [diff] [blame] | 32 | // upload anchor for subprojects. |
| 33 | task mainUpload() { |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 34 | |
Xavier Ducrohet | 020e432 | 2014-03-18 16:41:30 -0700 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | // main task for release |
| 38 | task createArchive(type: Zip, dependsOn: mainUpload) { |
| 39 | from project.ext.supportRepoOut |
| 40 | destinationDir project.ext.distDir |
Xavier Ducrohet | 9dc4480 | 2014-03-20 14:15:16 -0700 | [diff] [blame] | 41 | into 'm2repository' |
| 42 | baseName = "android-m2repository-${project.ext.supportVersion}" |
Xavier Ducrohet | 020e432 | 2014-03-18 16:41:30 -0700 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | // prepare repo. |
| 46 | task prepareRepo(type: Copy) { |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 47 | from "$rootDir/../../prebuilts/maven_repo/android" |
Xavier Ducrohet | 855a922 | 2014-01-02 19:00:43 -0800 | [diff] [blame] | 48 | into project.ext.supportRepoOut |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 49 | } |
| 50 | |
Xavier Ducrohet | 020e432 | 2014-03-18 16:41:30 -0700 | [diff] [blame] | 51 | prepareRepo.doFirst { |
| 52 | project.ext.supportRepoOut.deleteDir() |
| 53 | project.ext.supportRepoOut.mkdirs() |
| 54 | } |
| 55 | |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 56 | subprojects { |
| 57 | // Change buildDir first so that all plugins pick up the new value. |
Xavier Ducrohet | 616b95d | 2014-02-12 09:09:43 -0800 | [diff] [blame] | 58 | project.buildDir = project.file("$project.parent.buildDir/../$project.name/build") |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 59 | |
| 60 | apply plugin: 'maven' |
| 61 | |
Xavier Ducrohet | 855a922 | 2014-01-02 19:00:43 -0800 | [diff] [blame] | 62 | version = rootProject.ext.supportVersion |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 63 | group = 'com.android.support' |
| 64 | |
| 65 | task release(type: Upload) { |
| 66 | configuration = configurations.archives |
| 67 | repositories { |
| 68 | mavenDeployer { |
Xavier Ducrohet | 855a922 | 2014-01-02 19:00:43 -0800 | [diff] [blame] | 69 | repository(url: uri("$rootProject.ext.supportRepoOut")) |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 70 | } |
| 71 | } |
| 72 | } |
Xavier Ducrohet | 020e432 | 2014-03-18 16:41:30 -0700 | [diff] [blame] | 73 | |
| 74 | release.dependsOn rootProject.tasks.prepareRepo |
| 75 | mainUpload.dependsOn release |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | FileCollection getAndroidPrebuilt(String apiLevel) { |
| 79 | files("$rootDir/../../prebuilts/sdk/$apiLevel/android.jar") |
| 80 | } |
Xavier Ducrohet | 855a922 | 2014-01-02 19:00:43 -0800 | [diff] [blame] | 81 | |