[KPM] Remove IdeaKotlinModuleIdentifier in favor of consistent IdeaKotlinFragmentCoordinates
KT-51386
This commit is contained in:
committed by
Space
parent
ef3a3d71b9
commit
1a0d8f777c
+43
-42
@@ -93,23 +93,48 @@ public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinD
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinDependencyKt {
|
public final class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinDependencyKt {
|
||||||
public static final fun getPath (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceCoordinates;)Ljava/lang/String;
|
|
||||||
public static final fun isClasspathType (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinResolvedBinaryDependency;)Z
|
public static final fun isClasspathType (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinResolvedBinaryDependency;)Z
|
||||||
public static final fun isDocumentationType (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinResolvedBinaryDependency;)Z
|
public static final fun isDocumentationType (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinResolvedBinaryDependency;)Z
|
||||||
public static final fun isSourcesType (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinResolvedBinaryDependency;)Z
|
public static final fun isSourcesType (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinResolvedBinaryDependency;)Z
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragment : java/io/Serializable {
|
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragment : java/io/Serializable {
|
||||||
|
public abstract fun getCoordinates ()Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentCoordinates;
|
||||||
public abstract fun getDependencies ()Ljava/util/List;
|
public abstract fun getDependencies ()Ljava/util/List;
|
||||||
public abstract fun getExternal ()Lorg/jetbrains/kotlin/gradle/kpm/KotlinExternalModelContainer;
|
public abstract fun getExternal ()Lorg/jetbrains/kotlin/gradle/kpm/KotlinExternalModelContainer;
|
||||||
public abstract fun getLanguageSettings ()Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinLanguageSettings;
|
public abstract fun getLanguageSettings ()Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinLanguageSettings;
|
||||||
public abstract fun getModuleIdentifier ()Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModuleIdentifier;
|
|
||||||
public abstract fun getName ()Ljava/lang/String;
|
|
||||||
public abstract fun getPlatforms ()Ljava/util/Set;
|
public abstract fun getPlatforms ()Ljava/util/Set;
|
||||||
public abstract fun getResourceDirectories ()Ljava/util/List;
|
public abstract fun getResourceDirectories ()Ljava/util/List;
|
||||||
public abstract fun getSourceDirectories ()Ljava/util/List;
|
public abstract fun getSourceDirectories ()Ljava/util/List;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentCoordinates : java/io/Serializable, org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinDependencyCoordinates {
|
||||||
|
public abstract fun getFragmentName ()Ljava/lang/String;
|
||||||
|
public abstract fun getModule ()Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModuleCoordinates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentCoordinatesKt {
|
||||||
|
public static final fun getPath (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentCoordinates;)Ljava/lang/String;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentDependency : org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinDependency {
|
||||||
|
public abstract fun getCoordinates ()Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentCoordinates;
|
||||||
|
public abstract fun getType ()Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentDependency$Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentDependency$Type : java/lang/Enum, java/io/Serializable {
|
||||||
|
public static final field Companion Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentDependency$Type$Companion;
|
||||||
|
public static final field Friend Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentDependency$Type;
|
||||||
|
public static final field Refines Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentDependency$Type;
|
||||||
|
public static final field Regular Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentDependency$Type;
|
||||||
|
public static fun valueOf (Ljava/lang/String;)Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentDependency$Type;
|
||||||
|
public static fun values ()[Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentDependency$Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragmentKt {
|
||||||
|
public static final fun getName (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinFragment;)Ljava/lang/String;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinJsPlatformDetails : org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinPlatformDetails {
|
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinJsPlatformDetails : org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinPlatformDetails {
|
||||||
public abstract fun isIr ()Z
|
public abstract fun isIr ()Z
|
||||||
}
|
}
|
||||||
@@ -129,24 +154,26 @@ public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinL
|
|||||||
public abstract fun isProgressiveMode ()Z
|
public abstract fun isProgressiveMode ()Z
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinLocalModuleIdentifier : org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModuleIdentifier {
|
|
||||||
public abstract fun getBuildId ()Ljava/lang/String;
|
|
||||||
public abstract fun getProjectId ()Ljava/lang/String;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinMavenModuleIdentifier : org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModuleIdentifier {
|
|
||||||
public abstract fun getGroup ()Ljava/lang/String;
|
|
||||||
public abstract fun getName ()Ljava/lang/String;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModule : java/io/Serializable {
|
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModule : java/io/Serializable {
|
||||||
|
public abstract fun getCoordinates ()Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModuleCoordinates;
|
||||||
public abstract fun getFragments ()Ljava/util/List;
|
public abstract fun getFragments ()Ljava/util/List;
|
||||||
public abstract fun getModuleIdentifier ()Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModuleIdentifier;
|
|
||||||
public abstract fun getName ()Ljava/lang/String;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModuleIdentifier : java/io/Serializable {
|
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModuleCoordinates : java/io/Serializable {
|
||||||
|
public abstract fun getBuildId ()Ljava/lang/String;
|
||||||
public abstract fun getModuleClassifier ()Ljava/lang/String;
|
public abstract fun getModuleClassifier ()Ljava/lang/String;
|
||||||
|
public abstract fun getModuleName ()Ljava/lang/String;
|
||||||
|
public abstract fun getProjectName ()Ljava/lang/String;
|
||||||
|
public abstract fun getProjectPath ()Ljava/lang/String;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModuleCoordinatesKt {
|
||||||
|
public static final fun getPath (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModuleCoordinates;)Ljava/lang/String;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModuleKt {
|
||||||
|
public static final fun getModuleClassifier (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModule;)Ljava/lang/String;
|
||||||
|
public static final fun getName (Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinModule;)Ljava/lang/String;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinNativePlatformDetails : org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinPlatformDetails {
|
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinNativePlatformDetails : org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinPlatformDetails {
|
||||||
@@ -201,32 +228,6 @@ public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinR
|
|||||||
public abstract fun getFile ()Ljava/io/File;
|
public abstract fun getFile ()Ljava/io/File;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceCoordinates : org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinDependencyCoordinates {
|
|
||||||
public abstract fun getBuildId ()Ljava/lang/String;
|
|
||||||
public abstract fun getKotlinFragmentName ()Ljava/lang/String;
|
|
||||||
public abstract fun getKotlinModuleClassifier ()Ljava/lang/String;
|
|
||||||
public abstract fun getKotlinModuleName ()Ljava/lang/String;
|
|
||||||
public abstract fun getProjectName ()Ljava/lang/String;
|
|
||||||
public abstract fun getProjectPath ()Ljava/lang/String;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceCoordinatesImpl$Companion {
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceDependency : org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinDependency {
|
|
||||||
public abstract fun getCoordinates ()Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceCoordinates;
|
|
||||||
public abstract fun getType ()Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceDependency$Type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceDependency$Type : java/lang/Enum, java/io/Serializable {
|
|
||||||
public static final field Companion Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceDependency$Type$Companion;
|
|
||||||
public static final field Friend Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceDependency$Type;
|
|
||||||
public static final field Refines Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceDependency$Type;
|
|
||||||
public static final field Regular Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceDependency$Type;
|
|
||||||
public static fun valueOf (Ljava/lang/String;)Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceDependency$Type;
|
|
||||||
public static fun values ()[Lorg/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceDependency$Type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceDirectory : java/io/Serializable {
|
public abstract interface class org/jetbrains/kotlin/gradle/kpm/idea/IdeaKotlinSourceDirectory : java/io/Serializable {
|
||||||
public abstract fun getFile ()Ljava/io/File;
|
public abstract fun getFile ()Ljava/io/File;
|
||||||
}
|
}
|
||||||
|
|||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2022 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 org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
|
sealed interface IdeaKotlinBinaryCoordinates : IdeaKotlinDependencyCoordinates {
|
||||||
|
val group: String
|
||||||
|
val module: String
|
||||||
|
val version: String
|
||||||
|
val kotlinModuleName: String?
|
||||||
|
val kotlinFragmentName: String?
|
||||||
|
}
|
||||||
|
|
||||||
|
@InternalKotlinGradlePluginApi
|
||||||
|
data class IdeaKotlinBinaryCoordinatesImpl(
|
||||||
|
override val group: String,
|
||||||
|
override val module: String,
|
||||||
|
override val version: String,
|
||||||
|
override val kotlinModuleName: String? = null,
|
||||||
|
override val kotlinFragmentName: String? = null
|
||||||
|
) : IdeaKotlinBinaryCoordinates {
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "$group:$module:$version" +
|
||||||
|
(if (kotlinModuleName != null) ":$kotlinModuleName" else "") +
|
||||||
|
(if (kotlinFragmentName != null) ":$kotlinFragmentName" else "")
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val serialVersionUID = 0L
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-65
@@ -26,18 +26,7 @@ sealed interface IdeaKotlinDependency : Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed interface IdeaKotlinDependencyCoordinates : Serializable
|
sealed interface IdeaKotlinFragmentDependency : IdeaKotlinDependency {
|
||||||
|
|
||||||
sealed interface IdeaKotlinSourceCoordinates : IdeaKotlinDependencyCoordinates {
|
|
||||||
val buildId: String
|
|
||||||
val projectPath: String
|
|
||||||
val projectName: String
|
|
||||||
val kotlinModuleName: String
|
|
||||||
val kotlinModuleClassifier: String?
|
|
||||||
val kotlinFragmentName: String
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed interface IdeaKotlinSourceDependency : IdeaKotlinDependency {
|
|
||||||
enum class Type : Serializable {
|
enum class Type : Serializable {
|
||||||
Regular, Friend, Refines;
|
Regular, Friend, Refines;
|
||||||
|
|
||||||
@@ -48,15 +37,7 @@ sealed interface IdeaKotlinSourceDependency : IdeaKotlinDependency {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val type: Type
|
val type: Type
|
||||||
override val coordinates: IdeaKotlinSourceCoordinates
|
override val coordinates: IdeaKotlinFragmentCoordinates
|
||||||
}
|
|
||||||
|
|
||||||
sealed interface IdeaKotlinBinaryCoordinates : IdeaKotlinDependencyCoordinates {
|
|
||||||
val group: String
|
|
||||||
val module: String
|
|
||||||
val version: String
|
|
||||||
val kotlinModuleName: String?
|
|
||||||
val kotlinFragmentName: String?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed interface IdeaKotlinBinaryDependency : IdeaKotlinDependency {
|
sealed interface IdeaKotlinBinaryDependency : IdeaKotlinDependency {
|
||||||
@@ -77,11 +58,11 @@ val IdeaKotlinResolvedBinaryDependency.isDocumentationType get() = binaryType ==
|
|||||||
val IdeaKotlinResolvedBinaryDependency.isClasspathType get() = binaryType == CLASSPATH_BINARY_TYPE
|
val IdeaKotlinResolvedBinaryDependency.isClasspathType get() = binaryType == CLASSPATH_BINARY_TYPE
|
||||||
|
|
||||||
@InternalKotlinGradlePluginApi
|
@InternalKotlinGradlePluginApi
|
||||||
data class IdeaKotlinSourceDependencyImpl(
|
data class IdeaKotlinFragmentDependencyImpl(
|
||||||
override val type: IdeaKotlinSourceDependency.Type,
|
override val type: IdeaKotlinFragmentDependency.Type,
|
||||||
override val coordinates: IdeaKotlinSourceCoordinates,
|
override val coordinates: IdeaKotlinFragmentCoordinates,
|
||||||
override val external: KotlinExternalModelContainer = KotlinExternalModelContainer.Empty,
|
override val external: KotlinExternalModelContainer = KotlinExternalModelContainer.Empty,
|
||||||
) : IdeaKotlinSourceDependency {
|
) : IdeaKotlinFragmentDependency {
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
@@ -94,46 +75,6 @@ data class IdeaKotlinSourceDependencyImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@InternalKotlinGradlePluginApi
|
|
||||||
data class IdeaKotlinBinaryCoordinatesImpl(
|
|
||||||
override val group: String,
|
|
||||||
override val module: String,
|
|
||||||
override val version: String,
|
|
||||||
override val kotlinModuleName: String? = null,
|
|
||||||
override val kotlinFragmentName: String? = null
|
|
||||||
) : IdeaKotlinBinaryCoordinates {
|
|
||||||
|
|
||||||
override fun toString(): String {
|
|
||||||
return "$group:$module:$version" +
|
|
||||||
(if (kotlinModuleName != null) ":$kotlinModuleName" else "") +
|
|
||||||
(if (kotlinFragmentName != null) ":$kotlinFragmentName" else "")
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val serialVersionUID = 0L
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@InternalKotlinGradlePluginApi
|
|
||||||
data class IdeaKotlinSourceCoordinatesImpl(
|
|
||||||
override val buildId: String,
|
|
||||||
override val projectPath: String,
|
|
||||||
override val projectName: String,
|
|
||||||
override val kotlinModuleName: String,
|
|
||||||
override val kotlinModuleClassifier: String?,
|
|
||||||
override val kotlinFragmentName: String
|
|
||||||
) : IdeaKotlinSourceCoordinates {
|
|
||||||
|
|
||||||
override fun toString(): String = path
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val serialVersionUID = 0L
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val IdeaKotlinSourceCoordinates.path: String
|
|
||||||
get() = "${buildId.takeIf { it != ":" }.orEmpty()}$projectPath/$kotlinModuleName/$kotlinFragmentName"
|
|
||||||
|
|
||||||
@InternalKotlinGradlePluginApi
|
@InternalKotlinGradlePluginApi
|
||||||
data class IdeaKotlinResolvedBinaryDependencyImpl(
|
data class IdeaKotlinResolvedBinaryDependencyImpl(
|
||||||
override val coordinates: IdeaKotlinBinaryCoordinates?,
|
override val coordinates: IdeaKotlinBinaryCoordinates?,
|
||||||
|
|||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2022 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 org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
sealed interface IdeaKotlinDependencyCoordinates : Serializable
|
||||||
+5
-4
@@ -9,8 +9,7 @@ import org.jetbrains.kotlin.gradle.kpm.KotlinExternalModelContainer
|
|||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
interface IdeaKotlinFragment : Serializable {
|
interface IdeaKotlinFragment : Serializable {
|
||||||
val name: String
|
val coordinates: IdeaKotlinFragmentCoordinates
|
||||||
val moduleIdentifier: IdeaKotlinModuleIdentifier
|
|
||||||
val platforms: Set<IdeaKotlinPlatform>
|
val platforms: Set<IdeaKotlinPlatform>
|
||||||
val languageSettings: IdeaKotlinLanguageSettings?
|
val languageSettings: IdeaKotlinLanguageSettings?
|
||||||
val dependencies: List<IdeaKotlinDependency>
|
val dependencies: List<IdeaKotlinDependency>
|
||||||
@@ -19,10 +18,11 @@ interface IdeaKotlinFragment : Serializable {
|
|||||||
val external: KotlinExternalModelContainer
|
val external: KotlinExternalModelContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val IdeaKotlinFragment.name get() = coordinates.fragmentName
|
||||||
|
|
||||||
@InternalKotlinGradlePluginApi
|
@InternalKotlinGradlePluginApi
|
||||||
data class IdeaKotlinFragmentImpl(
|
data class IdeaKotlinFragmentImpl(
|
||||||
override val name: String,
|
override val coordinates: IdeaKotlinFragmentCoordinates,
|
||||||
override val moduleIdentifier: IdeaKotlinModuleIdentifier,
|
|
||||||
override val platforms: Set<IdeaKotlinPlatform>,
|
override val platforms: Set<IdeaKotlinPlatform>,
|
||||||
override val languageSettings: IdeaKotlinLanguageSettings?,
|
override val languageSettings: IdeaKotlinLanguageSettings?,
|
||||||
override val dependencies: List<IdeaKotlinDependency>,
|
override val dependencies: List<IdeaKotlinDependency>,
|
||||||
@@ -36,3 +36,4 @@ data class IdeaKotlinFragmentImpl(
|
|||||||
private const val serialVersionUID = 0L
|
private const val serialVersionUID = 0L
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2022 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 org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
sealed interface IdeaKotlinFragmentCoordinates : Serializable, IdeaKotlinDependencyCoordinates {
|
||||||
|
val module: IdeaKotlinModuleCoordinates
|
||||||
|
val fragmentName: String
|
||||||
|
}
|
||||||
|
|
||||||
|
@InternalKotlinGradlePluginApi
|
||||||
|
data class IdeaKotlinFragmentCoordinatesImpl(
|
||||||
|
override val module: IdeaKotlinModuleCoordinates,
|
||||||
|
override val fragmentName: String
|
||||||
|
) : IdeaKotlinFragmentCoordinates {
|
||||||
|
|
||||||
|
override fun toString(): String = path
|
||||||
|
|
||||||
|
@InternalKotlinGradlePluginApi
|
||||||
|
companion object {
|
||||||
|
private const val serialVersionUID = 0L
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val IdeaKotlinFragmentCoordinates.path: String
|
||||||
|
get() = "${module.path}/$fragmentName"
|
||||||
+6
-4
@@ -8,15 +8,17 @@ package org.jetbrains.kotlin.gradle.kpm.idea
|
|||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
interface IdeaKotlinModule : Serializable {
|
interface IdeaKotlinModule : Serializable {
|
||||||
val name: String
|
val coordinates: IdeaKotlinModuleCoordinates
|
||||||
val moduleIdentifier: IdeaKotlinModuleIdentifier
|
|
||||||
val fragments: List<IdeaKotlinFragment>
|
val fragments: List<IdeaKotlinFragment>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val IdeaKotlinModule.name get() = coordinates.moduleName
|
||||||
|
|
||||||
|
val IdeaKotlinModule.moduleClassifier get() = coordinates.moduleClassifier
|
||||||
|
|
||||||
@InternalKotlinGradlePluginApi
|
@InternalKotlinGradlePluginApi
|
||||||
data class IdeaKotlinModuleImpl(
|
data class IdeaKotlinModuleImpl(
|
||||||
override val name: String,
|
override val coordinates: IdeaKotlinModuleCoordinates,
|
||||||
override val moduleIdentifier: IdeaKotlinModuleIdentifier,
|
|
||||||
override val fragments: List<IdeaKotlinFragment>
|
override val fragments: List<IdeaKotlinFragment>
|
||||||
) : IdeaKotlinModule {
|
) : IdeaKotlinModule {
|
||||||
|
|
||||||
|
|||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2022 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 org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
interface IdeaKotlinModuleCoordinates : Serializable {
|
||||||
|
val buildId: String
|
||||||
|
val projectPath: String
|
||||||
|
val projectName: String
|
||||||
|
val moduleName: String
|
||||||
|
val moduleClassifier: String?
|
||||||
|
}
|
||||||
|
|
||||||
|
val IdeaKotlinModuleCoordinates.path: String
|
||||||
|
get() = "${buildId.takeIf { it != ":" }.orEmpty()}$projectPath/$moduleName"
|
||||||
|
|
||||||
|
@InternalKotlinGradlePluginApi
|
||||||
|
data class IdeaKotlinModuleCoordinatesImpl(
|
||||||
|
override val buildId: String,
|
||||||
|
override val projectPath: String,
|
||||||
|
override val projectName: String,
|
||||||
|
override val moduleName: String,
|
||||||
|
override val moduleClassifier: String?
|
||||||
|
) : IdeaKotlinModuleCoordinates {
|
||||||
|
|
||||||
|
@InternalKotlinGradlePluginApi
|
||||||
|
companion object {
|
||||||
|
private const val serialVersionUID = 0L
|
||||||
|
}
|
||||||
|
}
|
||||||
-48
@@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2022 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 org.jetbrains.kotlin.gradle.kpm.idea
|
|
||||||
|
|
||||||
import java.io.Serializable
|
|
||||||
|
|
||||||
interface IdeaKotlinModuleIdentifier : Serializable {
|
|
||||||
val moduleClassifier: String?
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IdeaKotlinLocalModuleIdentifier : IdeaKotlinModuleIdentifier {
|
|
||||||
val buildId: String
|
|
||||||
val projectId: String
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IdeaKotlinMavenModuleIdentifier : IdeaKotlinModuleIdentifier {
|
|
||||||
val group: String
|
|
||||||
val name: String
|
|
||||||
}
|
|
||||||
|
|
||||||
@InternalKotlinGradlePluginApi
|
|
||||||
data class IdeaKotlinLocalModuleIdentifierImpl(
|
|
||||||
override val moduleClassifier: String?,
|
|
||||||
override val buildId: String,
|
|
||||||
override val projectId: String
|
|
||||||
) : IdeaKotlinLocalModuleIdentifier {
|
|
||||||
|
|
||||||
@InternalKotlinGradlePluginApi
|
|
||||||
companion object {
|
|
||||||
private const val serialVersionUID = 0L
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@InternalKotlinGradlePluginApi
|
|
||||||
data class IdeaKotlinMavenModuleIdentifierImpl(
|
|
||||||
override val moduleClassifier: String?,
|
|
||||||
override val group: String,
|
|
||||||
override val name: String
|
|
||||||
) : IdeaKotlinMavenModuleIdentifier {
|
|
||||||
|
|
||||||
@InternalKotlinGradlePluginApi
|
|
||||||
companion object {
|
|
||||||
private const val serialVersionUID = 0L
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+3
-3
@@ -63,10 +63,10 @@ class BackwardsCompatibilityDeserializationTest {
|
|||||||
run {
|
run {
|
||||||
val deserializedModelProxy = createProxyInstance<IdeaKotlinProjectModel>(deserializedModel)
|
val deserializedModelProxy = createProxyInstance<IdeaKotlinProjectModel>(deserializedModel)
|
||||||
|
|
||||||
val deserializedMainModuleProxy = deserializedModelProxy.modules.firstOrNull { it.moduleIdentifier.moduleClassifier == null }
|
val deserializedMainModuleProxy = deserializedModelProxy.modules.firstOrNull { it.coordinates.moduleClassifier == null }
|
||||||
?: fail("Missing main module")
|
?: fail("Missing main module")
|
||||||
|
|
||||||
val deserializedTestModuleProxy = deserializedModelProxy.modules.firstOrNull { it.moduleIdentifier.moduleClassifier == "test" }
|
val deserializedTestModuleProxy = deserializedModelProxy.modules.firstOrNull { it.coordinates.moduleClassifier == "test" }
|
||||||
?: fail("Missing test module")
|
?: fail("Missing test module")
|
||||||
|
|
||||||
listOf(deserializedMainModuleProxy, deserializedTestModuleProxy).forEach { module ->
|
listOf(deserializedMainModuleProxy, deserializedTestModuleProxy).forEach { module ->
|
||||||
@@ -100,7 +100,7 @@ class BackwardsCompatibilityDeserializationTest {
|
|||||||
val deserializedModel = deserializeModelWithBackwardsCompatibleClasses(model)
|
val deserializedModel = deserializeModelWithBackwardsCompatibleClasses(model)
|
||||||
val deserializedModelProxy = createProxyInstance<IdeaKotlinProjectModel>(deserializedModel)
|
val deserializedModelProxy = createProxyInstance<IdeaKotlinProjectModel>(deserializedModel)
|
||||||
|
|
||||||
val deserializedMainModuleProxy = deserializedModelProxy.modules.find { it.moduleIdentifier.moduleClassifier == null }
|
val deserializedMainModuleProxy = deserializedModelProxy.modules.find { it.coordinates.moduleClassifier == null }
|
||||||
?: fail("Missing main module")
|
?: fail("Missing main module")
|
||||||
|
|
||||||
val deserializedCommonFragmentProxy = deserializedMainModuleProxy.fragments.find { it.name == "common" }
|
val deserializedCommonFragmentProxy = deserializedMainModuleProxy.fragments.find { it.name == "common" }
|
||||||
|
|||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKotlinFragmentDependency
|
||||||
|
|
||||||
|
fun buildIdeaKotlinFragmentDependencyMatchers(notation: Any?): List<IdeaKotlinFragmentDependencyMatcher> {
|
||||||
|
return when (notation) {
|
||||||
|
null -> emptyList()
|
||||||
|
is Iterable<*> -> notation.flatMap { buildIdeaKotlinFragmentDependencyMatchers(it) }
|
||||||
|
is String -> listOf(IdeaKotlinFragmentDependencyMatcher.DependencyLiteral(notation))
|
||||||
|
is Regex -> listOf(IdeaKotlinFragmentDependencyMatcher.DependencyRegex(notation))
|
||||||
|
else -> error("Can't build ${IdeaKotlinFragmentDependencyMatcher::class.simpleName} from $notation")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IdeaKotlinFragmentDependencyMatcher : IdeaKotlinDependencyMatcher<IdeaKotlinFragmentDependency> {
|
||||||
|
class DependencyLiteral(private val dependencyLiteral: String) : IdeaKotlinFragmentDependencyMatcher {
|
||||||
|
override val description: String = dependencyLiteral
|
||||||
|
|
||||||
|
override fun matches(dependency: IdeaKotlinFragmentDependency): Boolean {
|
||||||
|
return this.dependencyLiteral == dependency.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DependencyRegex(private val dependencyRegex: Regex) : IdeaKotlinFragmentDependencyMatcher {
|
||||||
|
override val description: String = dependencyRegex.pattern
|
||||||
|
|
||||||
|
override fun matches(dependency: IdeaKotlinFragmentDependency): Boolean {
|
||||||
|
return dependencyRegex.matches(dependency.coordinates.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
-31
@@ -1,31 +0,0 @@
|
|||||||
package org.jetbrains.kotlin.gradle.kpm.idea.testFixtures
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKotlinSourceDependency
|
|
||||||
|
|
||||||
fun buildIdeaKotlinSourceDependencyMatchers(notation: Any?): List<IdeaKotlinSourceDependencyMatcher> {
|
|
||||||
return when (notation) {
|
|
||||||
null -> emptyList()
|
|
||||||
is Iterable<*> -> notation.flatMap { buildIdeaKotlinSourceDependencyMatchers(it) }
|
|
||||||
is String -> listOf(IdeaKotlinSourceDependencyMatcher.FragmentPath(notation))
|
|
||||||
is Regex -> listOf(IdeaKotlinSourceDependencyMatcher.FragmentPathRegex(notation))
|
|
||||||
else -> error("Can't build ${IdeaKotlinSourceDependencyMatcher::class.simpleName} from $notation")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IdeaKotlinSourceDependencyMatcher : IdeaKotlinDependencyMatcher<IdeaKotlinSourceDependency> {
|
|
||||||
class FragmentPath(private val dependency: String) : IdeaKotlinSourceDependencyMatcher {
|
|
||||||
override val description: String = dependency
|
|
||||||
|
|
||||||
override fun matches(dependency: IdeaKotlinSourceDependency): Boolean {
|
|
||||||
return this.dependency == dependency.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class FragmentPathRegex(private val dependencyRegex: Regex) : IdeaKotlinSourceDependencyMatcher {
|
|
||||||
override val description: String = dependencyRegex.pattern
|
|
||||||
|
|
||||||
override fun matches(dependency: IdeaKotlinSourceDependency): Boolean {
|
|
||||||
return dependencyRegex.matches(dependency.toString())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+10
-12
@@ -33,7 +33,7 @@ fun IdeaKotlinFragment.assertResolvedBinaryDependencies(
|
|||||||
when (dependency) {
|
when (dependency) {
|
||||||
is IdeaKotlinResolvedBinaryDependencyImpl -> dependency
|
is IdeaKotlinResolvedBinaryDependencyImpl -> dependency
|
||||||
is IdeaKotlinUnresolvedBinaryDependencyImpl -> fail("Unexpected unresolved dependency: $dependency")
|
is IdeaKotlinUnresolvedBinaryDependencyImpl -> fail("Unexpected unresolved dependency: $dependency")
|
||||||
is IdeaKotlinSourceDependencyImpl -> null
|
is IdeaKotlinFragmentDependencyImpl -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.filter { it.binaryType == binaryType }
|
.filter { it.binaryType == binaryType }
|
||||||
@@ -91,8 +91,8 @@ fun IdeaKotlinFragment.assertResolvedBinaryDependencies(
|
|||||||
binaryType: String, vararg matchers: Any?
|
binaryType: String, vararg matchers: Any?
|
||||||
) = assertResolvedBinaryDependencies(binaryType, matchers.toSet())
|
) = assertResolvedBinaryDependencies(binaryType, matchers.toSet())
|
||||||
|
|
||||||
fun IdeaKotlinFragment.assertSourceDependencies(matchers: Set<IdeaKotlinSourceDependencyMatcher>): Set<IdeaKotlinSourceDependency> {
|
fun IdeaKotlinFragment.assertFragmentDependencies(matchers: Set<IdeaKotlinFragmentDependencyMatcher>): Set<IdeaKotlinFragmentDependency> {
|
||||||
val sourceDependencies = dependencies.filterIsInstance<IdeaKotlinSourceDependency>().toSet()
|
val sourceDependencies = dependencies.filterIsInstance<IdeaKotlinFragmentDependency>().toSet()
|
||||||
|
|
||||||
val unexpectedDependencies = sourceDependencies
|
val unexpectedDependencies = sourceDependencies
|
||||||
.filter { dependency -> matchers.none { matcher -> matcher.matches(dependency) } }
|
.filter { dependency -> matchers.none { matcher -> matcher.matches(dependency) } }
|
||||||
@@ -105,13 +105,11 @@ fun IdeaKotlinFragment.assertSourceDependencies(matchers: Set<IdeaKotlinSourceDe
|
|||||||
return sourceDependencies
|
return sourceDependencies
|
||||||
}
|
}
|
||||||
|
|
||||||
val fragmentIdentifier = "${moduleIdentifier.moduleClassifier?.plus("/").orEmpty()}${name}"
|
|
||||||
|
|
||||||
fail(
|
fail(
|
||||||
buildString {
|
buildString {
|
||||||
if (unexpectedDependencies.isNotEmpty()) {
|
if (unexpectedDependencies.isNotEmpty()) {
|
||||||
appendLine()
|
appendLine()
|
||||||
appendLine("${fragmentIdentifier}: Unexpected source dependency found:")
|
appendLine("${coordinates.path}: Unexpected source dependency found:")
|
||||||
unexpectedDependencies.forEach { unexpectedDependency ->
|
unexpectedDependencies.forEach { unexpectedDependency ->
|
||||||
appendLine("\"${unexpectedDependency}\",")
|
appendLine("\"${unexpectedDependency}\",")
|
||||||
}
|
}
|
||||||
@@ -119,14 +117,14 @@ fun IdeaKotlinFragment.assertSourceDependencies(matchers: Set<IdeaKotlinSourceDe
|
|||||||
|
|
||||||
if (missingDependencies.isNotEmpty()) {
|
if (missingDependencies.isNotEmpty()) {
|
||||||
appendLine()
|
appendLine()
|
||||||
appendLine("${fragmentIdentifier}: Missing fragment dependencies:")
|
appendLine("${coordinates.path}: Missing fragment dependencies:")
|
||||||
missingDependencies.forEach { missingDependency ->
|
missingDependencies.forEach { missingDependency ->
|
||||||
appendLine(missingDependency.description)
|
appendLine(missingDependency.description)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appendLine()
|
appendLine()
|
||||||
appendLine("${fragmentIdentifier}: Resolved source dependency paths:")
|
appendLine("${coordinates.path}: Resolved source dependency paths:")
|
||||||
sourceDependencies.forEach { dependency ->
|
sourceDependencies.forEach { dependency ->
|
||||||
appendLine("\"${dependency}\",")
|
appendLine("\"${dependency}\",")
|
||||||
}
|
}
|
||||||
@@ -135,8 +133,8 @@ fun IdeaKotlinFragment.assertSourceDependencies(matchers: Set<IdeaKotlinSourceDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JvmName("assertSourceDependenciesByAnyMatcher")
|
@JvmName("assertSourceDependenciesByAnyMatcher")
|
||||||
fun IdeaKotlinFragment.assertSourceDependencies(matchers: Set<Any?>): Set<IdeaKotlinSourceDependency> =
|
fun IdeaKotlinFragment.assertFragmentDependencies(matchers: Set<Any?>): Set<IdeaKotlinFragmentDependency> =
|
||||||
assertSourceDependencies(matchers.flatMap { buildIdeaKotlinSourceDependencyMatchers(it) }.toSet())
|
assertFragmentDependencies(matchers.flatMap { buildIdeaKotlinFragmentDependencyMatchers(it) }.toSet())
|
||||||
|
|
||||||
fun IdeaKotlinFragment.assertSourceDependencies(vararg matchers: Any?) =
|
fun IdeaKotlinFragment.assertFragmentDependencies(vararg matchers: Any?) =
|
||||||
assertSourceDependencies(matchers.toSet())
|
assertFragmentDependencies(matchers.toSet())
|
||||||
|
|||||||
+8
-8
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.gradle.kpm.applyKpmPlugin
|
|||||||
import org.jetbrains.kotlin.gradle.kpm.buildIdeaKotlinProjectModel
|
import org.jetbrains.kotlin.gradle.kpm.buildIdeaKotlinProjectModel
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.assertContainsFragment
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.assertContainsFragment
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.assertIsNotEmpty
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.assertIsNotEmpty
|
||||||
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.assertSourceDependencies
|
import org.jetbrains.kotlin.gradle.kpm.idea.testFixtures.assertFragmentDependencies
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.*
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.*
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@@ -85,12 +85,12 @@ class SimpleProjectToProjectDependencyResolutionTest : AbstractLightweightIdeaDe
|
|||||||
fun ifMainModule(vararg any: Any?) =
|
fun ifMainModule(vararg any: Any?) =
|
||||||
listOf(*any).takeIf { module.name == KotlinGradleModule.MAIN_MODULE_NAME }
|
listOf(*any).takeIf { module.name == KotlinGradleModule.MAIN_MODULE_NAME }
|
||||||
|
|
||||||
module.assertContainsFragment("common").assertSourceDependencies(
|
module.assertContainsFragment("common").assertFragmentDependencies(
|
||||||
"regular::producer/main/common",
|
"regular::producer/main/common",
|
||||||
ifTestModule("friend::consumer/main/common")
|
ifTestModule("friend::consumer/main/common")
|
||||||
)
|
)
|
||||||
|
|
||||||
module.assertContainsFragment("jvm").assertSourceDependencies(
|
module.assertContainsFragment("jvm").assertFragmentDependencies(
|
||||||
"regular::producer/main/jvm",
|
"regular::producer/main/jvm",
|
||||||
"regular::producer/main/common",
|
"regular::producer/main/common",
|
||||||
ifMainModule(
|
ifMainModule(
|
||||||
@@ -103,7 +103,7 @@ class SimpleProjectToProjectDependencyResolutionTest : AbstractLightweightIdeaDe
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module.assertContainsFragment("nativeCommon").assertSourceDependencies(
|
module.assertContainsFragment("nativeCommon").assertFragmentDependencies(
|
||||||
"regular::producer/main/common",
|
"regular::producer/main/common",
|
||||||
"regular::producer/main/nativeCommon",
|
"regular::producer/main/nativeCommon",
|
||||||
ifMainModule(
|
ifMainModule(
|
||||||
@@ -116,7 +116,7 @@ class SimpleProjectToProjectDependencyResolutionTest : AbstractLightweightIdeaDe
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module.assertContainsFragment("appleCommon").assertSourceDependencies(
|
module.assertContainsFragment("appleCommon").assertFragmentDependencies(
|
||||||
"regular::producer/main/common",
|
"regular::producer/main/common",
|
||||||
"regular::producer/main/appleCommon",
|
"regular::producer/main/appleCommon",
|
||||||
"regular::producer/main/nativeCommon",
|
"regular::producer/main/nativeCommon",
|
||||||
@@ -133,7 +133,7 @@ class SimpleProjectToProjectDependencyResolutionTest : AbstractLightweightIdeaDe
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module.assertContainsFragment("linuxX64").assertSourceDependencies(
|
module.assertContainsFragment("linuxX64").assertFragmentDependencies(
|
||||||
"regular::producer/main/common",
|
"regular::producer/main/common",
|
||||||
"regular::producer/main/nativeCommon",
|
"regular::producer/main/nativeCommon",
|
||||||
"regular::producer/main/linuxX64",
|
"regular::producer/main/linuxX64",
|
||||||
@@ -150,7 +150,7 @@ class SimpleProjectToProjectDependencyResolutionTest : AbstractLightweightIdeaDe
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module.assertContainsFragment("macosX64").assertSourceDependencies(
|
module.assertContainsFragment("macosX64").assertFragmentDependencies(
|
||||||
"regular::producer/main/macosX64",
|
"regular::producer/main/macosX64",
|
||||||
"regular::producer/main/common",
|
"regular::producer/main/common",
|
||||||
"regular::producer/main/appleCommon",
|
"regular::producer/main/appleCommon",
|
||||||
@@ -171,7 +171,7 @@ class SimpleProjectToProjectDependencyResolutionTest : AbstractLightweightIdeaDe
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module.assertContainsFragment("iosX64").assertSourceDependencies(
|
module.assertContainsFragment("iosX64").assertFragmentDependencies(
|
||||||
"regular::producer/main/iosX64",
|
"regular::producer/main/iosX64",
|
||||||
"regular::producer/main/common",
|
"regular::producer/main/common",
|
||||||
"regular::producer/main/iosMain",
|
"regular::producer/main/iosMain",
|
||||||
|
|||||||
+2
-3
@@ -8,15 +8,14 @@ package org.jetbrains.kotlin.gradle.kpm.idea
|
|||||||
import org.jetbrains.kotlin.gradle.kpm.KotlinExternalModelContainer
|
import org.jetbrains.kotlin.gradle.kpm.KotlinExternalModelContainer
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.*
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.*
|
||||||
|
|
||||||
internal fun IdeaKotlinProjectModelBuildingContext.toIdeaKotlinFragment(fragment: KotlinGradleFragment): IdeaKotlinFragment {
|
internal fun IdeaKotlinProjectModelBuildingContext.IdeaKotlinFragment(fragment: KotlinGradleFragment): IdeaKotlinFragment {
|
||||||
return if (fragment is KotlinGradleVariant) buildIdeaKotlinVariant(fragment)
|
return if (fragment is KotlinGradleVariant) buildIdeaKotlinVariant(fragment)
|
||||||
else buildIdeaKotlinFragment(fragment)
|
else buildIdeaKotlinFragment(fragment)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun IdeaKotlinProjectModelBuildingContext.buildIdeaKotlinFragment(fragment: KotlinGradleFragment): IdeaKotlinFragment {
|
private fun IdeaKotlinProjectModelBuildingContext.buildIdeaKotlinFragment(fragment: KotlinGradleFragment): IdeaKotlinFragment {
|
||||||
return IdeaKotlinFragmentImpl(
|
return IdeaKotlinFragmentImpl(
|
||||||
name = fragment.name,
|
coordinates = IdeaKotlinFragmentCoordinates(fragment),
|
||||||
moduleIdentifier = fragment.containingModule.moduleIdentifier.toIdeaKotlinModuleIdentifier(),
|
|
||||||
platforms = fragment.containingVariants.map { variant -> buildIdeaKotlinPlatform(variant) }.toSet(),
|
platforms = fragment.containingVariants.map { variant -> buildIdeaKotlinPlatform(variant) }.toSet(),
|
||||||
languageSettings = fragment.languageSettings.toIdeaKotlinLanguageSettings(),
|
languageSettings = fragment.languageSettings.toIdeaKotlinLanguageSettings(),
|
||||||
dependencies = dependencyResolver.resolve(fragment).toList(),
|
dependencies = dependencyResolver.resolve(fragment).toList(),
|
||||||
|
|||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2022 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 org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinGradleFragment
|
||||||
|
|
||||||
|
internal fun IdeaKotlinFragmentCoordinates(fragment: KotlinGradleFragment): IdeaKotlinFragmentCoordinates {
|
||||||
|
return IdeaKotlinFragmentCoordinatesImpl(
|
||||||
|
module = IdeaKotlinModuleCoordinates(fragment.containingModule),
|
||||||
|
fragmentName = fragment.name
|
||||||
|
)
|
||||||
|
}
|
||||||
+13
-11
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinGradleModule.Companion.
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.currentBuildId
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.currentBuildId
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.toModuleDependency
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.toModuleDependency
|
||||||
|
|
||||||
internal class IdeaKotlinSourceDependencyResolver(
|
internal class IdeaKotlinGranularFragmentDependencyResolver(
|
||||||
private val fragmentGranularMetadataResolverFactory: FragmentGranularMetadataResolverFactory
|
private val fragmentGranularMetadataResolverFactory: FragmentGranularMetadataResolverFactory
|
||||||
) : IdeaKotlinDependencyResolver {
|
) : IdeaKotlinDependencyResolver {
|
||||||
override fun resolve(fragment: KotlinGradleFragment): Set<IdeaKotlinDependency> {
|
override fun resolve(fragment: KotlinGradleFragment): Set<IdeaKotlinDependency> {
|
||||||
@@ -27,19 +27,21 @@ internal class IdeaKotlinSourceDependencyResolver(
|
|||||||
val gradleProjectIdentifier = resolution.dependency.id as? ProjectComponentIdentifier ?: return emptyList()
|
val gradleProjectIdentifier = resolution.dependency.id as? ProjectComponentIdentifier ?: return emptyList()
|
||||||
val kotlinModuleIdentifier = resolution.dependency.toModuleDependency().moduleIdentifier
|
val kotlinModuleIdentifier = resolution.dependency.toModuleDependency().moduleIdentifier
|
||||||
return resolution.allVisibleSourceSetNames.map { visibleFragmentName ->
|
return resolution.allVisibleSourceSetNames.map { visibleFragmentName ->
|
||||||
IdeaKotlinSourceDependencyImpl(
|
IdeaKotlinFragmentDependencyImpl(
|
||||||
type = if (
|
type = if (
|
||||||
gradleProjectIdentifier.build == fragment.project.currentBuildId() &&
|
gradleProjectIdentifier.build == fragment.project.currentBuildId() &&
|
||||||
gradleProjectIdentifier.projectPath == fragment.project.path
|
gradleProjectIdentifier.projectPath == fragment.project.path
|
||||||
) IdeaKotlinSourceDependency.Type.Friend
|
) IdeaKotlinFragmentDependency.Type.Friend
|
||||||
else IdeaKotlinSourceDependency.Type.Regular,
|
else IdeaKotlinFragmentDependency.Type.Regular,
|
||||||
coordinates = IdeaKotlinSourceCoordinatesImpl(
|
coordinates = IdeaKotlinFragmentCoordinatesImpl(
|
||||||
buildId = gradleProjectIdentifier.build.name,
|
module = IdeaKotlinModuleCoordinatesImpl(
|
||||||
projectPath = gradleProjectIdentifier.projectPath,
|
buildId = gradleProjectIdentifier.build.name,
|
||||||
projectName = gradleProjectIdentifier.projectName,
|
projectPath = gradleProjectIdentifier.projectPath,
|
||||||
kotlinModuleName = kotlinModuleIdentifier.moduleName,
|
projectName = gradleProjectIdentifier.projectName,
|
||||||
kotlinModuleClassifier = kotlinModuleIdentifier.moduleClassifier,
|
moduleName = kotlinModuleIdentifier.moduleName,
|
||||||
kotlinFragmentName = visibleFragmentName
|
moduleClassifier = kotlinModuleIdentifier.moduleClassifier,
|
||||||
|
),
|
||||||
|
fragmentName = visibleFragmentName
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
+3
-4
@@ -7,10 +7,9 @@ package org.jetbrains.kotlin.gradle.kpm.idea
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinGradleModule
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinGradleModule
|
||||||
|
|
||||||
internal fun IdeaKotlinProjectModelBuildingContext.toIdeaKotlinModule(module: KotlinGradleModule): IdeaKotlinModule {
|
internal fun IdeaKotlinProjectModelBuildingContext.IdeaKotlinModule(module: KotlinGradleModule): IdeaKotlinModule {
|
||||||
return IdeaKotlinModuleImpl(
|
return IdeaKotlinModuleImpl(
|
||||||
name = module.name,
|
coordinates = IdeaKotlinModuleCoordinates(module),
|
||||||
moduleIdentifier = module.moduleIdentifier.toIdeaKotlinModuleIdentifier(),
|
fragments = module.fragments.toList().map { fragment -> IdeaKotlinFragment(fragment) }
|
||||||
fragments = module.fragments.toList().map { fragment -> toIdeaKotlinFragment(fragment) }
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2022 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 org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinGradleModule
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.currentBuildId
|
||||||
|
|
||||||
|
internal fun IdeaKotlinModuleCoordinates(module: KotlinGradleModule): IdeaKotlinModuleCoordinates {
|
||||||
|
return IdeaKotlinModuleCoordinatesImpl(
|
||||||
|
buildId = module.project.currentBuildId().name,
|
||||||
|
projectPath = module.project.path,
|
||||||
|
projectName = module.project.name,
|
||||||
|
moduleName = module.name,
|
||||||
|
moduleClassifier = module.moduleClassifier
|
||||||
|
)
|
||||||
|
}
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2022 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 org.jetbrains.kotlin.gradle.kpm.idea
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.project.model.KotlinModuleIdentifier
|
|
||||||
import org.jetbrains.kotlin.project.model.LocalModuleIdentifier
|
|
||||||
import org.jetbrains.kotlin.project.model.MavenModuleIdentifier
|
|
||||||
|
|
||||||
internal fun KotlinModuleIdentifier.toIdeaKotlinModuleIdentifier(): IdeaKotlinModuleIdentifier {
|
|
||||||
return when (this) {
|
|
||||||
is LocalModuleIdentifier -> IdeaKotlinLocalModuleIdentifierImpl(
|
|
||||||
moduleClassifier, buildId = buildId, projectId = projectId
|
|
||||||
)
|
|
||||||
is MavenModuleIdentifier -> IdeaKotlinMavenModuleIdentifierImpl(
|
|
||||||
moduleClassifier, group = group, name = name
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -135,7 +135,7 @@ internal fun IdeaKotlinProjectModelBuildingContext.toIdeaKotlinProjectModel(exte
|
|||||||
coreLibrariesVersion = extension.coreLibrariesVersion,
|
coreLibrariesVersion = extension.coreLibrariesVersion,
|
||||||
explicitApiModeCliOption = extension.explicitApi?.cliOption,
|
explicitApiModeCliOption = extension.explicitApi?.cliOption,
|
||||||
kotlinNativeHome = File(extension.project.konanHome).absoluteFile,
|
kotlinNativeHome = File(extension.project.konanHome).absoluteFile,
|
||||||
modules = extension.modules.map { module -> toIdeaKotlinModule(module) }
|
modules = extension.modules.map { module -> IdeaKotlinModule(module) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ internal fun IdeaKotlinProjectModelBuilder.Companion.default(
|
|||||||
)
|
)
|
||||||
|
|
||||||
registerDependencyResolver(
|
registerDependencyResolver(
|
||||||
resolver = IdeaKotlinSourceDependencyResolver(fragmentMetadataResolverFactory),
|
resolver = IdeaKotlinGranularFragmentDependencyResolver(fragmentMetadataResolverFactory),
|
||||||
constraint = IdeaKotlinProjectModelBuilder.FragmentConstraint.unconstrained,
|
constraint = IdeaKotlinProjectModelBuilder.FragmentConstraint.unconstrained,
|
||||||
phase = IdeaKotlinProjectModelBuilder.DependencyResolutionPhase.SourceDependencyResolution,
|
phase = IdeaKotlinProjectModelBuilder.DependencyResolutionPhase.SourceDependencyResolution,
|
||||||
level = IdeaKotlinProjectModelBuilder.DependencyResolutionLevel.Default
|
level = IdeaKotlinProjectModelBuilder.DependencyResolutionLevel.Default
|
||||||
|
|||||||
+3
-11
@@ -6,7 +6,6 @@
|
|||||||
package org.jetbrains.kotlin.gradle.kpm.idea
|
package org.jetbrains.kotlin.gradle.kpm.idea
|
||||||
|
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinGradleFragment
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinGradleFragment
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.currentBuildId
|
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.refinesClosure
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.refinesClosure
|
||||||
|
|
||||||
internal object IdeaKotlinRefinesDependencyResolver : IdeaKotlinDependencyResolver {
|
internal object IdeaKotlinRefinesDependencyResolver : IdeaKotlinDependencyResolver {
|
||||||
@@ -14,16 +13,9 @@ internal object IdeaKotlinRefinesDependencyResolver : IdeaKotlinDependencyResolv
|
|||||||
.map { refinesDependencyFragment -> createRefinesDependency(refinesDependencyFragment) }.toSet()
|
.map { refinesDependencyFragment -> createRefinesDependency(refinesDependencyFragment) }.toSet()
|
||||||
|
|
||||||
private fun createRefinesDependency(fragment: KotlinGradleFragment): IdeaKotlinDependency {
|
private fun createRefinesDependency(fragment: KotlinGradleFragment): IdeaKotlinDependency {
|
||||||
return IdeaKotlinSourceDependencyImpl(
|
return IdeaKotlinFragmentDependencyImpl(
|
||||||
type = IdeaKotlinSourceDependency.Type.Refines,
|
type = IdeaKotlinFragmentDependency.Type.Refines,
|
||||||
coordinates = IdeaKotlinSourceCoordinatesImpl(
|
coordinates = IdeaKotlinFragmentCoordinates(fragment)
|
||||||
buildId = fragment.project.currentBuildId().name,
|
|
||||||
projectPath = fragment.project.path,
|
|
||||||
projectName = fragment.project.name,
|
|
||||||
kotlinModuleName = fragment.containingModule.name,
|
|
||||||
kotlinModuleClassifier = fragment.containingModule.moduleClassifier,
|
|
||||||
kotlinFragmentName = fragment.name
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user