Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler-plugin/compiler-plugin-backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
plugins {
alias(libs.plugins.conventions.jvm)
alias(libs.plugins.compiler.specific.module)
alias(libs.plugins.conventions.no.psi.element)
}

kotlin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ internal class RpcStubGenerator(
val protobufMessage = owner.getAnnotation(ctx.withCodecAnnotation.owner.kotlinFqName)

return if (protobufMessage != null) {
val classReference = protobufMessage.arguments.single() as? IrClassReference
val classReference = vsApi{ protobufMessage.argumentsVS }.single() as? IrClassReference
?: error("Expected IrClassReference for ${ctx.withCodecAnnotation.owner.kotlinFqName} parameter")

val codec = classReference.classType
Expand Down
1 change: 1 addition & 0 deletions compiler-plugin/compiler-plugin-cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
plugins {
alias(libs.plugins.conventions.jvm)
alias(libs.plugins.compiler.specific.module)
alias(libs.plugins.conventions.no.psi.element)
}

kotlin {
Expand Down
1 change: 1 addition & 0 deletions compiler-plugin/compiler-plugin-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
plugins {
alias(libs.plugins.conventions.jvm)
alias(libs.plugins.compiler.specific.module)
alias(libs.plugins.conventions.no.psi.element)
}

kotlin {
Expand Down
1 change: 1 addition & 0 deletions compiler-plugin/compiler-plugin-k2/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import util.whenKotlinCompilerIsAtLeast
plugins {
alias(libs.plugins.conventions.jvm)
alias(libs.plugins.compiler.specific.module)
alias(libs.plugins.conventions.no.psi.element)
}

tasks.jar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ object FirWithCodecDeclarationChecker {

val codecTargetClass = codecClassSymbol.findMessageCodecSuperType(context.session)
.typeArguments.first().type
?: error("Unexpected unresolved type argument for @WithCodec annotation")

if (codecTargetClass?.classId != declaration.symbol.classId) {
if (codecTargetClass.classId != declaration.symbol.classId) {
reporter.reportOn(
source = withCodec.findArgumentByName(CODEC_ARGUMENT_NAME)?.source,
factory = FirGrpcDiagnostics.CODEC_TYPE_MISMATCH,
a = declaration.symbol.defaultType(),
b = kClassValue,
b = codecTargetClass,
context = context,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ fun registerDiagnosticRendererFactories() {
//##csm specific=[2.0.0...2.2.10]
RootDiagnosticRendererFactory.registerFactory(FirRpcDiagnostics.getRendererFactoryVs())
RootDiagnosticRendererFactory.registerFactory(FirRpcStrictModeDiagnostics.getRendererFactoryVs())
RootDiagnosticRendererFactory.registerFactory(FirGrpcDiagnostics.getRendererFactoryVs())
//##csm /specific
//##csm /registerDiagnosticRendererFactories
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

import kotlin.io.path.readLines

gradle.afterProject {
layout.projectDirectory.dir("src").asFileTree.visit {
if (isDirectory) return@visit
if (file.name.endsWith(".kt")) {
file.toPath().readLines().forEach { line ->
if (!line.trim().startsWith("//") && line.contains("PsiElement")) {
throw GradleException(
"Kotlin source file $file must not contain `PsiElement` reference " +
"in the compiler plugin. Use KtElement instead."
)
}
}
}
}
}
1 change: 1 addition & 0 deletions versions-root/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ conventions-npm = { id = "conventions-npm" }
conventions-root = { id = "conventions-root" }
conventions-dokka-spec = { id = "conventions-dokka-spec" }
conventions-dokka-public = { id = "conventions-dokka-public" }
conventions-no-psi-element = { id = "conventions-no-psi-element" }
compiler-specific-module = { id = "compiler-specific-module" }

# gradle-plugin project
Expand Down
Loading