blob: c30a000f5640c5dc01c93f2092c08c83e7e876f2 [file] [log] [blame]
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.gradle.internal.os.OperatingSystem
buildscript {
repositories {
maven { url '../../prebuilts/gradle-plugin' }
maven { url '../../prebuilts/tools/common/m2/repository' }
maven { url '../../prebuilts/tools/common/m2/internal' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
}
}
apply from: 'version.gradle'
final String platform = OperatingSystem.current().isMacOsX() ? 'darwin' : 'linux'
System.setProperty('android.dir', "${rootDir}/../../")
final String fullSdkPath = "${rootDir}/../../prebuilts/fullsdk-${platform}"
if (file(fullSdkPath).exists()) {
gradle.ext.currentSdk = 26
ext.buildToolsVersion = '26.0.0'
project.ext.androidJar = files("${fullSdkPath}/platforms/android-${gradle.currentSdk}/android.jar")
System.setProperty('android.home', "${rootDir}/../../prebuilts/fullsdk-${platform}")
File props = file("local.properties")
props.write "sdk.dir=${fullSdkPath}"
} else {
gradle.ext.currentSdk = 'current'
ext.buildToolsVersion = '26.0.0'
project.ext.androidJar = files("${project.rootDir}/../../prebuilts/sdk/current/public/android.jar")
File props = file("local.properties")
props.write "android.dir=../../"
}
/*
* With the build server you are given two env variables.
* The OUT_DIR is a temporary directory you can use to put things during the build.
* The DIST_DIR is where you want to save things from the build.
*
* The build server will copy the contents of DIST_DIR to somewhere and make it available.
*/
if (System.env.DIST_DIR != null && System.env.OUT_DIR != null) {
buildDir = new File(System.env.OUT_DIR + '/gradle/frameworks/support/build').getCanonicalFile()
project.ext.distDir = new File(System.env.DIST_DIR).getCanonicalFile()
} else {
buildDir = file('../../out/host/gradle/frameworks/support/build')
project.ext.distDir = file('../../out/dist')
}
ext.supportRepoOut = new File(buildDir, 'support_repo')
// upload anchor for subprojects to upload their artifacts
// to the local repo.
task dist(type: Zip) {
group = BasePlugin.BUILD_GROUP
description 'Builds distribution artifacts.'
from project.ext.supportRepoOut
into 'm2repository'
destinationDir project.ext.distDir
baseName = String.format("top-of-tree-m2repository-%s", project.multidexVersion)
doLast {
logger.warn "Compressed maven artifacts to ${archivePath}"
}
}
subprojects {
// Change buildDir first so that all plugins pick up the new value.
project.buildDir = project.file("${project.parent.buildDir}/../${project.name}/build")
apply plugin: 'maven'
version = rootProject.multidexVersion
group = 'androidx.multidex'
dist.dependsOn project.tasks.uploadArchives
project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
project.android.buildToolsVersion = rootProject.buildToolsVersion
}
}
}