[Gradle] IdeCompilerArgumentsResolver: Do not resolve compile tasks DependencyClasspath
as it is not needed for JPS builds. JPS will build the classpath by reading the IJ project model. Classpath entries added as freeCompilerArgs will still be forwarded KTIJ-25227
This commit is contained in:
committed by
Space Team
parent
62df30134f
commit
9309a864ce
+1
-1
@@ -21,7 +21,7 @@ interface IdeCompilerArgumentsResolver {
|
||||
@JvmStatic
|
||||
fun instance(project: Project): IdeCompilerArgumentsResolver {
|
||||
return project.extraProperties.getOrPut(IdeCompilerArgumentsResolver::class.java.name) {
|
||||
IdeCompilerArgumentsResolverImpl(project.kotlinExtension)
|
||||
IdeCompilerArgumentsResolverImpl()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-20
@@ -6,17 +6,11 @@
|
||||
package org.jetbrains.kotlin.gradle.plugin.ide
|
||||
|
||||
import org.jetbrains.kotlin.compilerRunner.toArgumentStrings
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
|
||||
import org.jetbrains.kotlin.gradle.plugin.CreateCompilerArgumentsContext
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerArgumentsProducer
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import org.jetbrains.kotlin.gradle.utils.hasAndroidPlugin
|
||||
|
||||
internal class IdeCompilerArgumentsResolverImpl(
|
||||
private val extension: KotlinProjectExtension
|
||||
) : IdeCompilerArgumentsResolver {
|
||||
internal class IdeCompilerArgumentsResolverImpl : IdeCompilerArgumentsResolver {
|
||||
|
||||
override fun resolveCompilerArguments(any: Any): List<String>? {
|
||||
return when (any) {
|
||||
@@ -30,25 +24,13 @@ internal class IdeCompilerArgumentsResolverImpl(
|
||||
val compilerArguments = producer.createCompilerArguments(
|
||||
CreateCompilerArgumentsContext(
|
||||
isLenient = true,
|
||||
includeArgumentTypes = setOfNotNull(
|
||||
includeArgumentTypes = setOf(
|
||||
KotlinCompilerArgumentsProducer.ArgumentType.Primitive,
|
||||
|
||||
/*
|
||||
Always resolve the plugin classpath: This is still consumed by the associated IDE plugins.
|
||||
e.g: the kotlinx.serialisation IDE plugin relies on this classpath.
|
||||
*/
|
||||
KotlinCompilerArgumentsProducer.ArgumentType.PluginClasspath,
|
||||
|
||||
/*
|
||||
Dependency Classpath is required for IDE import to provide the ability to compile
|
||||
the given Gradle project using 'jps'. This is only supported by the jvm Kotlin plugin
|
||||
and does not work for Multiplatform or Android projects:
|
||||
Therefore, we omit the classpath for multiplatform and Android projects
|
||||
*/
|
||||
KotlinCompilerArgumentsProducer.ArgumentType.DependencyClasspath
|
||||
.takeIf { extension !is KotlinMultiplatformExtension }
|
||||
.takeIf { producer is KotlinCompile }
|
||||
.takeIf { !extension.project.hasAndroidPlugin }
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user