summaryrefslogtreecommitdiff
path: root/plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration')
-rw-r--r--plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/KotlinMPPDataNodes.kt15
-rw-r--r--plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/cachedCompilerArgumentsRestoring.kt9
-rw-r--r--plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/utils/KotlinSourceSetGraphUtil.kt4
3 files changed, 20 insertions, 8 deletions
diff --git a/plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/KotlinMPPDataNodes.kt b/plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/KotlinMPPDataNodes.kt
index 05c85ef67b56..91b71885b001 100644
--- a/plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/KotlinMPPDataNodes.kt
+++ b/plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/KotlinMPPDataNodes.kt
@@ -16,10 +16,7 @@ import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.config.ExternalSystemRunTask
import org.jetbrains.kotlin.idea.gradleTooling.KotlinImportingDiagnosticsContainer
import org.jetbrains.kotlin.idea.gradleTooling.KotlinPlatformContainerImpl
-import org.jetbrains.kotlin.idea.projectModel.KonanArtifactModel
-import org.jetbrains.kotlin.idea.projectModel.KotlinModule
-import org.jetbrains.kotlin.idea.projectModel.KotlinPlatform
-import org.jetbrains.kotlin.idea.projectModel.KotlinPlatformContainer
+import org.jetbrains.kotlin.idea.projectModel.*
import org.jetbrains.kotlin.idea.util.CopyableDataNodeUserDataProperty
import org.jetbrains.plugins.gradle.util.GradleConstants
import java.io.File
@@ -40,7 +37,15 @@ val DataNode<out ModuleData>.kotlinSourceSetData: KotlinSourceSetData?
val DataNode<out ModuleData>.kotlinAndroidSourceSets: List<KotlinSourceSetInfo>?
get() = ExternalSystemApiUtil.getChildren(this, KotlinAndroidSourceSetData.KEY).firstOrNull()?.data?.sourceSetInfos
-class KotlinSourceSetInfo @PropertyMapping("kotlinModule") constructor(val kotlinModule: KotlinModule) : Serializable {
+class KotlinSourceSetInfo @PropertyMapping("kotlinComponent") constructor(val kotlinComponent: KotlinComponent) : Serializable {
+ @Suppress("DEPRECATION_ERROR")
+ @Deprecated(
+ level = DeprecationLevel.WARNING,
+ message = "Use KotlinSourceSetInfo#kotlinComponent instead",
+ replaceWith = ReplaceWith("kotlinComponent")
+ )
+ val kotlinModule: KotlinModule
+ get() = kotlinComponent
var moduleId: String? = null
var gradleModuleId: String = ""
diff --git a/plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/cachedCompilerArgumentsRestoring.kt b/plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/cachedCompilerArgumentsRestoring.kt
index b309d62bd21c..c60a5c884a44 100644
--- a/plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/cachedCompilerArgumentsRestoring.kt
+++ b/plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/cachedCompilerArgumentsRestoring.kt
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.idea.projectModel.ArgsInfo
import org.jetbrains.kotlin.idea.projectModel.CompilerArgumentsCacheAware
import org.jetbrains.kotlin.idea.projectModel.KotlinCachedCompilerArgument
import org.jetbrains.kotlin.idea.projectModel.KotlinRawCompilerArgument
+import org.jetbrains.kotlin.platform.impl.FakeK2NativeCompilerArguments
import java.io.File
import kotlin.reflect.KMutableProperty1
import kotlin.reflect.KProperty1
@@ -48,6 +49,7 @@ class EmptyFlatArgsInfo : FlatSerializedArgsInfo {
object CachedArgumentsRestoring {
private val LOGGER = Logger.getInstance(CachedArgumentsRestoring.javaClass)
+ private const val STUB_K_2_NATIVE_COMPILER_ARGUMENTS_CLASS = "org.jetbrains.kotlin.gradle.tasks.StubK2NativeCompilerArguments"
fun restoreSerializedArgsInfo(
cachedSerializedArgsInfo: CachedSerializedArgsInfo,
compilerArgumentsCacheHolder: CompilerArgumentsCacheHolder
@@ -102,7 +104,12 @@ object CachedArgumentsRestoring {
LOGGER.error("Failed to restore name of compiler arguments class from id $it! 'CommonCompilerArguments' instance was created instead")
}
}
- val compilerArgumentsClass = Class.forName(compilerArgumentsClassName) as Class<out CommonCompilerArguments>
+ //TODO: Fixup. Remove it once actual K2NativeCompilerArguments will be available without 'kotlin.native.enabled = true' flag
+ val compilerArgumentsClass = if (compilerArgumentsClassName == STUB_K_2_NATIVE_COMPILER_ARGUMENTS_CLASS)
+ FakeK2NativeCompilerArguments::class.java
+ else
+ Class.forName(compilerArgumentsClassName) as Class<out CommonCompilerArguments>
+
val newCompilerArgumentsBean = compilerArgumentsClass.getConstructor().newInstance()
val propertiesByName = compilerArgumentsClass.kotlin.memberProperties.associateBy { it.name }
cachedBucket.singleArguments.entries.mapNotNull {
diff --git a/plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/utils/KotlinSourceSetGraphUtil.kt b/plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/utils/KotlinSourceSetGraphUtil.kt
index 52c5f6883809..c815adddb5a6 100644
--- a/plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/utils/KotlinSourceSetGraphUtil.kt
+++ b/plugins/kotlin/gradle/gradle-idea/src/org/jetbrains/kotlin/idea/gradle/configuration/utils/KotlinSourceSetGraphUtil.kt
@@ -43,7 +43,7 @@ fun createSourceSetDependsOnGraph(
fun MutableGraph<KotlinSourceSet>.putInferredTestToProductionEdges() {
val sourceSets = this.nodes()
for (sourceSet in sourceSets) {
- if (sourceSet.isTestModule) {
+ if (sourceSet.isTestComponent) {
@OptIn(UnsafeTestSourceSetHeuristicApi::class)
val predictedMainSourceSetName = predictedProductionSourceSetName(sourceSet.name)
val predictedMainSourceSet = sourceSets.firstOrNull { it.name == predictedMainSourceSetName } ?: continue
@@ -63,7 +63,7 @@ private fun getFixedDependsOnSourceSets(
val implicitDependsOnEdgeForAndroid = if (
sourceSet.actualPlatforms.contains(KotlinPlatform.ANDROID) && sourceSet.declaredDependsOnSourceSets.isEmpty()
) {
- val commonSourceSetName = if (sourceSet.isTestModule) KotlinSourceSet.COMMON_TEST_SOURCE_SET_NAME
+ val commonSourceSetName = if (sourceSet.isTestComponent) KotlinSourceSet.COMMON_TEST_SOURCE_SET_NAME
else KotlinSourceSet.COMMON_MAIN_SOURCE_SET_NAME
listOfNotNull(sourceSetsByName[commonSourceSetName])
} else emptyList()