[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
This commit is contained in:
Anton Lakotka
2024-01-23 19:24:45 +01:00
committed by Space Team
parent e4b760370f
commit e2f9af1592
4 changed files with 12 additions and 4 deletions
@@ -80,6 +80,5 @@ interface CompilerArgumentAware<T : CommonToolArguments> : KotlinCompilerArgumen
private val includedArgumentTypes = setOf( private val includedArgumentTypes = setOf(
ArgumentType.Primitive, ArgumentType.Primitive,
ArgumentType.DependencyClasspath,
ArgumentType.PluginClasspath, ArgumentType.PluginClasspath,
) )
@@ -35,7 +35,7 @@ class Kotlin2JsCompileArgumentsTest {
val jsMainCompileTask = jsMainCompilation.compileTaskProvider.get() val jsMainCompileTask = jsMainCompilation.compileTaskProvider.get()
val argumentsFromCompilerArgumentsProducer = jsMainCompileTask.createCompilerArguments( val argumentsFromCompilerArgumentsProducer = jsMainCompileTask.createCompilerArguments(
CreateCompilerArgumentsContext( CreateCompilerArgumentsContext(
includeArgumentTypes = setOf(Primitive, DependencyClasspath, PluginClasspath), includeArgumentTypes = setOf(Primitive, PluginClasspath),
isLenient = true isLenient = true
) )
) )
@@ -50,7 +50,7 @@ class KotlinCompileArgumentsTest {
val mainCompilationTask = mainCompilation.compileTaskProvider.get() as KotlinCompile val mainCompilationTask = mainCompilation.compileTaskProvider.get() as KotlinCompile
val argumentsFromKotlinCompilerArgumentsAware = mainCompilationTask.createCompilerArguments( val argumentsFromKotlinCompilerArgumentsAware = mainCompilationTask.createCompilerArguments(
CreateCompilerArgumentsContext( CreateCompilerArgumentsContext(
includeArgumentTypes = setOf(Primitive, DependencyClasspath, PluginClasspath), includeArgumentTypes = setOf(Primitive, PluginClasspath),
isLenient = true isLenient = true
) )
) )
@@ -13,6 +13,10 @@ import org.jetbrains.kotlin.compilerRunner.ArgumentUtils
import org.jetbrains.kotlin.gradle.dependencyResolutionTests.mavenCentralCacheRedirector import org.jetbrains.kotlin.gradle.dependencyResolutionTests.mavenCentralCacheRedirector
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension 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.default
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerArgumentsProducer.CreateCompilerArgumentsContext.Companion.lenient import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerArgumentsProducer.CreateCompilerArgumentsContext.Companion.lenient
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile
@@ -52,7 +56,12 @@ class KotlinNativeCompileArgumentsTest {
private fun `assert setupCompilerArgs and createCompilerArguments are equal`(compile: KotlinNativeCompile) { 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 { val argumentsFromBuildCompilerArgs = K2NativeCompilerArguments().apply {
@Suppress("DEPRECATION_ERROR") @Suppress("DEPRECATION_ERROR")
compile.setupCompilerArgs(this, false, true) compile.setupCompilerArgs(this, false, true)