1/*
2 * Copyright 2021 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
17pluginManagement {
18    repositories {
19        mavenCentral()
20        google {
21            content {
22                includeGroupByRegex("androidx.*")
23                includeGroupByRegex("com\\.android.*")
24                includeGroupByRegex("com\\.google.*")
25            }
26        }
27        gradlePluginPortal().content {
28            it.includeModule("org.jetbrains.kotlin.jvm", "org.jetbrains.kotlin.jvm.gradle.plugin")
29        }
30        maven {
31            url = "https://packages.jetbrains.team/maven/p/kt/dev"
32            content {
33                includeGroupByRegex("org\\.jetbrains\\.kotlin.*")
34            }
35        }
36    }
37}
38
39dependencyResolutionManagement {
40    repositories {
41        mavenCentral()
42        google {
43            content {
44                includeGroupByRegex("androidx.*")
45                includeGroupByRegex("com\\.android.*")
46                includeGroupByRegex("com\\.google.*")
47            }
48        }
49        gradlePluginPortal().content {
50            it.includeModule("com.gradle", "develocity-gradle-plugin")
51            it.includeModule("com.gradle", "common-custom-user-data-gradle-plugin")
52            it.includeModule("org.spdx", "spdx-gradle-plugin")
53            it.includeModule("com.gradleup.shadow",
54                    "com.gradleup.shadow.gradle.plugin")
55            it.includeModule("com.gradleup.shadow", "shadow-gradle-plugin")
56        }
57        maven {
58            url = "https://packages.jetbrains.team/maven/p/kt/dev"
59            content {
60                includeGroupByRegex("org\\.jetbrains\\.kotlin.*")
61            }
62        }
63    }
64}
65
66apply from: "shared/src/main/groovy/out-setup.groovy"
67getGradle().beforeProject { project ->
68    init.chooseBuildDirectory(
69            new File("${buildscript.sourceFile.parent}/../.."), rootProject.name, project
70    )
71}
72System.setProperty("ALLOW_PUBLIC_REPOS", "true")
73rootProject.name = "playground-plugin"
74includeBuild("../../buildSrc") {
75    // cannot use name buildSrc, it is reserved.
76    name = "supportBuildSrc"
77    dependencySubstitution {
78        substitute module('supportBuildSrc:public') using project(':public')
79        substitute module('supportBuildSrc:private') using project(':private')
80        substitute module('supportBuildSrc:plugins') using project(':plugins')
81    }
82}
83include(":shared")
84// Build cache configuration is duplicated here from the GradleEnterpriseConventionsPlugin,
85// so that when building the `playground-plugin` included build the same build cache settings will be used.
86// Without this, Gradle Enterprise erroneously reports a problem with 'buildSrc' build cache configuration.
87def isCI = System.getenv("CI") == "true"
88buildCache {
89    local {
90        // Aggressively clean up stale build cache entries on CI
91        if (isCI) {
92            removeUnusedEntriesAfterDays = 1
93        }
94    }
95    remote(HttpBuildCache) {
96        url = "https://ge.androidx.dev/cache/"
97        var buildCachePassword = System.getenv("GRADLE_BUILD_CACHE_PASSWORD")
98        if (isCI && buildCachePassword != null && !buildCachePassword.empty) {
99            push = true
100            credentials {
101                username = "ci"
102                password = buildCachePassword
103            }
104        } else {
105            push = false
106        }
107    }
108}
109