[FIR] Let OptIn LV checker only run on last module in HMPP compilation
This fixes an issue where the opt-in annotation is defined in one of the source sets of the compilation but opt-ins are defined for the whole compilation which leads to false-positive "Opt-in requirement marker is unresolved" in (e.g. common) source sets that don't have a dependency on the module that contains the annotation. #KT-60755 Fixed
This commit is contained in:
committed by
Space Team
parent
2719dd188f
commit
8ae751926c
+18
@@ -137,4 +137,22 @@ class CustomK2Tests : KGPBaseTest() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@GradleTest
|
||||
@DisplayName("All source sets have opt-in for annotation defined in platform source set. KT-60755")
|
||||
fun kt60755OptInDefinedInPlatform(gradleVersion: GradleVersion) {
|
||||
with(
|
||||
project(
|
||||
"k2-mpp-opt-in-in-platform",
|
||||
gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(languageVersion = "2.0"),
|
||||
)
|
||||
) {
|
||||
val taskToExecute = ":compileKotlinJvm"
|
||||
build(taskToExecute) {
|
||||
assertTasksExecuted(taskToExecute)
|
||||
assertOutputDoesNotContain("Opt-in requirement marker foo.bar.MyOptIn is unresolved")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
|
||||
sourceSets {
|
||||
all {
|
||||
languageSettings.optIn("foo.bar.MyOptIn")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
kotlin.stdlib.default.dependency=false
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package foo.bar
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.ERROR)
|
||||
annotation class MyOptIn
|
||||
Reference in New Issue
Block a user