forked from slackhq/circuit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.gradle.kts
219 lines (189 loc) · 7.1 KB
/
settings.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
// Copyright (C) 2022 Slack Technologies, LLC
// SPDX-License-Identifier: Apache-2.0
import java.util.Locale
dependencyResolutionManagement {
versionCatalogs {
if (System.getenv("DEP_OVERRIDES") == "true") {
val overrides = System.getenv().filterKeys { it.startsWith("DEP_OVERRIDE_") }
maybeCreate("libs").apply {
for ((key, value) in overrides) {
val catalogKey = key.removePrefix("DEP_OVERRIDE_").lowercase(Locale.getDefault())
println("Overriding $catalogKey with $value")
version(catalogKey, value)
}
}
}
}
// Non-delegate APIs are annoyingly not public so we have to use withGroovyBuilder
fun hasProperty(key: String): Boolean {
return settings.withGroovyBuilder { "hasProperty"(key) as Boolean }
}
fun findProperty(key: String): String? {
return if (hasProperty(key)) {
settings.withGroovyBuilder { "getProperty"(key) as String }
} else {
null
}
}
repositories {
// Repos are declared roughly in order of likely to hit.
// Snapshots/local go first in order to pre-empty other repos that may contain unscrupulous
// snapshots.
if (hasProperty("circuit.config.enableSnapshots")) {
maven(findProperty("circuit.mavenUrls.snapshots.sonatype")!!) {
name = "snapshots-maven-central"
mavenContent { snapshotsOnly() }
}
maven(findProperty("circuit.mavenUrls.snapshots.sonatypes01")!!) {
name = "snapshots-maven-central-s01"
mavenContent { snapshotsOnly() }
}
maven(findProperty("circuit.mavenUrls.snapshots.androidx")!!) {
name = "snapshots-androidx"
mavenContent { snapshotsOnly() }
content { includeGroupByRegex("androidx.*") }
}
}
if (hasProperty("circuit.config.enableMavenLocal")) {
mavenLocal()
}
mavenCentral()
google()
// Kotlin dev repository, useful for testing against Kotlin dev builds.
// Usually only tested on CI shadow jobs
// https://kotlinlang.slack.com/archives/C0KLZSCHF/p1616514468003200?thread_ts=1616509748.001400&cid=C0KLZSCHF
maven(findProperty("circuit.mavenUrls.kotlinDev")!!) {
name = "Kotlin-Bootstrap"
content {
// this repository *only* contains Kotlin artifacts (don't try others here)
includeGroupByRegex("org\\.jetbrains.*")
}
}
exclusiveContent {
forRepository {
// For R8/D8 releases
maven("https://storage.googleapis.com/r8-releases/raw")
}
filter { includeModule("com.android.tools", "r8") }
}
// Pre-release artifacts of compose-compiler, used to test with future Kotlin versions
// https://androidx.dev/storage/compose-compiler/repository
maven("https://androidx.dev/storage/compose-compiler/repository/") {
name = "compose-compiler"
content {
// this repository *only* contains compose-compiler artifacts
includeGroup("androidx.compose.compiler")
}
}
// JB Compose Repo
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") { name = "Compose-JB" }
}
}
pluginManagement {
// Non-delegate APIs are annoyingly not public so we have to use withGroovyBuilder
fun hasProperty(key: String): Boolean {
return settings.withGroovyBuilder { "hasProperty"(key) as Boolean }
}
fun findProperty(key: String): String? {
return if (hasProperty(key)) {
settings.withGroovyBuilder { "getProperty"(key) as String }
} else {
null
}
}
repositories {
// Repos are declared roughly in order of likely to hit.
// Snapshots/local go first in order to pre-empty other repos that may contain unscrupulous
// snapshots.
if (hasProperty("circuit.config.enableSnapshots")) {
maven(findProperty("circuit.mavenUrls.snapshots.sonatype")!!) {
name = "snapshots-maven-central"
mavenContent { snapshotsOnly() }
}
maven(findProperty("circuit.mavenUrls.snapshots.sonatypes01")!!) {
name = "snapshots-maven-central-s01"
mavenContent { snapshotsOnly() }
}
maven(findProperty("circuit.mavenUrls.snapshots.androidx")!!) {
name = "snapshots-androidx"
mavenContent { snapshotsOnly() }
content { includeGroupByRegex("androidx.*") }
}
}
if (hasProperty("circuit.config.enableMavenLocal")) {
mavenLocal()
}
mavenCentral()
google()
// Kotlin dev repository, useful for testing against Kotlin dev builds.
// Usually only tested on CI shadow jobs
// https://kotlinlang.slack.com/archives/C0KLZSCHF/p1616514468003200?thread_ts=1616509748.001400&cid=C0KLZSCHF
maven(findProperty("circuit.mavenUrls.kotlinDev")!!) {
name = "Kotlin-Bootstrap"
content {
// this repository *only* contains Kotlin artifacts (don't try others here)
includeGroupByRegex("org\\.jetbrains.*")
}
}
// JB Compose Repo
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") { name = "Compose-JB" }
// Gradle's plugin portal proxies jcenter, which we don't want. To avoid this, we specify
// exactly which dependencies to pull from here.
exclusiveContent {
forRepository(::gradlePluginPortal)
filter {
includeModule("com.github.ben-manes", "gradle-versions-plugin")
includeModule(
"com.github.ben-manes.versions",
"com.github.ben-manes.versions.gradle.plugin"
)
includeModule("com.gradle", "gradle-enterprise-gradle-plugin")
includeModule("com.gradle.enterprise", "com.gradle.enterprise.gradle.plugin")
includeModule("com.diffplug.spotless", "com.diffplug.spotless.gradle.plugin")
includeModule("io.gitlab.arturbosch.detekt", "io.gitlab.arturbosch.detekt.gradle.plugin")
includeModule("org.gradle.kotlin.kotlin-dsl", "org.gradle.kotlin.kotlin-dsl.gradle.plugin")
includeModule("org.gradle.kotlin", "gradle-kotlin-dsl-plugins")
}
}
}
plugins { id("com.gradle.enterprise") version "3.12.6" }
}
plugins { id("com.gradle.enterprise") }
val VERSION_NAME: String by extra.properties
gradleEnterprise {
buildScan {
publishAlways()
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
tag(if (System.getenv("CI").isNullOrBlank()) "Local" else "CI")
tag(VERSION_NAME)
}
}
rootProject.name = "circuit-root"
// Please keep these in alphabetical order!
include(
":backstack",
":circuit-codegen",
":circuit-codegen-annotations",
":circuit-foundation",
":circuit-overlay",
":circuit-retained",
":circuit-runtime",
":circuit-runtime-presenter",
":circuit-runtime-ui",
":circuit-swiftui",
":circuit-test",
":samples:counter",
":samples:counter:apps",
":samples:counter:mosaic",
":samples:interop",
":samples:star",
":samples:star:apk",
":samples:star:benchmark",
":samples:star:coil-rule",
":samples:tacos",
)
// https://docs.gradle.org/5.6/userguide/groovy_plugin.html#sec:groovy_compilation_avoidance
enableFeaturePreview("GROOVY_COMPILATION_AVOIDANCE")
// https://docs.gradle.org/current/userguide/declaring_dependencies.html#sec:type-safe-project-accessors
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")