blob: ae1b4c9b8fe9a2bca43c3c622bd48a9dcc02dbb9 [file] [log] [blame]
Aurimas Liutikas9ab3b4c32017-04-19 09:33:27 -07001/*
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
Aurimas Liutikas9ab3b4c32017-04-19 09:33:27 -070017def supportRoot = ext.supportRootFolder
18if (supportRoot == null) {
19 throw new RuntimeException("variable supportRootFolder is not set. you must set it before" +
20 " including this script")
21}
22
Aurimas Liutikasa2cbbfa2018-01-25 14:42:41 -080023apply from: "${supportRoot}/buildSrc/unbundled_check.gradle"
24
25def checkoutRoot = "${ext.supportRootFolder}/../.."
Aurimas Liutikas9ab3b4c32017-04-19 09:33:27 -070026ext.repos = new Properties()
27ext.repos.prebuiltsRoot = "${checkoutRoot}/prebuilts"
Aurimas Liutikas9ab3b4c32017-04-19 09:33:27 -070028
Aurimas Liutikas1e993772018-07-16 15:19:12 -070029ext.repoNames = ["${repos.prebuiltsRoot}/androidx/internal",
Jeff Gastona7fd9a32018-09-26 17:04:43 -040030 "${repos.prebuiltsRoot}/androidx/external",
31 "${checkoutRoot}/external/dokka/maven",]
Aurimas Liutikas9ab3b4c32017-04-19 09:33:27 -070032
33/**
34 * Adds maven repositories to the given repository handler.
35 */
36def addMavenRepositories(RepositoryHandler handler) {
37 repoNames.each { repo ->
38 handler.maven {
39 url repo
40 }
41 }
Aurimas Liutikasa2cbbfa2018-01-25 14:42:41 -080042 if (System.getenv("ALLOW_PUBLIC_REPOS") != null || (isUnbundledBuild(ext.supportRootFolder))) {
Aurimas Liutikas9ab3b4c32017-04-19 09:33:27 -070043 handler.mavenCentral()
44 handler.jcenter()
Aurimas Liutikasaa9688e2017-07-06 10:41:00 -070045 handler.google()
Aurimas Liutikasa2cbbfa2018-01-25 14:42:41 -080046 handler.maven {
47 url "https://plugins.gradle.org/m2/"
48 }
Aurimas Liutikas9ab3b4c32017-04-19 09:33:27 -070049 }
50 def androidPluginRepoOverride = System.getenv("GRADLE_PLUGIN_REPO")
51 if (androidPluginRepoOverride != null) {
52 handler.maven {
53 url androidPluginRepoOverride
54 }
55 }
56}
57
Aurimas Liutikasa2cbbfa2018-01-25 14:42:41 -080058ext.repos.addMavenRepositories = this.&addMavenRepositories