Skip to content

Commit

Permalink
Update for IDE configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr3zee committed Feb 6, 2025
1 parent 4d40922 commit 1fabdf4
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 14 deletions.
5 changes: 3 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
Expand All @@ -22,13 +22,14 @@ configureNpm()
configureApiValidation()

val kotlinVersion = rootProject.libs.versions.kotlin.lang.get()
val kotlinCompiler = rootProject.libs.versions.kotlin.compiler.get()

allprojects {
group = "org.jetbrains.kotlinx"
version = rootProject.libs.versions.kotlinx.rpc.get()
}

println("kotlinx.rpc project version: $version, Kotlin version: $kotlinVersion")
println("[Core] kotlinx.rpc project version: $version, Kotlin version: $kotlinVersion, Compiler: $kotlinCompiler")

// If the prefix of the kPRC version is not Kotlin gradle plugin version – you have a problem :)
// Probably some dependency brings kotlin with the later version.
Expand Down
12 changes: 11 additions & 1 deletion compiler-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

import util.otherwise
Expand All @@ -22,3 +22,13 @@ allprojects {
version = "$kotlinLangVersion-$rpcVersion"
}
}

println(
"[Compiler Plugin] kotlinx.rpc project version: $version, " +
"Kotlin version: $kotlinLangVersion, " +
"Compiler version: $kotlinCompilerVersion"
)

whenForIde {
println("For-ide project mode enabled")
}
11 changes: 10 additions & 1 deletion compiler-plugin/compiler-plugin-k2/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* 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
Expand Down Expand Up @@ -50,6 +50,15 @@ val shadowJar = tasks.named<ShadowJar>("shadowJar") {
exclude("org/**")

archiveFileName.set("plugin-k2-for-tests.jar")

/**
* Same problem as above, but in IDE
*/
whenForIde {
archiveClassifier.set("for-ide")
} otherwise {
archiveClassifier.set("tests")
}
}

tasks.jar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import org.jetbrains.kotlin.diagnostics.rendering.RootDiagnosticRendererFactory
import org.jetbrains.kotlin.diagnostics.warning0
import org.jetbrains.kotlin.fir.types.ConeKotlinType
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.KtAnnotationEntry
import org.jetbrains.kotlin.psi.KtAnnotated

object FirRpcDiagnostics {
val MISSING_RPC_ANNOTATION by error0<KtAnnotationEntry>()
val MISSING_SERIALIZATION_MODULE by warning0<KtAnnotationEntry>()
val WRONG_RPC_ANNOTATION_TARGET by error1<KtAnnotationEntry, ConeKotlinType>()
val CHECKED_ANNOTATION_VIOLATION by error1<KtAnnotationEntry, ConeKotlinType>()
val MISSING_RPC_ANNOTATION by error0<KtAnnotated>()
val MISSING_SERIALIZATION_MODULE by warning0<KtAnnotated>()
val WRONG_RPC_ANNOTATION_TARGET by error1<KtAnnotated, ConeKotlinType>()
val CHECKED_ANNOTATION_VIOLATION by error1<KtAnnotated, ConeKotlinType>()
val NON_SUSPENDING_REQUEST_WITHOUT_STREAMING_RETURN_TYPE by error0<PsiElement>()
val AD_HOC_POLYMORPHISM_IN_RPC_SERVICE by error2<PsiElement, Int, Name>()
val TYPE_PARAMETERS_IN_RPC_FUNCTION by error0<PsiElement>(SourceElementPositioningStrategies.TYPE_PARAMETERS_LIST)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ fun VersionCatalogBuilder.resolveKotlinVersion(versionCatalog: Map<String, Strin
}

if (kotlinCompilerVersion != null) {
logger.info("Resolved Kotlin compiler version: $kotlinCompilerVersion")
version(SettingsConventions.KOTLIN_COMPILER_VERSION_ALIAS, kotlinCompilerVersion)
} else {
version(SettingsConventions.KOTLIN_COMPILER_VERSION_ALIAS, kotlinCatalogVersion!!)
Expand Down
4 changes: 2 additions & 2 deletions gradle-conventions/common/src/main/kotlin/util/forIde.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

package util

import org.gradle.api.Project

fun Project.whenForIde(block: () -> Unit): ActionApplied {
val forIdeBuild by optionalProperty()
val forIdeBuild by rootProject.optionalProperty()

if (forIdeBuild) {
block()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

import util.*
Expand Down Expand Up @@ -53,7 +53,7 @@ fun PublishingExtension.configurePublication() {
fixModuleMetadata(project)
}

logger.info("Project ${project.name} -> Publication configured: $name")
logger.info("Project ${project.name} -> Publication configured: $name, $version")
}

tasks.withType<PublishToMavenRepository>().configureEach {
Expand Down
4 changes: 3 additions & 1 deletion gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
Expand Down Expand Up @@ -76,3 +76,5 @@ kotlin {
}
}
}

println("[Gradle Plugin] kotlinx.rpc project version: $version")

0 comments on commit 1fabdf4

Please sign in to comment.