Skip to content

Commit 39918cb

Browse files
Update user projects config: adapt build script to new TeamCity variables (#2342)
Co-authored-by: Leonid Startsev <[email protected]>
1 parent caa194b commit 39918cb

File tree

6 files changed

+77
-2
lines changed

6 files changed

+77
-2
lines changed

benchmark/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
13
/*
24
* Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
35
*/
@@ -25,6 +27,18 @@ jmhJar {
2527
destinationDirectory = file("$rootDir")
2628
}
2729

30+
// to include benchmark-module jmh source set compilation during build to verify that it is also compiled succesfully
31+
assemble.dependsOn jmhClasses
32+
33+
tasks.withType(KotlinCompile).configureEach {
34+
kotlinOptions {
35+
if (rootProject.ext.kotlin_lv_override != null) {
36+
languageVersion = rootProject.ext.kotlin_lv_override
37+
freeCompilerArgs += "-Xsuppress-version-warnings"
38+
}
39+
}
40+
}
41+
2842
dependencies {
2943
implementation 'org.openjdk.jmh:jmh-core:1.35'
3044
implementation 'com.google.guava:guava:31.1-jre'

build.gradle

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,20 @@
33
*/
44

55
buildscript {
6-
if (project.hasProperty("bootstrap")) {
6+
/**
7+
* Overrides for Teamcity 'K2 User Projects' + 'Aggregate build / Kotlinx libraries compilation' configuration:
8+
* kotlin_repo_url - local repository with snapshot Kotlin compiler
9+
* kotlin_version - kotlin version to use
10+
* kotlin_language_version - LV to use
11+
*/
12+
ext.snapshotRepoUrl = rootProject.properties["kotlin_repo_url"]
13+
ext.kotlin_lv_override = rootProject.properties["kotlin_language_version"]
14+
if (snapshotRepoUrl != null && snapshotRepoUrl != "") {
15+
ext.kotlin_version = rootProject.properties["kotlin_version"]
16+
repositories {
17+
maven { url snapshotRepoUrl }
18+
}
19+
} else if (project.hasProperty("bootstrap")) {
720
ext.kotlin_version = property('kotlin.version.snapshot')
821
ext["kotlin.native.home"] = System.getenv("KONAN_LOCAL_DIST")
922
} else {
@@ -125,6 +138,13 @@ allprojects {
125138
}
126139
}
127140

141+
if (snapshotRepoUrl != null && snapshotRepoUrl != "") {
142+
// Snapshot-specific for K2 CI configurations
143+
repositories {
144+
maven { url snapshotRepoUrl }
145+
}
146+
}
147+
128148
configurations.all {
129149
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
130150
if (details.requested.group == 'org.jetbrains.kotlin') {

buildSrc/build.gradle.kts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ plugins {
1212
repositories {
1313
mavenCentral()
1414
mavenLocal()
15+
if (project.hasProperty("kotlin_repo_url")) {
16+
maven(project.properties["kotlin_repo_url"] as String)
17+
}
18+
// kotlin-dev with space redirector
19+
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
1520
}
1621

1722
val kotlinVersion = run {
@@ -20,9 +25,14 @@ val kotlinVersion = run {
2025
require(!ver.isNullOrBlank()) {"kotlin_snapshot_version must be present if build_snapshot_train is used" }
2126
return@run ver
2227
}
28+
if (project.hasProperty("kotlin_repo_url")) {
29+
val ver = project.properties["kotlin_version"] as? String
30+
require(!ver.isNullOrBlank()) {"kotlin_version must be present if kotlin_repo_url is used" }
31+
return@run ver
32+
}
2333
val targetProp = if (project.hasProperty("bootstrap")) "kotlin.version.snapshot" else "kotlin.version"
2434
FileInputStream(file("../gradle.properties")).use { propFile ->
25-
val ver = Properties().apply { load(propFile) }[targetProp]
35+
val ver = project.findProperty("kotlin.version")?.toString() ?: Properties().apply { load(propFile) }[targetProp]
2636
require(ver is String) { "$targetProp must be string in ../gradle.properties, got $ver instead" }
2737
ver
2838
}

formats/hocon/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
2+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3+
14
/*
25
* Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
36
*/
@@ -12,6 +15,15 @@ compileKotlin {
1215
}
1316
}
1417

18+
tasks.withType(KotlinCompile).configureEach {
19+
kotlinOptions {
20+
if (rootProject.ext.kotlin_lv_override != null) {
21+
languageVersion = rootProject.ext.kotlin_lv_override
22+
freeCompilerArgs += "-Xsuppress-version-warnings"
23+
}
24+
}
25+
}
26+
1527
java {
1628
sourceCompatibility = JavaVersion.VERSION_1_8
1729
targetCompatibility = JavaVersion.VERSION_1_8

gradle/configure-source-sets.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ kotlin {
9595
}
9696

9797
targets.all {
98+
compilations.all {
99+
kotlinOptions {
100+
if (rootProject.ext.kotlin_lv_override != null) {
101+
languageVersion = rootProject.ext.kotlin_lv_override
102+
freeCompilerArgs += "-Xsuppress-version-warnings"
103+
}
104+
}
105+
}
98106
compilations.main {
99107
kotlinOptions {
100108
allWarningsAsErrors = true

guide/build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
13
/*
24
* Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
35
*/
@@ -9,6 +11,15 @@ kotlin {
911
jvmToolchain(8)
1012
}
1113

14+
tasks.withType(KotlinCompile).configureEach {
15+
kotlinOptions {
16+
if (rootProject.ext.kotlin_lv_override != null) {
17+
languageVersion = rootProject.ext.kotlin_lv_override
18+
freeCompilerArgs += "-Xsuppress-version-warnings"
19+
}
20+
}
21+
}
22+
1223
dependencies {
1324
testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
1425
testImplementation "org.jetbrains.kotlinx:kotlinx-knit-test:$knit_version"

0 commit comments

Comments
 (0)