Skip to content

Commit 3370cd9

Browse files
authored
Use centralized repositories for build (kotest#4110)
Centrally define the repositories required for the build. This encourages a stable build, as the repositories are defined consistently, in the same order of priority, for all subprojects.
1 parent 0c2acd6 commit 3370cd9

File tree

5 files changed

+67
-24
lines changed

5 files changed

+67
-24
lines changed

build.gradle.kts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ plugins {
22
alias(libs.plugins.kotlinBinaryCompatibilityValidator)
33
}
44

5-
repositories {
6-
mavenCentral()
7-
mavenLocal()
8-
maven("https://oss.sonatype.org/content/repositories/snapshots/")
9-
google()
10-
gradlePluginPortal() // tvOS builds need to be able to fetch a kotlin gradle plugin
11-
}
12-
135
apiValidation {
146
ignoredPackages.addAll(
157
listOf(

buildSrc/build.gradle.kts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ plugins {
22
`kotlin-dsl`
33
}
44

5-
repositories {
6-
mavenCentral()
7-
gradlePluginPortal()
8-
}
9-
105
dependencies {
116
implementation(libs.testlogger.gradle.plugin)
127
implementation(libs.kotlin.gradle.plugin)

buildSrc/settings.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
rootProject.name = "buildSrc"
22

3+
pluginManagement {
4+
repositories {
5+
mavenCentral()
6+
gradlePluginPortal()
7+
}
8+
}
9+
10+
@Suppress("UnstableApiUsage")
311
dependencyResolutionManagement {
12+
repositoriesMode = RepositoriesMode.PREFER_SETTINGS
13+
repositories {
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
417
versionCatalogs {
518
create("libs") {
619
from(files("../gradle/libs.versions.toml"))

buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@ plugins {
77
id("com.adarshr.test-logger")
88
}
99

10-
repositories {
11-
google()
12-
mavenCentral()
13-
maven("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental")
14-
maven("https://oss.sonatype.org/content/repositories/snapshots/") {
15-
mavenContent { snapshotsOnly() }
16-
}
17-
gradlePluginPortal() // tvOS builds need to be able to fetch a kotlin gradle plugin
18-
mavenLocal()
19-
}
20-
2110
testlogger {
2211
showPassed = false
2312
}

settings.gradle.kts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,60 @@ pluginManagement {
77
}
88
}
99

10+
@Suppress("UnstableApiUsage")
11+
dependencyResolutionManagement {
12+
repositoriesMode = RepositoriesMode.PREFER_SETTINGS
13+
14+
repositories {
15+
mavenCentral()
16+
maven("https://oss.sonatype.org/content/repositories/snapshots/") {
17+
name = "SonatypeSnapshots"
18+
mavenContent { snapshotsOnly() }
19+
}
20+
21+
//region workaround for https://youtrack.jetbrains.com/issue/KT-51379
22+
// FIXME remove when updating to Kotlin 2.0
23+
ivy("https://download.jetbrains.com/kotlin/native/builds") {
24+
name = "KotlinNative"
25+
patternLayout {
26+
listOf(
27+
"macos-x86_64",
28+
"macos-aarch64",
29+
"osx-x86_64",
30+
"osx-aarch64",
31+
"linux-x86_64",
32+
"windows-x86_64",
33+
).forEach { os ->
34+
listOf("dev", "releases").forEach { stage ->
35+
artifact("$stage/[revision]/$os/[artifact]-[revision].[ext]")
36+
}
37+
}
38+
}
39+
content { includeModuleByRegex(".*", ".*kotlin-native-prebuilt.*") }
40+
metadataSources { artifact() }
41+
}
42+
//endregion
43+
44+
//region Declare the Node.js & Yarn download repositories
45+
// Workaround https://youtrack.jetbrains.com/issue/KT-68533/
46+
ivy("https://cache-redirector.jetbrains.com/nodejs.org/dist/") {
47+
name = "Node Distributions at $url"
48+
patternLayout { artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]") }
49+
metadataSources { artifact() }
50+
content { includeModule("org.nodejs", "node") }
51+
}
52+
ivy("https://github.com/yarnpkg/yarn/releases/download") {
53+
name = "Yarn Distributions at $url"
54+
patternLayout { artifact("v[revision]/[artifact](-v[revision]).[ext]") }
55+
metadataSources { artifact() }
56+
content { includeModule("com.yarnpkg", "yarn") }
57+
}
58+
//endregion
59+
60+
mavenLocal()
61+
}
62+
}
63+
1064
include(
1165
":kotest-common",
1266

0 commit comments

Comments
 (0)