-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.gradle.kts
139 lines (122 loc) · 4.6 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
import net.twisterrob.colorfilters.build.dsl.isCI
import net.twisterrob.gradle.doNotNagAbout
import net.twisterrob.gradle.settings.enableFeaturePreviewQuietly
rootProject.name = "ColorFilters"
enableFeaturePreviewQuietly("TYPESAFE_PROJECT_ACCESSORS", "Type-safe project accessors")
include(":app")
include(":feature:about", ":feature:about:test-fixtures")
include(":feature:lighting", ":feature:lighting:test-fixtures")
include(":feature:porterduff", ":feature:porterduff:test-fixtures")
include(":feature:matrix", ":feature:matrix:test-fixtures")
include(":feature:palette", ":feature:palette:test-fixtures")
include(":feature:resfont", ":feature:resfont:test-fixtures")
include(":feature:base")
include(":component:core")
include(":component:test-base-ui")
include(":component:test-base-unit")
include(":feature:image")
include(":feature:keyboard", ":feature:keyboard:contract")
pluginManagement {
includeBuild("gradle/plugins")
repositories {
google {
content {
includeGroupByRegex("""^com\.android(\..*)?$""")
includeGroupByRegex("""^com\.google\..*$""")
includeGroupByRegex("""^androidx\..*$""")
}
}
mavenCentral()
gradlePluginPortal {
content {
includeGroup("com.gradle")
includeGroup("com.gradle.develocity")
}
}
}
}
plugins {
id("com.gradle.develocity") version "3.18"
id("net.twisterrob.gradle.plugin.nagging")
}
@Suppress("UnstableApiUsage")
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google {
content {
includeGroupByRegex("""^com\.android(\..*)?$""")
includeGroupByRegex("""^com\.google\..*$""")
includeGroupByRegex("""^androidx\..*$""")
}
}
mavenCentral()
}
}
develocity {
buildScan {
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
termsOfUseAgree = "yes"
if (isCI) {
fun setOutput(name: String, value: Any?) {
// Using `appendText` to make sure out outputs are not cleared.
// Using `\n` to make sure further outputs are correct.
// Using `delimiter` to ensure that any special characters (such as newlines) are escaped.
val delimiter = java.util.UUID.randomUUID().toString()
providers
.environmentVariable("GITHUB_OUTPUT")
.map(::File)
// TODEL https://github.com/gradle/gradle/issues/25716
.orNull.let { it ?: error("GITHUB_OUTPUT environment variable is not set.") }
.appendText("${name}<<${delimiter}\n${value}\n${delimiter}\n")
}
buildScanPublished {
setOutput("build-scan-url", buildScanUri.toASCIIString())
}
gradle.addBuildListener(object : BuildAdapter() {
@Deprecated("Won't work with configuration caching.")
override fun buildFinished(result: BuildResult) {
setOutput("result-success", result.failure == null)
setOutput("result-text", resultText(result))
}
private fun resultText(result: BuildResult): String =
"${result.action} ${resultText(result.failure)}"
private fun resultText(ex: Throwable?): String =
when (ex) {
null ->
"Successful"
is org.gradle.internal.exceptions.LocationAwareException ->
// Shorten the trivial part of the file name,
// as there's a length limitation in GitHub Actions for message (140 chars).
// > Build Failed: Build file '.../build.gradle.kts' line: 20
// > A problem occurred configuring project ':feature:about'.
"Failed: ${ex.message?.replace(rootDir.absolutePath, "")}"
else ->
"Failed with ${ex}"
}
})
}
}
}
val gradleVersion: String = GradleVersion.current().version
// TODEL Gradle 8.8 sync in IDEA 2024.1.4 https://youtrack.jetbrains.com/issue/IDEA-353787.
@Suppress("MaxLineLength", "StringLiteralDuplication")
if ((System.getProperty("idea.version") ?: "") < "2024.2") {
doNotNagAbout(
"The CopyProcessingSpec.getFileMode() method has been deprecated. " +
"This is scheduled to be removed in Gradle 9.0. " +
"Please use the getFilePermissions() method instead. " +
"Consult the upgrading guide for further information: " +
"https://docs.gradle.org/${gradleVersion}/userguide/upgrading_version_8.html#unix_file_permissions_deprecated",
)
doNotNagAbout(
"The CopyProcessingSpec.getDirMode() method has been deprecated. " +
"This is scheduled to be removed in Gradle 9.0. " +
"Please use the getDirPermissions() method instead. " +
"Consult the upgrading guide for further information: " +
"https://docs.gradle.org/${gradleVersion}/userguide/upgrading_version_8.html#unix_file_permissions_deprecated",
)
} else {
val error: (String) -> Unit = (if (isCI) ::error else logger::warn)
error("Android Studio version changed, please review hack.")
}