blob: e35adf79c7929fef3ea8eec9e9c69e7f7379d45b [file] [log] [blame]
Alan Viverette05f668c2017-02-03 16:54:44 -05001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17import org.gradle.internal.os.OperatingSystem
18
Xavier Ducrohetb98bb462014-10-27 21:12:20 -070019buildscript {
20 repositories {
21 maven { url '../../prebuilts/gradle-plugin' }
22 maven { url '../../prebuilts/tools/common/m2/repository' }
23 maven { url '../../prebuilts/tools/common/m2/internal' }
24 }
25 dependencies {
Alan Viverette05f668c2017-02-03 16:54:44 -050026 classpath 'com.android.tools.build:gradle:2.3.0'
Xavier Ducrohetb98bb462014-10-27 21:12:20 -070027 }
28}
29
Alan Viverette05f668c2017-02-03 16:54:44 -050030apply from: 'version.gradle'
31
32final String platform = OperatingSystem.current().isMacOsX() ? 'darwin' : 'linux'
33System.setProperty('android.dir', "${rootDir}/../../")
34final String fullSdkPath = "${rootDir}/../../prebuilts/fullsdk-${platform}"
35if (file(fullSdkPath).exists()) {
36 gradle.ext.currentSdk = 26
37 ext.buildToolsVersion = '26.0.0'
38 project.ext.androidJar = files("${fullSdkPath}/platforms/android-${gradle.currentSdk}/android.jar")
39 System.setProperty('android.home', "${rootDir}/../../prebuilts/fullsdk-${platform}")
40 File props = file("local.properties")
41 props.write "sdk.dir=${fullSdkPath}"
42} else {
43 gradle.ext.currentSdk = 'current'
44 ext.buildToolsVersion = '26.0.0'
45 project.ext.androidJar = files("${project.rootDir}/../../prebuilts/sdk/current/android.jar")
46 File props = file("local.properties")
47 props.write "android.dir=../../"
48}
Xavier Ducrohetb98bb462014-10-27 21:12:20 -070049
50/*
51 * With the build server you are given two env variables.
52 * The OUT_DIR is a temporary directory you can use to put things during the build.
53 * The DIST_DIR is where you want to save things from the build.
54 *
55 * The build server will copy the contents of DIST_DIR to somewhere and make it available.
56 */
57if (System.env.DIST_DIR != null && System.env.OUT_DIR != null) {
58 buildDir = new File(System.env.OUT_DIR + '/gradle/frameworks/support/build').getCanonicalFile()
59 project.ext.distDir = new File(System.env.DIST_DIR).getCanonicalFile()
60} else {
61 buildDir = file('../../out/host/gradle/frameworks/support/build')
62 project.ext.distDir = file('../../out/dist')
63}
64
65ext.supportRepoOut = new File(buildDir, 'support_repo')
66
Xavier Ducrohetb98bb462014-10-27 21:12:20 -070067// upload anchor for subprojects to upload their artifacts
68// to the local repo.
Aurimas Liutikasfd97bb82017-04-28 11:38:10 -070069task dist(type: Zip) {
Alan Viverette05f668c2017-02-03 16:54:44 -050070 group = BasePlugin.BUILD_GROUP
71 description 'Builds distribution artifacts.'
Aurimas Liutikasfd97bb82017-04-28 11:38:10 -070072
73 from project.ext.supportRepoOut
74 into 'm2repository'
75 destinationDir project.ext.distDir
76 baseName = String.format("top-of-tree-m2repository-%s", project.multidexVersion)
77
78 doLast {
79 logger.warn "Compressed maven artifacts to ${archivePath}"
80 }
Xavier Ducrohetb98bb462014-10-27 21:12:20 -070081}
82
83subprojects {
84 // Change buildDir first so that all plugins pick up the new value.
Alan Viverette05f668c2017-02-03 16:54:44 -050085 project.buildDir = project.file("${project.parent.buildDir}/../${project.name}/build")
Xavier Ducrohetb98bb462014-10-27 21:12:20 -070086
87 apply plugin: 'maven'
88
Alan Viverette05f668c2017-02-03 16:54:44 -050089 version = rootProject.multidexVersion
Alan Viverette475db102018-03-08 15:27:11 -050090 group = 'androidx.multidex'
Xavier Ducrohetb98bb462014-10-27 21:12:20 -070091
Aurimas Liutikasa5272c32017-06-07 15:31:04 -070092 dist.dependsOn project.tasks.uploadArchives
Xavier Ducrohetb98bb462014-10-27 21:12:20 -070093
94 project.plugins.whenPluginAdded { plugin ->
95 if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
96 project.android.buildToolsVersion = rootProject.buildToolsVersion
97 }
98 }
99}