From e2f9af1592b439743e1b033e18d6d93c9349f9d7 Mon Sep 17 00:00:00 2001 From: Anton Lakotka Date: Tue, 23 Jan 2024 19:24:45 +0100 Subject: [PATCH] [Gradle] Revert CompilerArgumentAware including DependencyClasspath This is not necessary and incorrect as it dependencies should not leak to IDE import through this way. So reverting it back to original state. But for KotlinNativeCompileArgumentsTest update context in the same way as in Kotlin2JsCompileArgumentsTest and KotlinCompileArgumentsTest just because KotlinNative Compilation classpath contain stdlib. ^KT-61430 Verification Pending ^KT-61559 Verification Pending --- .../kotlin/gradle/internal/CompilerArgumentAware.kt | 1 - .../Kotlin2JsCompileArgumentsTest.kt | 2 +- .../compilerArgumetns/KotlinCompileArgumentsTest.kt | 2 +- .../KotlinNativeCompileArgumentsTest.kt | 11 ++++++++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/internal/CompilerArgumentAware.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/internal/CompilerArgumentAware.kt index 7e427ddf56a..be09253209f 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/internal/CompilerArgumentAware.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/internal/CompilerArgumentAware.kt @@ -80,6 +80,5 @@ interface CompilerArgumentAware : KotlinCompilerArgumen private val includedArgumentTypes = setOf( ArgumentType.Primitive, - ArgumentType.DependencyClasspath, ArgumentType.PluginClasspath, ) diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/compilerArgumetns/Kotlin2JsCompileArgumentsTest.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/compilerArgumetns/Kotlin2JsCompileArgumentsTest.kt index 2485c0b3993..f83eb8dd792 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/compilerArgumetns/Kotlin2JsCompileArgumentsTest.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/compilerArgumetns/Kotlin2JsCompileArgumentsTest.kt @@ -35,7 +35,7 @@ class Kotlin2JsCompileArgumentsTest { val jsMainCompileTask = jsMainCompilation.compileTaskProvider.get() val argumentsFromCompilerArgumentsProducer = jsMainCompileTask.createCompilerArguments( CreateCompilerArgumentsContext( - includeArgumentTypes = setOf(Primitive, DependencyClasspath, PluginClasspath), + includeArgumentTypes = setOf(Primitive, PluginClasspath), isLenient = true ) ) diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/compilerArgumetns/KotlinCompileArgumentsTest.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/compilerArgumetns/KotlinCompileArgumentsTest.kt index 9f26bb8095c..790e15b9eb8 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/compilerArgumetns/KotlinCompileArgumentsTest.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/compilerArgumetns/KotlinCompileArgumentsTest.kt @@ -50,7 +50,7 @@ class KotlinCompileArgumentsTest { val mainCompilationTask = mainCompilation.compileTaskProvider.get() as KotlinCompile val argumentsFromKotlinCompilerArgumentsAware = mainCompilationTask.createCompilerArguments( CreateCompilerArgumentsContext( - includeArgumentTypes = setOf(Primitive, DependencyClasspath, PluginClasspath), + includeArgumentTypes = setOf(Primitive, PluginClasspath), isLenient = true ) ) diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/compilerArgumetns/KotlinNativeCompileArgumentsTest.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/compilerArgumetns/KotlinNativeCompileArgumentsTest.kt index 7a5c1de6fa8..30e1eedb863 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/compilerArgumetns/KotlinNativeCompileArgumentsTest.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/compilerArgumetns/KotlinNativeCompileArgumentsTest.kt @@ -13,6 +13,10 @@ import org.jetbrains.kotlin.compilerRunner.ArgumentUtils import org.jetbrains.kotlin.gradle.dependencyResolutionTests.mavenCentralCacheRedirector import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension +import org.jetbrains.kotlin.gradle.plugin.CreateCompilerArgumentsContext +import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerArgumentsProducer +import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerArgumentsProducer.ArgumentType.PluginClasspath +import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerArgumentsProducer.ArgumentType.Primitive import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerArgumentsProducer.CreateCompilerArgumentsContext.Companion.default import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerArgumentsProducer.CreateCompilerArgumentsContext.Companion.lenient import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile @@ -52,7 +56,12 @@ class KotlinNativeCompileArgumentsTest { private fun `assert setupCompilerArgs and createCompilerArguments are equal`(compile: KotlinNativeCompile) { - val argumentsFromCompilerArgumentsProducer = compile.createCompilerArguments(lenient) + val argumentsFromCompilerArgumentsProducer = compile.createCompilerArguments( + CreateCompilerArgumentsContext( + includeArgumentTypes = setOf(Primitive, PluginClasspath), + isLenient = true + ) + ) val argumentsFromBuildCompilerArgs = K2NativeCompilerArguments().apply { @Suppress("DEPRECATION_ERROR") compile.setupCompilerArgs(this, false, true)