summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMargarita Bobova <32216159+woainikk@users.noreply.github.com>2023-06-23 15:03:38 +0200
committerGitHub <noreply@github.com>2023-06-23 15:03:38 +0200
commit39918cb2382b5e069f25d70fbc0a2665074be56c (patch)
tree9a028b6956ddd1a5b8bb890904c63b261601000c
parentcaa194b78353c1b2301b6a2f96743fd761bd0d67 (diff)
downloadkotlinx.serialization-39918cb2382b5e069f25d70fbc0a2665074be56c.tar.gz
Update user projects config: adapt build script to new TeamCity variables (#2342)
Co-authored-by: Leonid Startsev <sandwwraith@gmail.com>
-rw-r--r--benchmark/build.gradle14
-rw-r--r--build.gradle22
-rw-r--r--buildSrc/build.gradle.kts12
-rw-r--r--formats/hocon/build.gradle12
-rw-r--r--gradle/configure-source-sets.gradle8
-rw-r--r--guide/build.gradle11
6 files changed, 77 insertions, 2 deletions
diff --git a/benchmark/build.gradle b/benchmark/build.gradle
index 04dde008..751ad78c 100644
--- a/benchmark/build.gradle
+++ b/benchmark/build.gradle
@@ -1,3 +1,5 @@
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
/*
* Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
@@ -25,6 +27,18 @@ jmhJar {
destinationDirectory = file("$rootDir")
}
+// to include benchmark-module jmh source set compilation during build to verify that it is also compiled succesfully
+assemble.dependsOn jmhClasses
+
+tasks.withType(KotlinCompile).configureEach {
+ kotlinOptions {
+ if (rootProject.ext.kotlin_lv_override != null) {
+ languageVersion = rootProject.ext.kotlin_lv_override
+ freeCompilerArgs += "-Xsuppress-version-warnings"
+ }
+ }
+}
+
dependencies {
implementation 'org.openjdk.jmh:jmh-core:1.35'
implementation 'com.google.guava:guava:31.1-jre'
diff --git a/build.gradle b/build.gradle
index 56f3f0a0..7d912ba6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,7 +3,20 @@
*/
buildscript {
- if (project.hasProperty("bootstrap")) {
+ /**
+ * Overrides for Teamcity 'K2 User Projects' + 'Aggregate build / Kotlinx libraries compilation' configuration:
+ * kotlin_repo_url - local repository with snapshot Kotlin compiler
+ * kotlin_version - kotlin version to use
+ * kotlin_language_version - LV to use
+ */
+ ext.snapshotRepoUrl = rootProject.properties["kotlin_repo_url"]
+ ext.kotlin_lv_override = rootProject.properties["kotlin_language_version"]
+ if (snapshotRepoUrl != null && snapshotRepoUrl != "") {
+ ext.kotlin_version = rootProject.properties["kotlin_version"]
+ repositories {
+ maven { url snapshotRepoUrl }
+ }
+ } else if (project.hasProperty("bootstrap")) {
ext.kotlin_version = property('kotlin.version.snapshot')
ext["kotlin.native.home"] = System.getenv("KONAN_LOCAL_DIST")
} else {
@@ -125,6 +138,13 @@ allprojects {
}
}
+ if (snapshotRepoUrl != null && snapshotRepoUrl != "") {
+ // Snapshot-specific for K2 CI configurations
+ repositories {
+ maven { url snapshotRepoUrl }
+ }
+ }
+
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.jetbrains.kotlin') {
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index 73a4e815..c999bcd2 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -12,6 +12,11 @@ plugins {
repositories {
mavenCentral()
mavenLocal()
+ if (project.hasProperty("kotlin_repo_url")) {
+ maven(project.properties["kotlin_repo_url"] as String)
+ }
+ // kotlin-dev with space redirector
+ maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
}
val kotlinVersion = run {
@@ -20,9 +25,14 @@ val kotlinVersion = run {
require(!ver.isNullOrBlank()) {"kotlin_snapshot_version must be present if build_snapshot_train is used" }
return@run ver
}
+ if (project.hasProperty("kotlin_repo_url")) {
+ val ver = project.properties["kotlin_version"] as? String
+ require(!ver.isNullOrBlank()) {"kotlin_version must be present if kotlin_repo_url is used" }
+ return@run ver
+ }
val targetProp = if (project.hasProperty("bootstrap")) "kotlin.version.snapshot" else "kotlin.version"
FileInputStream(file("../gradle.properties")).use { propFile ->
- val ver = Properties().apply { load(propFile) }[targetProp]
+ val ver = project.findProperty("kotlin.version")?.toString() ?: Properties().apply { load(propFile) }[targetProp]
require(ver is String) { "$targetProp must be string in ../gradle.properties, got $ver instead" }
ver
}
diff --git a/formats/hocon/build.gradle b/formats/hocon/build.gradle
index 4e2def9c..c5fae36e 100644
--- a/formats/hocon/build.gradle
+++ b/formats/hocon/build.gradle
@@ -1,3 +1,6 @@
+import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
/*
* Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
@@ -12,6 +15,15 @@ compileKotlin {
}
}
+tasks.withType(KotlinCompile).configureEach {
+ kotlinOptions {
+ if (rootProject.ext.kotlin_lv_override != null) {
+ languageVersion = rootProject.ext.kotlin_lv_override
+ freeCompilerArgs += "-Xsuppress-version-warnings"
+ }
+ }
+}
+
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
diff --git a/gradle/configure-source-sets.gradle b/gradle/configure-source-sets.gradle
index 26593aa3..8bba1cff 100644
--- a/gradle/configure-source-sets.gradle
+++ b/gradle/configure-source-sets.gradle
@@ -95,6 +95,14 @@ kotlin {
}
targets.all {
+ compilations.all {
+ kotlinOptions {
+ if (rootProject.ext.kotlin_lv_override != null) {
+ languageVersion = rootProject.ext.kotlin_lv_override
+ freeCompilerArgs += "-Xsuppress-version-warnings"
+ }
+ }
+ }
compilations.main {
kotlinOptions {
allWarningsAsErrors = true
diff --git a/guide/build.gradle b/guide/build.gradle
index f61a4e6c..b4261e81 100644
--- a/guide/build.gradle
+++ b/guide/build.gradle
@@ -1,3 +1,5 @@
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
/*
* Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
@@ -9,6 +11,15 @@ kotlin {
jvmToolchain(8)
}
+tasks.withType(KotlinCompile).configureEach {
+ kotlinOptions {
+ if (rootProject.ext.kotlin_lv_override != null) {
+ languageVersion = rootProject.ext.kotlin_lv_override
+ freeCompilerArgs += "-Xsuppress-version-warnings"
+ }
+ }
+}
+
dependencies {
testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
testImplementation "org.jetbrains.kotlinx:kotlinx-knit-test:$knit_version"