diff --git a/.idea/kotlinx-rpc.iml b/.idea/kotlinx-rpc.iml
index 5326dceee..1fdae3590 100644
--- a/.idea/kotlinx-rpc.iml
+++ b/.idea/kotlinx-rpc.iml
@@ -8,6 +8,7 @@
+
\ No newline at end of file
diff --git a/.puppeteerrc.cjs b/.puppeteerrc.cjs
index cf9afa888..44011893f 100644
--- a/.puppeteerrc.cjs
+++ b/.puppeteerrc.cjs
@@ -1,6 +1,6 @@
const {join} = require('path');
-const isCI = process.env.TEAMCITY_VERSION
+const isCI = process.env.TEAMCITY_VERSION || process.env.GITHUB_ACTIONS;
if (isCI) {
/**
diff --git a/bom/build.gradle.kts b/bom/build.gradle.kts
index ea1df3301..f1a3bf959 100644
--- a/bom/build.gradle.kts
+++ b/bom/build.gradle.kts
@@ -3,7 +3,7 @@
*/
import util.KOTLINX_RPC_PREFIX
-import util.isPublicModule
+import util.other.isPublicModule
plugins {
`java-platform`
diff --git a/build.gradle.kts b/build.gradle.kts
index 58c89c461..ec71b2d56 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -3,87 +3,16 @@
*/
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
-import util.asDokkaVersion
-import util.configureNpm
-import util.configureProjectReport
-import util.registerDumpPlatformTableTask
-import util.registerChangelogTask
-import util.libs
-import util.registerVerifyPlatformTableTask
-import java.time.Year
plugins {
alias(libs.plugins.serialization) apply false
alias(libs.plugins.kotlinx.rpc) apply false
+ alias(libs.plugins.atomicfu) apply false
alias(libs.plugins.conventions.kover)
alias(libs.plugins.conventions.gradle.doctor)
- alias(libs.plugins.dokka)
- alias(libs.plugins.atomicfu)
- id("build-util")
+ alias(libs.plugins.conventions.root)
}
-dokka {
- val libDokkaVersion = libs.versions.kotlinx.rpc.get().asDokkaVersion()
-
- moduleVersion.set(libDokkaVersion)
-
- val pagesDirectory = layout.projectDirectory
- .dir("docs")
- .dir("pages")
-
- val dokkaVersionsDirectory = pagesDirectory
- .dir("api")
- .asFile
-
- val templatesDirectory = pagesDirectory
- .dir("templates")
-
- pluginsConfiguration {
- html {
- customAssets.from(
- "docs/pages/assets/logo-icon.svg",
- "docs/pages/assets/homepage.svg", // Doesn't work due to https://github.com/Kotlin/dokka/issues/4007
- )
-
- footerMessage = "© ${Year.now()} JetBrains s.r.o and contributors. Apache License 2.0"
- homepageLink = "https://kotlin.github.io/kotlinx-rpc/get-started.html"
-
- // replace with homepage.svg once the mentioned issue is resolved
- templatesDir.set(templatesDirectory)
- }
-
- // enable versioning for stable
-// versioning {
-// version = libDokkaVersion
-// olderVersionsDir = dokkaVersionsDirectory
-// }
- }
-
- dokkaPublications.html {
- outputDirectory = dokkaVersionsDirectory
- }
-
- tasks.clean {
- delete(dokkaVersionsDirectory)
- }
-
- dokkaGeneratorIsolation = ProcessIsolation {
- // Configures heap size, use if start to fail with OOM on CI
-// maxHeapSize = "4g"
- }
-}
-
-dependencies {
- dokkaPlugin(libs.dokka.rpc.plugin)
-}
-
-configureProjectReport()
-configureNpm()
-
-registerDumpPlatformTableTask()
-registerVerifyPlatformTableTask()
-registerChangelogTask()
-
val kotlinVersion = rootProject.libs.versions.kotlin.lang.get()
val kotlinCompiler = rootProject.libs.versions.kotlin.compiler.get()
diff --git a/compiler-plugin/build.gradle.kts b/compiler-plugin/build.gradle.kts
index a4e388966..7d6768c45 100644
--- a/compiler-plugin/build.gradle.kts
+++ b/compiler-plugin/build.gradle.kts
@@ -6,7 +6,6 @@ import util.whenForIde
plugins {
alias(libs.plugins.conventions.gradle.doctor)
- id("build-util")
}
val rpcVersion: String = libs.versions.kotlinx.rpc.get()
@@ -30,5 +29,5 @@ println(
)
whenForIde {
- println("For-ide project mode enabled")
+ println("[Compiler Plugin] For-ide project mode enabled")
}
diff --git a/compiler-plugin/compiler-plugin-k2/build.gradle.kts b/compiler-plugin/compiler-plugin-k2/build.gradle.kts
index 2205f003b..31d312196 100644
--- a/compiler-plugin/compiler-plugin-k2/build.gradle.kts
+++ b/compiler-plugin/compiler-plugin-k2/build.gradle.kts
@@ -2,70 +2,23 @@
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
-import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
import util.enableContextParameters
-import util.otherwise
import util.whenForIde
import util.whenKotlinCompilerIsAtLeast
plugins {
alias(libs.plugins.conventions.jvm)
alias(libs.plugins.compiler.specific.module)
- alias(libs.plugins.shadow.jar)
}
-/*
-This is a hack to solve the next problem:
-
-There is PsiElement class that is used in compiler and plugin.
-
-If we use kotlin-compiler-embeddable.jar to compile the module,
-PsiElement is org.jetbrains.kotlin.com.jetbrains.intellij.PsiElement.
-And it works ok in the user projects!
-
-But.
-
-If we run tests, which use kotlin-compiler.jar, we run into ClassNotFoundException.
-Because the class it has in th classpath is com.jetbrains.intellij.PsiElement
-
-- Alright, we can use kotlin-compiler.jar to compile the plugin.
-- No, because the same error now will occur in the user projects,
- but it is com.jetbrains.intellij.PsiElement that is not found.
-
-- Ok, we can use kotlin-compiler-embeddable.jar to compile tests.
-- Then we ran into java.lang.VerifyError: Bad type on operand stack, which I have no idea how to fix.
-
-This solution replaces org.jetbrains.kotlin.com.jetbrains.intellij.PsiElement usages in plugin
-with com.jetbrains.intellij.PsiElement only for the tests, fixing both use cases.
-It is basically a reverse engineering of what Kotlin does for the embedded jar.
- */
-val shadowJar = tasks.named("shadowJar") {
- configurations = listOf(project.configurations.compileClasspath.get())
- relocate("org.jetbrains.kotlin.com.intellij.psi", "com.intellij.psi")
-
- exclude("javaslang/**")
- exclude("kotlin/**")
- exclude("messages/**")
- exclude("misc/**")
- exclude("org/**")
-
- archiveFileName.set("plugin-k2-for-tests.jar")
-
- /**
- * Same problem as above, but in IDE
- */
+tasks.jar {
+ // important for IDEA plugin
whenForIde {
archiveClassifier.set("for-ide")
- } otherwise {
- archiveClassifier.set("tests")
}
}
-tasks.jar {
- finalizedBy(shadowJar)
-}
-
kotlin {
explicitApi = ExplicitApiMode.Disabled
diff --git a/compiler-plugin/gradle.properties b/compiler-plugin/gradle.properties
deleted file mode 120000
index 7677fb73b..000000000
--- a/compiler-plugin/gradle.properties
+++ /dev/null
@@ -1 +0,0 @@
-../gradle.properties
\ No newline at end of file
diff --git a/compiler-plugin/gradle.properties b/compiler-plugin/gradle.properties
new file mode 100644
index 000000000..b64cbf878
--- /dev/null
+++ b/compiler-plugin/gradle.properties
@@ -0,0 +1,40 @@
+#
+# Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
+#
+
+kotlin.code.style=official
+
+kotlin.native.ignoreDisabledTargets=true
+
+kotlin.daemon.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError
+kotlin.daemon.useFallbackStrategy=false
+
+org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -XX:MaxMetaspaceSize=768m
+org.gradle.daemon=true
+org.gradle.parallel=true
+org.gradle.workers.max=8
+org.gradle.caching=true
+org.gradle.configuration-cache=true
+
+org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
+org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
+
+# development mode for kotlinx.rpc gradle plugin. Uses local project paths to apply the compiler plugin
+kotlinx.rpc.plugin.internalDevelopment=true
+
+# uncomment to debug compilation process
+#kotlin.compiler.execution.strategy=in-process
+
+# Uncomment to skip attempts to publish Develocity build scans
+# Add this property to ~/.gradle/gradle.properties to avoid polluting git with unwanted changes
+#kotlinx.rpc.develocity.skipBuildScans=true
+
+# Uncomment to skip adding git tags to Develocity build scan
+# Add this property to ~/.gradle/gradle.properties to avoid polluting git with unwanted changes
+#kotlinx.rpc.develocity.skipGitTags=true
+
+# Uncomment to sync IDEA when working with Kotlin master builds
+#kotlinx.rpc.kotlinMasterBuild=true
+
+# set to true when building IDE compiler plugin artifacts
+kotlinx.rpc.forIdeBuild=false
diff --git a/core/build.gradle.kts b/core/build.gradle.kts
index 8dc35d2da..5ce2f5b22 100644
--- a/core/build.gradle.kts
+++ b/core/build.gradle.kts
@@ -2,15 +2,12 @@
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
-import util.applyAtomicfuPlugin
-
plugins {
alias(libs.plugins.conventions.kmp)
alias(libs.plugins.kotlinx.rpc)
+ alias(libs.plugins.atomicfu)
}
-applyAtomicfuPlugin()
-
kotlin {
sourceSets {
commonMain {
diff --git a/docs/Multiple-Kotlin-Versions-Support.md b/docs/Multiple-Kotlin-Versions-Support.md
deleted file mode 100644
index bcd040f51..000000000
--- a/docs/Multiple-Kotlin-Versions-Support.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Multiple Kotlin Versions Support
-
-
-### Compiler specific dependencies releases:
-- atomicfu: https://github.com/Kotlin/kotlinx-atomicfu/releases
-- serialization: https://github.com/Kotlin/kotlinx.serialization/releases
-- coroutines: https://github.com/Kotlin/kotlinx.coroutines/releases
-- ktor: https://github.com/ktorio/ktor/releases
-- detekt-gradle-plugin: https://github.com/detekt/detekt/releases
-- kotlin-logging: https://github.com/oshai/kotlin-logging/releases
-- gradle-kotlin-dsl: https://plugins.gradle.org/plugin/org.gradle.kotlin.kotlin-dsl
-- binary-compatibility-validator: https://github.com/Kotlin/binary-compatibility-validator/releases
-- kover: https://github.com/Kotlin/kotlinx-kover/releases
diff --git a/dokka-plugin/build.gradle.kts b/dokka-plugin/build.gradle.kts
index fa98a2889..66fceb1bd 100644
--- a/dokka-plugin/build.gradle.kts
+++ b/dokka-plugin/build.gradle.kts
@@ -4,17 +4,13 @@
plugins {
alias(libs.plugins.conventions.gradle.doctor)
- id("build-util")
alias(libs.plugins.kotlin.jvm)
}
-val rpcVersion: String = libs.versions.kotlinx.rpc.get()
-val kotlinLangVersion = libs.versions.kotlin.lang.get()
-
group = "org.jetbrains.kotlinx"
-version = rpcVersion
+version = libs.versions.kotlinx.rpc.get()
-println("[Dokka Plugin] kotlinx.rpc project version: $version, Kotlin version: $kotlinLangVersion")
+println("[Dokka Plugin] kotlinx.rpc project version: $version, Kotlin version: ${libs.versions.kotlin.lang.get()}")
kotlin {
jvmToolchain(8)
@@ -26,7 +22,7 @@ dependencies {
testImplementation(kotlin("test"))
testImplementation(libs.dokka.base)
- testImplementation("org.jetbrains.dokka:dokka-test-api:${libs.versions.dokka.get()}")
- testImplementation("org.jetbrains.dokka:dokka-base-test-utils:${libs.versions.dokka.get()}")
- testImplementation("org.jetbrains.dokka:analysis-kotlin-symbols:${libs.versions.dokka.get()}")
+ testImplementation(libs.dokka.test.api)
+ testImplementation(libs.dokka.base.test.utils)
+ testImplementation(libs.dokka.analysis.kotlin.symbols)
}
diff --git a/dokka-plugin/gradle.properties b/dokka-plugin/gradle.properties
new file mode 100644
index 000000000..b64cbf878
--- /dev/null
+++ b/dokka-plugin/gradle.properties
@@ -0,0 +1,40 @@
+#
+# Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
+#
+
+kotlin.code.style=official
+
+kotlin.native.ignoreDisabledTargets=true
+
+kotlin.daemon.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError
+kotlin.daemon.useFallbackStrategy=false
+
+org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -XX:MaxMetaspaceSize=768m
+org.gradle.daemon=true
+org.gradle.parallel=true
+org.gradle.workers.max=8
+org.gradle.caching=true
+org.gradle.configuration-cache=true
+
+org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
+org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
+
+# development mode for kotlinx.rpc gradle plugin. Uses local project paths to apply the compiler plugin
+kotlinx.rpc.plugin.internalDevelopment=true
+
+# uncomment to debug compilation process
+#kotlin.compiler.execution.strategy=in-process
+
+# Uncomment to skip attempts to publish Develocity build scans
+# Add this property to ~/.gradle/gradle.properties to avoid polluting git with unwanted changes
+#kotlinx.rpc.develocity.skipBuildScans=true
+
+# Uncomment to skip adding git tags to Develocity build scan
+# Add this property to ~/.gradle/gradle.properties to avoid polluting git with unwanted changes
+#kotlinx.rpc.develocity.skipGitTags=true
+
+# Uncomment to sync IDEA when working with Kotlin master builds
+#kotlinx.rpc.kotlinMasterBuild=true
+
+# set to true when building IDE compiler plugin artifacts
+kotlinx.rpc.forIdeBuild=false
diff --git a/gradle-conventions-settings/build.gradle.kts b/gradle-conventions-settings/build.gradle.kts
index 57d367312..31bf34f98 100644
--- a/gradle-conventions-settings/build.gradle.kts
+++ b/gradle-conventions-settings/build.gradle.kts
@@ -3,7 +3,7 @@
*/
plugins {
- alias(libs.plugins.gradle.kotlin.dsl)
+ `kotlin-dsl`
}
dependencies {
diff --git a/gradle-conventions-settings/develocity/build.gradle.kts b/gradle-conventions-settings/develocity/build.gradle.kts
index 931ab66b6..92796cedb 100644
--- a/gradle-conventions-settings/develocity/build.gradle.kts
+++ b/gradle-conventions-settings/develocity/build.gradle.kts
@@ -3,10 +3,10 @@
*/
plugins {
- alias(libs.plugins.gradle.kotlin.dsl)
+ `kotlin-dsl`
}
dependencies {
- implementation("com.gradle:develocity-gradle-plugin:3.17")
- implementation("com.gradle:common-custom-user-data-gradle-plugin:2.2.1")
+ implementation(libs.develocity)
+ implementation(libs.common.custom.user.data)
}
diff --git a/gradle-conventions-settings/develocity/src/main/kotlin/conventions-develocity.settings.gradle.kts b/gradle-conventions-settings/develocity/src/main/kotlin/conventions-develocity.settings.gradle.kts
index 89f7bd273..027d8d62d 100644
--- a/gradle-conventions-settings/develocity/src/main/kotlin/conventions-develocity.settings.gradle.kts
+++ b/gradle-conventions-settings/develocity/src/main/kotlin/conventions-develocity.settings.gradle.kts
@@ -16,6 +16,9 @@ develocity {
server.set(DEVELOCITY_SERVER)
buildScan {
+ termsOfUseUrl = "https://gradle.com/terms-of-service"
+ termsOfUseAgree = loadAgreement()
+
uploadInBackground.set(!isCIRun)
// obfuscate NIC since we don't want to expose user real IP (will be relevant without VPN)
@@ -35,7 +38,7 @@ develocity {
.getOrElse("false")
.toBooleanStrict()
- publishing.onlyIf { !skipBuildScans }
+ publishing.onlyIf { termsOfUseAgree.get() == "yes" && !skipBuildScans }
}
}
diff --git a/gradle-conventions-settings/develocity/src/main/kotlin/execute.kt b/gradle-conventions-settings/develocity/src/main/kotlin/execute.kt
index fd12377d9..9df72e4a4 100644
--- a/gradle-conventions-settings/develocity/src/main/kotlin/execute.kt
+++ b/gradle-conventions-settings/develocity/src/main/kotlin/execute.kt
@@ -4,7 +4,6 @@
import org.gradle.api.initialization.Settings
-@Suppress("UnstableApiUsage")
fun Settings.execute(cmd: String): String {
return settings.providers.exec {
commandLine(cmd.split(" "))
diff --git a/gradle-conventions-settings/develocity/src/main/kotlin/loadAgreement.kt b/gradle-conventions-settings/develocity/src/main/kotlin/loadAgreement.kt
new file mode 100644
index 000000000..454eca75a
--- /dev/null
+++ b/gradle-conventions-settings/develocity/src/main/kotlin/loadAgreement.kt
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
+ */
+
+import org.gradle.api.GradleException
+import org.gradle.api.initialization.Settings
+import org.gradle.kotlin.dsl.extra
+import java.nio.file.Path
+import java.nio.file.StandardOpenOption
+import kotlin.io.path.bufferedWriter
+import kotlin.io.path.createFile
+import kotlin.io.path.exists
+
+private const val TERMS_OF_USE_PROPERTY = "kotlinx.rpc.develocity.termsOfUseAgree"
+
+fun Settings.loadAgreement(): String {
+ if (isCIRun) {
+ return "yes"
+ }
+
+ val localProperties = extra["localProperties"] as? java.util.Properties
+ ?: throw GradleException("'local.properties' property not found")
+
+ when (val value = localProperties.getProperty(TERMS_OF_USE_PROPERTY)) {
+ "yes", "no" -> {
+ return value
+ }
+
+ "" -> {
+ throw GradleException(
+ "'$TERMS_OF_USE_PROPERTY' property is not set in file://local.properties'. " +
+ "Please set this property to 'yes' or 'no'."
+ )
+ }
+
+ null -> {
+ val globalRootDir = extra["globalRootDir"] as? String
+ ?: throw GradleException("'globalRootDir' property not found. Contact developers.")
+
+ val propFile = Path.of(globalRootDir).resolve("local.properties")
+ if (!propFile.exists()) {
+ propFile.createFile()
+ }
+
+ propFile.bufferedWriter(Charsets.UTF_8, bufferSize = 1024, StandardOpenOption.APPEND).use { writer ->
+ writer.appendLine()
+ writer.appendLine("# Terms of Gradle use agreement: https://gradle.com/terms-of-service")
+ writer.appendLine("# Set to yes or no")
+ writer.appendLine("# Only needed for JetBrains maintainers")
+ writer.appendLine("$TERMS_OF_USE_PROPERTY=")
+ }
+
+ throw GradleException(
+ "'$TERMS_OF_USE_PROPERTY' property not found in file://local.properties . " +
+ "Please add this property and set it to 'yes' or 'no'."
+ )
+ }
+
+ else -> {
+ throw GradleException(
+ "Invalid value for '$TERMS_OF_USE_PROPERTY' property: $value. " +
+ "Please set this property to 'yes' or 'no'."
+ )
+ }
+ }
+}
diff --git a/gradle-conventions-settings/develocity/src/main/kotlin/params.kt b/gradle-conventions-settings/develocity/src/main/kotlin/params.kt
index cb3a017a6..e45b27367 100644
--- a/gradle-conventions-settings/develocity/src/main/kotlin/params.kt
+++ b/gradle-conventions-settings/develocity/src/main/kotlin/params.kt
@@ -6,4 +6,4 @@ const val DEVELOCITY_SERVER = "https://ge.jetbrains.com"
const val GITHUB_REPO = "https://github.com/Kotlin/kotlinx-rpc"
const val TEAMCITY_URL = "https://krpc.teamcity.com"
-val isCIRun = System.getenv("TEAMCITY_VERSION") != null
+val isCIRun = System.getenv("TEAMCITY_VERSION") != null || System.getenv("GITHUB_ACTIONS") != null
diff --git a/gradle-conventions-settings/empty/build.gradle.kts b/gradle-conventions-settings/empty/build.gradle.kts
deleted file mode 100644
index 531de275e..000000000
--- a/gradle-conventions-settings/empty/build.gradle.kts
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
- */
-
-import java.io.File
-import java.nio.file.Files
-import java.nio.file.Path
-
-plugins {
- alias(libs.plugins.gradle.kotlin.dsl)
-}
-
-fun Path.name() = fileName?.toString().orEmpty()
-
-fun filterDirectory(sourceSetPath: Path, filter: (Path) -> Boolean): List {
- return Files.newDirectoryStream(sourceSetPath).use { it.toList() }.filter(filter).map { it.toFile() }
-}
-
-val pluginsSource: Path = layout.projectDirectory.dir("../develocity/src/main/kotlin").asFile.toPath()
-
-val plugins = filterDirectory(pluginsSource) {
- Files.isRegularFile(it) && it.name().endsWith(".settings.gradle.kts")
-}.map { it.name.substringBefore('.') }
-
-plugins.forEach { name ->
- gradlePlugin {
- plugins {
- create(name) {
- id = name
- implementationClass = "EmptySettingsPlugin"
- }
- }
-
- logger.info("Applied $name precompiled plugin as stub")
- }
-}
diff --git a/gradle-conventions-settings/empty/src/main/kotlin/empty-settings.settings.gradle.kts b/gradle-conventions-settings/empty/src/main/kotlin/empty-settings.settings.gradle.kts
deleted file mode 100644
index 01aede8e6..000000000
--- a/gradle-conventions-settings/empty/src/main/kotlin/empty-settings.settings.gradle.kts
+++ /dev/null
@@ -1,5 +0,0 @@
-/*
- * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
- */
-
-// Do not delete this. It is used as a stub plugin for latest-only plugins
diff --git a/gradle-conventions-settings/src/main/kotlin/conventions-repositories.settings.gradle.kts b/gradle-conventions-settings/src/main/kotlin/conventions-repositories.settings.gradle.kts
index 37630bdae..f7c468fb4 100644
--- a/gradle-conventions-settings/src/main/kotlin/conventions-repositories.settings.gradle.kts
+++ b/gradle-conventions-settings/src/main/kotlin/conventions-repositories.settings.gradle.kts
@@ -38,6 +38,7 @@ pluginManagement {
.removeSuffix("/gradle-conventions-settings")
.removeSuffix("/compiler-plugin")
.removeSuffix("/gradle-plugin")
+ .removeSuffix("/dokka-plugin")
)
val localFile = File(propertiesDir, "local.properties")
if (localFile.exists()) {
@@ -100,94 +101,99 @@ pluginManagement {
}
}
-gradle.rootProject {
- fun findGlobalRootDirPath(): java.nio.file.Path {
- var path = file(".").toPath().toAbsolutePath()
+fun findGlobalRootDirPath(): java.nio.file.Path {
+ var path = file(".").toPath().toAbsolutePath()
- // we assume that the 'versions-root' folder can only be present in the root folder
- while (
- java.nio.file.Files.newDirectoryStream(path).use { it.toList() }.none {
- java.nio.file.Files.isDirectory(it) && it.fileName.toString() == "versions-root"
- }
- ) {
- path = path.parent ?: error("Unable to find root path for kotlinx.rpc project")
+ // we assume that the 'versions-root' folder can only be present in the root folder
+ while (
+ java.nio.file.Files.newDirectoryStream(path).use { it.toList() }.none {
+ java.nio.file.Files.isDirectory(it) && it.fileName.toString() == "versions-root"
}
-
- return path
+ ) {
+ path = path.parent ?: error("Unable to find root path for kotlinx.rpc project")
}
- fun logAbsentProperty(name: String): Nothing? {
- logger.info("Property '$name' is not present for repository credentials.")
+ return path
+}
- return null
- }
+fun logAbsentProperty(name: String): Nothing? {
+ logger.info("Property '$name' is not present for repository credentials.")
- fun getEnv(propertyName: String): String? = System.getenv(
- propertyName.replace(".", "_").uppercase()
- )?.ifEmpty { null }
+ return null
+}
- fun getLocalProperties(): java.util.Properties {
- return java.util.Properties().apply {
- val propertiesDir = File(
- rootDir.path
- .removeSuffix("/gradle-conventions")
- .removeSuffix("/gradle-conventions-settings")
- .removeSuffix("/compiler-plugin")
- .removeSuffix("/gradle-plugin")
- )
- val localFile = File(propertiesDir, "local.properties")
- if (localFile.exists()) {
- localFile.inputStream().use { load(it) }
- }
+fun getEnv(propertyName: String): String? = System.getenv(
+ propertyName.replace(".", "_").uppercase()
+)?.ifEmpty { null }
+
+fun getLocalProperties(): java.util.Properties {
+ return java.util.Properties().apply {
+ val propertiesDir = File(
+ rootDir.path
+ .removeSuffix("/gradle-conventions")
+ .removeSuffix("/gradle-conventions-settings")
+ .removeSuffix("/compiler-plugin")
+ .removeSuffix("/gradle-plugin")
+ .removeSuffix("/dokka-plugin")
+ )
+ val localFile = File(propertiesDir, "local.properties")
+ if (localFile.exists()) {
+ localFile.inputStream().use { load(it) }
}
}
+}
- fun java.util.Properties.isUsingProxyRepositories(): Boolean {
- val useProxyProperty = this["kotlinx.rpc.useProxyRepositories"] as String?
- return useProxyProperty == null || useProxyProperty == "true"
- }
+fun java.util.Properties.isUsingProxyRepositories(): Boolean {
+ val useProxyProperty = this["kotlinx.rpc.useProxyRepositories"] as String?
+ return useProxyProperty == null || useProxyProperty == "true"
+}
- fun getSpacePassword(): String? {
- val password = "kotlinx.rpc.team.space.password"
- return getLocalProperties()[password] as String?
- ?: settings.providers.gradleProperty(password).orNull
- ?: getEnv(password)
- ?: logAbsentProperty(password)
- }
+fun getSpacePassword(): String? {
+ val password = "kotlinx.rpc.team.space.password"
+ return getLocalProperties()[password] as String?
+ ?: settings.providers.gradleProperty(password).orNull
+ ?: getEnv(password)
+ ?: logAbsentProperty(password)
+}
- /**
- * Creates a publishing repository targeting Space Packages on jetbrains.team.
- *
- * @param repoName the name of the Space Packages repository
- */
- fun RepositoryHandler.jbTeamPackages(repoName: String) {
- maven {
- name = repoName.split("-").joinToString("") { it.replaceFirstChar { c -> c.titlecase() } }
- url = uri("https://packages.jetbrains.team/maven/p/krpc/$repoName")
+/**
+ * Creates a publishing repository targeting Space Packages on jetbrains.team.
+ *
+ * @param repoName the name of the Space Packages repository
+ */
+fun RepositoryHandler.jbTeamPackages(repoName: String) {
+ maven {
+ name = repoName.split("-").joinToString("") { it.replaceFirstChar { c -> c.titlecase() } }
+ url = uri("https://packages.jetbrains.team/maven/p/krpc/$repoName")
- val spacePassword = getSpacePassword()
+ val spacePassword = getSpacePassword()
- if (spacePassword != null) {
- credentials(HttpHeaderCredentials::class.java) {
- name = "Authorization"
- value = "Bearer $spacePassword"
- }
+ if (spacePassword != null) {
+ credentials(HttpHeaderCredentials::class.java) {
+ name = "Authorization"
+ value = "Bearer $spacePassword"
+ }
- authentication {
- create("http_auth_header")
- }
- } else {
- logger.info("Skipping adding credentials for Space repository '$repoName'")
+ authentication {
+ create("http_auth_header")
}
+ } else {
+ logger.info("Skipping adding credentials for Space repository '$repoName'")
}
}
+}
- fun RepositoryHandler.buildDeps() = jbTeamPackages(repoName = "build-deps")
- fun RepositoryHandler.buildDepsEap() = jbTeamPackages(repoName = "build-deps-eap")
+fun RepositoryHandler.buildDeps() = jbTeamPackages(repoName = "build-deps")
+fun RepositoryHandler.buildDepsEap() = jbTeamPackages(repoName = "build-deps-eap")
- allprojects {
- val localProps = getLocalProperties()
+val localProps = getLocalProperties()
+
+settings.extra["spacePassword"] = getSpacePassword()
+settings.extra["localProperties"] = localProps
+settings.extra["useProxyRepositories"] = localProps.isUsingProxyRepositories()
+gradle.rootProject {
+ allprojects {
this.extra["spacePassword"] = getSpacePassword()
this.extra["localProperties"] = localProps
this.extra["useProxyRepositories"] = localProps.isUsingProxyRepositories()
diff --git a/gradle-conventions-settings/src/main/kotlin/conventions-version-resolution.settings.gradle.kts b/gradle-conventions-settings/src/main/kotlin/conventions-version-resolution.settings.gradle.kts
index 0f07e7fd6..596b91d9a 100644
--- a/gradle-conventions-settings/src/main/kotlin/conventions-version-resolution.settings.gradle.kts
+++ b/gradle-conventions-settings/src/main/kotlin/conventions-version-resolution.settings.gradle.kts
@@ -37,7 +37,6 @@ object SettingsConventions {
const val VERSIONS_ROOT_PATH = "versions-root"
const val LIBS_VERSION_CATALOG_PATH = "$VERSIONS_ROOT_PATH/libs.versions.toml"
- const val KOTLIN_VERSIONS_LOOKUP_PATH = "$VERSIONS_ROOT_PATH/kotlin-versions-lookup.csv"
}
// ### VERSION RESOLVING SECTION ###
@@ -65,47 +64,9 @@ fun findGlobalRootDirPath(start: Path): Path {
}
}
- return path
-}
-
-// Resolves 'versions-root/kotlin-versions-lookup.csv'
-fun loadLookupTable(rootDir: Path, kotlinVersion: String): Pair