Skip to content

Commit 8eb8e68

Browse files
authored
Merge pull request #3559 from Kotlin/kotlin-community/dev
Prepare coroutines for including to the community projects composite build
2 parents c194877 + 28d98e8 commit 8eb8e68

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ buildscript {
4545
repositories {
4646
mavenCentral()
4747
maven { url "https://plugins.gradle.org/m2/" }
48-
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" }
48+
CommunityProjectsBuild.addDevRepositoryIfEnabled(delegate, project)
4949
mavenLocal()
5050
}
5151

@@ -130,7 +130,7 @@ allprojects {
130130
*/
131131
google()
132132
mavenCentral()
133-
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" }
133+
CommunityProjectsBuild.addDevRepositoryIfEnabled(delegate, project)
134134
}
135135
}
136136

buildSrc/build.gradle.kts

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ plugins {
1010

1111
val cacheRedirectorEnabled = System.getenv("CACHE_REDIRECTOR")?.toBoolean() == true
1212
val buildSnapshotTrain = properties["build_snapshot_train"]?.toString()?.toBoolean() == true
13+
val kotlinDevUrl = project.rootProject.properties["kotlin_repo_url"] as? String
1314

1415
repositories {
1516
mavenCentral()
@@ -18,7 +19,9 @@ repositories {
1819
} else {
1920
maven("https://plugins.gradle.org/m2")
2021
}
21-
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
22+
if (!kotlinDevUrl.isNullOrEmpty()) {
23+
maven(kotlinDevUrl)
24+
}
2225
if (buildSnapshotTrain) {
2326
mavenLocal()
2427
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2016-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
@file:JvmName("CommunityProjectsBuild")
5+
6+
import org.gradle.api.*
7+
import org.gradle.api.artifacts.dsl.*
8+
import java.net.*
9+
import java.util.logging.*
10+
11+
private val LOGGER: Logger = Logger.getLogger("Kotlin settings logger")
12+
13+
14+
/**
15+
* Functions in this file are responsible for configuring kotlinx.coroutines build against a custom dev version
16+
* of Kotlin compiler.
17+
* Such configuration is used in a composite community build of Kotlin in order to check whether not-yet-released changes
18+
* are compatible with our libraries (aka "integration testing that substitues lack of unit testing").
19+
*/
20+
21+
/**
22+
* Should be used for running against of non-released Kotlin compiler on a system test level
23+
* Kotlin compiler artifacts are expected to be downloaded from maven central by default.
24+
* In case of compiling with not-published into the MC kotlin compiler artifacts, a kotlin_repo_url gradle parameter should be specified.
25+
* To reproduce a build locally, a kotlin/dev repo should be passed
26+
*
27+
* @return an url for a kotlin compiler repository parametrized from command line nor gradle.properties, empty string otherwise
28+
*/
29+
fun getKotlinDevRepositoryUrl(project: Project): URI? {
30+
val url: String? = project.rootProject.properties["kotlin_repo_url"] as? String
31+
if (url != null) {
32+
LOGGER.info("""Configured Kotlin Compiler repository url: '$url' for project ${project.name}""")
33+
return URI.create(url)
34+
}
35+
return null
36+
}
37+
38+
/**
39+
* Adds a kotlin-dev space repository with dev versions of Kotlin if Kotlin aggregate build is enabled
40+
*/
41+
fun addDevRepositoryIfEnabled(rh: RepositoryHandler, project: Project) {
42+
val devRepoUrl = getKotlinDevRepositoryUrl(project) ?: return
43+
rh.maven {
44+
url = devRepoUrl
45+
}
46+
}

0 commit comments

Comments
 (0)