Aurimas Liutikas | 9ab3b4c3 | 2017-04-19 09:33:27 -0700 | [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 | */ |
| 16 | |
Aurimas Liutikas | 9ab3b4c3 | 2017-04-19 09:33:27 -0700 | [diff] [blame] | 17 | def supportRoot = ext.supportRootFolder |
| 18 | if (supportRoot == null) { |
| 19 | throw new RuntimeException("variable supportRootFolder is not set. you must set it before" + |
| 20 | " including this script") |
| 21 | } |
| 22 | |
Aurimas Liutikas | a2cbbfa | 2018-01-25 14:42:41 -0800 | [diff] [blame] | 23 | apply from: "${supportRoot}/buildSrc/unbundled_check.gradle" |
| 24 | |
| 25 | def checkoutRoot = "${ext.supportRootFolder}/../.." |
Aurimas Liutikas | 9ab3b4c3 | 2017-04-19 09:33:27 -0700 | [diff] [blame] | 26 | ext.repos = new Properties() |
| 27 | ext.repos.prebuiltsRoot = "${checkoutRoot}/prebuilts" |
Aurimas Liutikas | 9ab3b4c3 | 2017-04-19 09:33:27 -0700 | [diff] [blame] | 28 | |
Aurimas Liutikas | 1e99377 | 2018-07-16 15:19:12 -0700 | [diff] [blame] | 29 | ext.repoNames = ["${repos.prebuiltsRoot}/androidx/internal", |
Jeff Gaston | a7fd9a3 | 2018-09-26 17:04:43 -0400 | [diff] [blame] | 30 | "${repos.prebuiltsRoot}/androidx/external", |
| 31 | "${checkoutRoot}/external/dokka/maven",] |
Aurimas Liutikas | 9ab3b4c3 | 2017-04-19 09:33:27 -0700 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * Adds maven repositories to the given repository handler. |
| 35 | */ |
| 36 | def addMavenRepositories(RepositoryHandler handler) { |
| 37 | repoNames.each { repo -> |
| 38 | handler.maven { |
| 39 | url repo |
Aurimas Liutikas | 34d5f4d | 2019-10-28 10:12:27 -0700 | [diff] [blame] | 40 | metadataSources { |
| 41 | mavenPom() |
| 42 | artifact() |
| 43 | } |
Aurimas Liutikas | 9ab3b4c3 | 2017-04-19 09:33:27 -0700 | [diff] [blame] | 44 | } |
| 45 | } |
Aurimas Liutikas | a2cbbfa | 2018-01-25 14:42:41 -0800 | [diff] [blame] | 46 | if (System.getenv("ALLOW_PUBLIC_REPOS") != null || (isUnbundledBuild(ext.supportRootFolder))) { |
Aurimas Liutikas | 9ab3b4c3 | 2017-04-19 09:33:27 -0700 | [diff] [blame] | 47 | handler.mavenCentral() |
| 48 | handler.jcenter() |
Aurimas Liutikas | aa9688e | 2017-07-06 10:41:00 -0700 | [diff] [blame] | 49 | handler.google() |
Aurimas Liutikas | a2cbbfa | 2018-01-25 14:42:41 -0800 | [diff] [blame] | 50 | handler.maven { |
| 51 | url "https://plugins.gradle.org/m2/" |
| 52 | } |
Aurimas Liutikas | 9ab3b4c3 | 2017-04-19 09:33:27 -0700 | [diff] [blame] | 53 | } |
| 54 | def androidPluginRepoOverride = System.getenv("GRADLE_PLUGIN_REPO") |
| 55 | if (androidPluginRepoOverride != null) { |
| 56 | handler.maven { |
| 57 | url androidPluginRepoOverride |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | |
Aurimas Liutikas | a2cbbfa | 2018-01-25 14:42:41 -0800 | [diff] [blame] | 62 | ext.repos.addMavenRepositories = this.&addMavenRepositories |