[KPM] :kotlin-gradle-plugin-idea Make entities data classes

This is done to benefit from .equals and hashcode functions.
The goal is to keep .copy methods stable whereas using any
.component* function shall be avoided

^KT-51262
This commit is contained in:
sebastian.sellmair
2022-02-11 16:23:47 +01:00
committed by Space
parent e91785ba39
commit c124c86b0f
9 changed files with 28 additions and 14 deletions
@@ -1,13 +1,24 @@
# Kotlin Gradle Plugin Models shared between IDEA import and KGP
The classes defined in this module will be available inside the Kotlin Gradle Plugin (KGP)
The classes defined in this module will be available inside the Kotlin Gradle Plugin (KGP)
as well as in the IDE import (GradleProject).
## Binary Compatibility:
## Binary Compatibility:
Binary compatibility can be tested by
`./gradlew :tools:binary-compatibility-validator:clean :tools:binary-compatibility-validator:test`
Binary incompatible changes have to go through a proper deprecation cycle after releases
### Unstable APIs / KotlinGradlePluginApi
Some APIs are marked with 'KotlinGradlePluginApi' which means, that those are not kept binary compatible and are considered 'unstable'
from the IDEA perspective. Typically constructors for models are marked like this
Some APIs are marked with 'KotlinGradlePluginApi' which means, that those are not kept binary compatible and are considered 'unstable' from
the IDEA perspective. Typically constructors for models are marked like this
Non Stable by default:
- data class componentX methods
Kept Stable
- data class .copy methods
@@ -16,7 +16,7 @@ interface IdeaKotlinFragment : Serializable {
val resourceDirectories: Collection<IdeaKotlinResourceDirectory>
}
class IdeaKotlinFragmentImpl @KotlinGradlePluginApi constructor(
data class IdeaKotlinFragmentImpl @KotlinGradlePluginApi constructor(
override val name: String,
override val languageSettings: IdeaKotlinLanguageSettings?,
override val dependencies: Collection<IdeaKotlinFragmentDependency>,
@@ -5,4 +5,6 @@
package org.jetbrains.kotlin.gradle.kpm.idea
interface IdeaKotlinFragmentDependency
import java.io.Serializable
interface IdeaKotlinFragmentDependency : Serializable
@@ -6,8 +6,9 @@
package org.jetbrains.kotlin.gradle.kpm.idea
import java.io.File
import java.io.Serializable
interface IdeaKotlinLanguageSettings {
interface IdeaKotlinLanguageSettings : Serializable {
val languageVersion: String?
val apiVersion: String?
val isProgressiveMode: Boolean
@@ -18,7 +19,7 @@ interface IdeaKotlinLanguageSettings {
val freeCompilerArgs: Collection<String>
}
class IdeaKotlinLanguageSettingsImpl @KotlinGradlePluginApi constructor(
data class IdeaKotlinLanguageSettingsImpl @KotlinGradlePluginApi constructor(
override val languageVersion: String?,
override val apiVersion: String?,
override val isProgressiveMode: Boolean,
@@ -12,7 +12,7 @@ interface IdeaKotlinModule : Serializable {
val fragments: Collection<IdeaKotlinFragment>
}
class IdeaKotlinModuleImpl @KotlinGradlePluginApi constructor(
data class IdeaKotlinModuleImpl @KotlinGradlePluginApi constructor(
override val moduleIdentifier: IdeaKotlinModuleIdentifier,
override val fragments: Collection<IdeaKotlinFragment>
) : IdeaKotlinModule
@@ -21,13 +21,13 @@ interface IdeaKotlinMavenModuleIdentifier : IdeaKotlinModuleIdentifier {
val name: String
}
class IdeaKotlinLocalModuleIdentifierImpl @KotlinGradlePluginApi constructor(
data class IdeaKotlinLocalModuleIdentifierImpl @KotlinGradlePluginApi constructor(
override val moduleClassifier: String?,
override val buildId: String,
override val projectId: String
) : IdeaKotlinLocalModuleIdentifier
class IdeaKotlinMavenModuleIdentifierImpl @KotlinGradlePluginApi constructor(
data class IdeaKotlinMavenModuleIdentifierImpl @KotlinGradlePluginApi constructor(
override val moduleClassifier: String?,
override val group: String,
override val name: String
@@ -15,7 +15,7 @@ interface IdeaKotlinProjectModel : Serializable {
val modules: List<IdeaKotlinModule>
}
class IdeaKotlinProjectModelImpl @KotlinGradlePluginApi constructor(
data class IdeaKotlinProjectModelImpl @KotlinGradlePluginApi constructor(
override val coreLibrariesVersion: String,
override val explicitApiModeCliOption: String?,
override val kotlinNativeHome: File,
@@ -12,6 +12,6 @@ interface IdeaKotlinResourceDirectory : Serializable {
val file: File
}
class IdeaKotlinResourceDirectoryImpl @KotlinGradlePluginApi constructor(
data class IdeaKotlinResourceDirectoryImpl @KotlinGradlePluginApi constructor(
override val file: File
) : IdeaKotlinResourceDirectory
@@ -12,6 +12,6 @@ interface IdeaKotlinSourceDirectory : Serializable {
val file: File
}
class IdeaKotlinSourceDirectoryImpl @KotlinGradlePluginApi constructor(
data class IdeaKotlinSourceDirectoryImpl @KotlinGradlePluginApi constructor(
override val file: File,
) : IdeaKotlinSourceDirectory