Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 1 | /* |
| 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 | */ |
Aurimas Liutikas | 526389b | 2018-02-27 14:01:24 -0800 | [diff] [blame] | 16 | |
Jake Wharton | 3c3f8f4 | 2018-07-17 22:40:28 -0400 | [diff] [blame] | 17 | import androidx.build.AndroidXPlugin |
Aurimas Liutikas | 55b44ec7 | 2018-07-27 16:29:35 -0700 | [diff] [blame^] | 18 | import androidx.build.SdkHelperKt |
Jake Wharton | 0af4777 | 2018-07-25 16:44:39 -0400 | [diff] [blame] | 19 | import androidx.build.jacoco.Jacoco |
Alan Viverette | cc5197e | 2016-06-13 12:45:07 -0400 | [diff] [blame] | 20 | |
Jeff Gaston | d79ef85 | 2018-01-09 17:53:15 -0500 | [diff] [blame] | 21 | def currentJvmVersion = org.gradle.api.JavaVersion.current() |
| 22 | if (currentJvmVersion.getMajorVersion() != "8") { |
| 23 | throw new Exception("Unsupported java version '" + currentJvmVersion.toString() + "'. Please install java 8.\n" + |
| 24 | "\n" + |
| 25 | "If you have already installed java 8, you can instruct Gradle to use it by setting the environment variable JAVA_HOME equal to its file path.") |
| 26 | } |
| 27 | |
| 28 | |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 29 | buildscript { |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 30 | ext.supportRootFolder = project.projectDir |
Aurimas Liutikas | 9ab3b4c3 | 2017-04-19 09:33:27 -0700 | [diff] [blame] | 31 | apply from: 'buildSrc/repos.gradle' |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 32 | apply from: 'buildSrc/init.gradle' |
Sergey Vasilinets | 6aa53ca | 2017-11-03 12:20:28 -0700 | [diff] [blame] | 33 | apply from: 'buildSrc/build_dependencies.gradle' |
Aurimas Liutikas | 9ab3b4c3 | 2017-04-19 09:33:27 -0700 | [diff] [blame] | 34 | repos.addMavenRepositories(repositories) |
Aurimas Liutikas | 55b44ec7 | 2018-07-27 16:29:35 -0700 | [diff] [blame^] | 35 | SdkHelperKt.setSdkInLocalPropertiesFile(ext.supportRootFolder) |
Aurimas Liutikas | 75b3d2e | 2017-03-15 10:34:55 -0700 | [diff] [blame] | 36 | |
| 37 | dependencies { |
Sergey Vasilinets | 6aa53ca | 2017-11-03 12:20:28 -0700 | [diff] [blame] | 38 | classpath build_libs.gradle |
Chris Craik | 1548629 | 2018-01-17 15:34:59 -0800 | [diff] [blame] | 39 | classpath build_libs.kotlin.gradle_plugin |
Jake Wharton | 0af4777 | 2018-07-25 16:44:39 -0400 | [diff] [blame] | 40 | |
| 41 | // AGP only declares a compileOnly dependency on Jacoco. This forces an explicit version. |
| 42 | classpath Jacoco.CORE_DEPENDENCY |
Aurimas Liutikas | 75b3d2e | 2017-03-15 10:34:55 -0700 | [diff] [blame] | 43 | } |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 44 | } |
Aurimas Liutikas | f09d858 | 2017-01-20 21:49:51 -0800 | [diff] [blame] | 45 | |
Aurimas Liutikas | 9ab3b4c3 | 2017-04-19 09:33:27 -0700 | [diff] [blame] | 46 | repos.addMavenRepositories(repositories) |
Alan Viverette | cc5197e | 2016-06-13 12:45:07 -0400 | [diff] [blame] | 47 | |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 48 | init.setupRepoOutAndBuildNumber() |
Alan Viverette | cc5197e | 2016-06-13 12:45:07 -0400 | [diff] [blame] | 49 | |
Yigit Boyar | 88c16ce | 2017-02-08 16:06:14 -0800 | [diff] [blame] | 50 | init.configureSubProjects() |
Alan Viverette | cc5197e | 2016-06-13 12:45:07 -0400 | [diff] [blame] | 51 | |
Jake Wharton | 3f00883 | 2018-07-19 17:30:31 -0400 | [diff] [blame] | 52 | init.configureBuildOnServer() |
Aurimas Liutikas | 38e8f4d9 | 2017-06-16 08:31:03 -0700 | [diff] [blame] | 53 | |
Jake Wharton | 3c3f8f4 | 2018-07-17 22:40:28 -0400 | [diff] [blame] | 54 | apply plugin: AndroidXPlugin |
Xavier Ducrohet | 86fb8ef | 2013-02-22 15:04:37 -0800 | [diff] [blame] | 55 | |
Jake Wharton | 3c3f8f4 | 2018-07-17 22:40:28 -0400 | [diff] [blame] | 56 | // AndroidX needed before jetify since it accesses the createArchive task name directly. |
Jeff Gaston | 5d480f8 | 2018-01-29 11:41:32 -0500 | [diff] [blame] | 57 | apply from: 'buildSrc/jetify.gradle' |
| 58 | |