-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathsettings.gradle.kts
More file actions
99 lines (86 loc) · 3.12 KB
/
settings.gradle.kts
File metadata and controls
99 lines (86 loc) · 3.12 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
91
92
93
94
95
96
97
98
99
import java.net.URI
val localProperties = java.util.Properties().apply {
val file = file("local.properties")
if (file.exists()) {
file.inputStream().use { load(it) }
}
}
// Allows overriding the project name via local.properties, useful when using git worktrees
rootProject.name = localProperties.getProperty("project.name") ?: "Blockstream_App"
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
pluginManagement {
repositories {
google()
gradlePluginPortal()
mavenCentral()
maven("https://packages.jetbrains.team/maven/p/firework/dev")
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://packages.jetbrains.team/maven/p/firework/dev")
}
}
include(
":androidApp",
":compose",
":hardware",
":jade",
":base-gms",
":gms",
":no-gms",
":gdk",
":desktopApp",
":data",
":utils",
":network",
":domain"
)
// Determine if the build is running in a CI environment
// GitLab CI automatically sets the "CI" environment variable to "true"
val isCi = System.getenv("CI") == "true"
buildCache {
local {
isEnabled = true
// removeUnusedEntriesAfter = Days.days(7)
}
if (isCi) {
val gitlabApiV4Url = System.getenv("CI_API_V4_URL")
val gitlabProjectId = System.getenv("CI_PROJECT_ID")
val gitlabJobToken = System.getenv("CI_JOB_TOKEN")
if (gitlabApiV4Url.isNullOrBlank() || gitlabProjectId.isNullOrBlank() || gitlabJobToken.isNullOrBlank()) {
println("WARN: GitLab Remote Build Cache environment variables (CI_API_V4_URL, CI_PROJECT_ID, CI_JOB_TOKEN) are not fully set. Remote cache will be disabled for this build.")
} else {
println("INFO: Configuring GitLab Remote Build Cache.")
remote(HttpBuildCache::class) {
url = URI("$gitlabApiV4Url/projects/$gitlabProjectId/packages/generic/gradle-build-cache/v1")
credentials {
username = "gitlab-ci-token"
password = gitlabJobToken
}
isPush = true
}
}
}
}
gradle.settingsEvaluated {
val localCacheStatus = if (settings.buildCache.local.isEnabled) "ENABLED" else "DISABLED"
var remoteCacheInfo = "DISABLED" // Declare remoteCacheInfo
val remoteCacheConfig = settings.buildCache.remote
if (remoteCacheConfig != null && remoteCacheConfig.isEnabled) {
if (remoteCacheConfig is HttpBuildCache) {
remoteCacheInfo = "ENABLED (URL: ${remoteCacheConfig.url}, Push: ${remoteCacheConfig.isPush})" // Assign to remoteCacheInfo
} else {
remoteCacheInfo = "ENABLED (Type: ${remoteCacheConfig::class.simpleName}, Push: ${remoteCacheConfig.isPush})" // Assign to remoteCacheInfo
}
}
println("""
============================================================
Gradle Build Cache Status:
Local Cache: $localCacheStatus
Remote Cache: $remoteCacheInfo
============================================================
""".trimIndent()) // Print remoteCacheInfo
}