blob: 3433878757cbf14b81de5612d1ecb46a1548a2c2 [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.
*/
def supportRoot = ext.supportRootFolder
if (supportRoot == null) {
throw new RuntimeException("variable supportRootFolder is not set. you must set it before" +
" including this script")
}
def checkoutRoot = "${ext.supportRootFolder}/../.."
ext.repos = new Properties()
ext.repos.checkoutRoot = checkoutRoot
ext.repos.prebuiltsRoot = "${checkoutRoot}/prebuilts"
/**
* Adds maven repositories to the given repository handler.
*/
def addMavenRepositories(RepositoryHandler handler) {
handler.maven {
url "${repos.prebuiltsRoot}/androidx/internal"
metadataSources {
mavenPom()
artifact()
}
content {
includeGroupByRegex "android.*"
includeGroupByRegex "com.android.support.*"
excludeGroupByRegex "androidx.databinding.*"
}
}
handler.ivy {
// TODO: maybe we can move this no-group ivy repo directly into prebuilts/androidx/external
// once https://youtrack.jetbrains.com/issue/KT-35049 gets resolved */
url "${repos.prebuiltsRoot}/androidx/external/no-group"
patternLayout {
artifact("[artifact]/[revision]/[artifact]-[revision].[ext]")
}
metadataSources {
it.artifact()
}
content {
includeGroup ""
}
}
def buildDokka = System.getenv("BUILD_DOKKA") != null
handler.maven {
url "${repos.prebuiltsRoot}/androidx/external"
metadataSources {
mavenPom()
artifact()
}
if (buildDokka) {
content {
excludeGroup "org.jetbrains.dokka"
}
}
}
if (buildDokka) {
handler.maven {
url "${repos.checkoutRoot}/external/dokka/build/dist-maven"
content {
includeGroup "org.jetbrains.dokka"
}
}
}
if (System.getenv("ALLOW_PUBLIC_REPOS") != null) {
handler.mavenCentral()
handler.jcenter()
handler.google()
handler.maven {
url "https://plugins.gradle.org/m2/"
}
handler.mavenLocal()
}
def androidPluginRepoOverride = System.getenv("GRADLE_PLUGIN_REPO")
if (androidPluginRepoOverride != null) {
handler.maven {
url androidPluginRepoOverride
}
handler.maven {
url "${repos.prebuiltsRoot}/tools/common/m2/repository"
}
}
}
ext.repos.addMavenRepositories = this.&addMavenRepositories