Skip to content

Commit f1f465b

Browse files
committed
Manually configure some cache-redirected repositories
1 parent f075269 commit f1f465b

4 files changed

Lines changed: 32 additions & 12 deletions

File tree

build.gradle.kts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ import org.jetbrains.kotlin.gradle.dsl.*
33
import org.gradle.kotlin.dsl.*
44

55
buildscript {
6-
if (shouldUseLocalMaven(rootProject)) {
7-
repositories {
8-
mavenLocal()
9-
}
10-
}
11-
126
repositories {
137
mavenCentral()
148
maven(url = "https://plugins.gradle.org/m2/")

buildSrc/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ val buildSnapshotTrain = properties["build_snapshot_train"]?.toString()?.toBoole
99
val kotlinDevUrl = project.providers.gradleProperty("kotlin_repo_url").orNull
1010

1111
repositories {
12-
mavenCentral()
1312
if (cacheRedirectorEnabled) {
1413
maven("https://cache-redirector.jetbrains.com/plugins.gradle.org/m2")
14+
maven("https://cache-redirector.jetbrains.com/maven-central")
1515
} else {
1616
maven("https://plugins.gradle.org/m2")
17+
mavenCentral()
1718
}
1819
if (!kotlinDevUrl.isNullOrEmpty()) {
1920
maven(kotlinDevUrl)

buildSrc/src/main/kotlin/CommunityProjectsBuild.kt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,24 @@ fun getKotlinDevRepositoryUrl(project: Project): String? {
7878
*/
7979
fun addDevRepositoryIfEnabled(rh: RepositoryHandler, project: Project) {
8080
val devRepoUrl = getKotlinDevRepositoryUrl(project) ?: return
81-
rh.maven(devRepoUrl)
81+
val version = getKotlinDevVersion(project) ?: return
82+
rh.exclusiveContent {
83+
forRepository {
84+
rh.maven(devRepoUrl)
85+
}
86+
filter {
87+
includeVersionByRegex("org.jetbrains.kotlin", ".*", version)
88+
}
89+
}
90+
}
91+
92+
fun getKotlinDevVersion(project: Project): String? {
93+
val version = project.providers.gradleProperty("kotlin_version").orNull
94+
if (version != null) {
95+
LOGGER.info("""Configured Kotlin Compiler version: '$version' for project ${project.name}""")
96+
return version
97+
}
98+
return null
8299
}
83100

84101
/**

settings.gradle.kts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,18 @@ pluginManagement {
77

88
repositories {
99
maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev/")
10-
gradlePluginPortal()
10+
val cacheRedirectorEnabled = System.getenv("CACHE_REDIRECTOR")?.toBoolean() == true
11+
if (cacheRedirectorEnabled) {
12+
maven("https://cache-redirector.jetbrains.com/plugins.gradle.org/m2")
13+
} else {
14+
gradlePluginPortal()
15+
}
16+
val prop = System.getProperty("build_snapshot_train")
17+
var build_snapshot_train: String by extra
18+
build_snapshot_train = if (prop != null && prop != "") "true" else "false"
19+
if (build_snapshot_train.toBoolean()) {
20+
mavenLocal()
21+
}
1122
}
1223
}
1324

@@ -19,9 +30,6 @@ fun module(path: String) {
1930
include(name)
2031
project(":$name").projectDir = file(path)
2132
}
22-
val prop = System.getProperty("build_snapshot_train")
23-
var build_snapshot_train: String by extra
24-
build_snapshot_train = if (prop != null && prop != "") "true" else "false"
2533
// ---------------------------
2634

2735
include("benchmarks")

0 commit comments

Comments
 (0)