Repository navigation
Expand file tree
/
Copy pathsettings.gradle.kts
More file actions
90 lines (75 loc) · 2.42 KB
/
Copy pathsettings.gradle.kts
File metadata and controls
90 lines (75 loc) · 2.42 KB
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
pluginManagement {
includeBuild("build-logic")
repositories {
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("com.gradle.develocity") version "4.6.0"
}
dependencyResolutionManagement {
repositories {
mavenCentral()
}
versionCatalogs {
create("pinnedLibs") {
from(files("gradle/pinned-libs.versions.toml"))
}
}
}
if (System.getenv("CI") != null) {
// use the remote buildcache on all CI builds
buildCache {
fun cred(name: String): String? = System.getenv(name) ?: System.getProperty(name)
remote<HttpBuildCache> {
url = uri("https://buildcache.diffplug.com/cache/")
// but we only push if it's a trusted build (not PRs)
val user = cred("buildcacheuser")
val pass = cred("buildcachepass")
if (user != null && pass != null) {
isPush = true
credentials {
username = user
password = pass
}
} else {
credentials {
username = "anonymous"
}
}
}
}
}
develocity {
buildScan {
termsOfUseUrl = "https://gradle.com/terms-of-service"
termsOfUseAgree = "yes"
publishing {
onlyIf { System.getenv("CI") != null }
}
}
}
enableFeaturePreview("STABLE_CONFIGURATION_CACHE")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
rootProject.name = "spotless"
include("lib") // reusable library with no dependencies
include("lib-extra") // reusable library with lots of dependencies
include("plugin-gradle") // gradle-specific glue code
include("testlib") // library for sharing test infrastructure between the projects below
fun getStartProperty(name: String): String? =
startParameter.projectProperties[name]
?: File(startParameter.gradleUserHomeDir, "gradle.properties")
.takeIf { it.exists() }
?.reader()
?.use { java.util.Properties().apply { load(it) }.getProperty(name) }
// Groovy's String.toBoolean() -- what this used before the Kotlin DSL migration -- accepts "true",
// "y" and "1", ignoring case. Kotlin's toBoolean() only accepts "true", so the short forms would
// silently become no-ops.
fun String.toBooleanGroovy(): Boolean = trim().lowercase() in setOf("true", "y", "1")
val excludeMaven =
System.getenv("SPOTLESS_EXCLUDE_MAVEN")?.toBooleanGroovy() == true ||
getStartProperty("SPOTLESS_EXCLUDE_MAVEN")?.toBooleanGroovy() == true
if (!excludeMaven) {
include("plugin-maven") // maven-specific glue code
}