[KPM] Consistently use uppercase factory style for idea model builders
KT-51386
This commit is contained in:
committed by
Space
parent
03cf978b77
commit
85998f8857
+3
-3
@@ -7,9 +7,9 @@ package org.jetbrains.kotlin.gradle.kpm.idea
|
||||
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilationOutput
|
||||
|
||||
internal fun KotlinCompilationOutput.toIdeaKotlinCompilationOutputs(): IdeaKotlinCompilationOutput {
|
||||
internal fun IdeaKotlinCompilationOutput(compilation: KotlinCompilationOutput): IdeaKotlinCompilationOutput {
|
||||
return IdeaKotlinCompilationOutputImpl(
|
||||
classesDirs = this.classesDirs.toSet(),
|
||||
resourcesDir = this.resourcesDir
|
||||
classesDirs = compilation.classesDirs.toSet(),
|
||||
resourcesDir = compilation.resourcesDir
|
||||
)
|
||||
}
|
||||
|
||||
+4
-4
@@ -16,8 +16,8 @@ internal fun IdeaKotlinProjectModelBuildingContext.IdeaKotlinFragment(fragment:
|
||||
private fun IdeaKotlinProjectModelBuildingContext.buildIdeaKotlinFragment(fragment: KotlinGradleFragment): IdeaKotlinFragment {
|
||||
return IdeaKotlinFragmentImpl(
|
||||
coordinates = IdeaKotlinFragmentCoordinates(fragment),
|
||||
platforms = fragment.containingVariants.map { variant -> buildIdeaKotlinPlatform(variant) }.toSet(),
|
||||
languageSettings = fragment.languageSettings.toIdeaKotlinLanguageSettings(),
|
||||
platforms = fragment.containingVariants.map { variant -> IdeaKotlinPlatform(variant) }.toSet(),
|
||||
languageSettings = IdeaKotlinLanguageSettings(fragment.languageSettings),
|
||||
dependencies = dependencyResolver.resolve(fragment).toList(),
|
||||
sourceDirectories = fragment.kotlinSourceRoots.sourceDirectories.files.toList().map { file -> IdeaKotlinSourceDirectoryImpl(file) },
|
||||
resourceDirectories = emptyList(),
|
||||
@@ -28,8 +28,8 @@ private fun IdeaKotlinProjectModelBuildingContext.buildIdeaKotlinFragment(fragme
|
||||
private fun IdeaKotlinProjectModelBuildingContext.buildIdeaKotlinVariant(variant: KotlinGradleVariant): IdeaKotlinVariant {
|
||||
return IdeaKotlinVariantImpl(
|
||||
fragment = buildIdeaKotlinFragment(variant),
|
||||
platform = buildIdeaKotlinPlatform(variant),
|
||||
platform = IdeaKotlinPlatform(variant),
|
||||
variantAttributes = variant.variantAttributes.mapKeys { (key, _) -> key.uniqueName },
|
||||
compilationOutputs = variant.compilationOutputs.toIdeaKotlinCompilationOutputs()
|
||||
compilationOutputs = IdeaKotlinCompilationOutput(variant.compilationOutputs)
|
||||
)
|
||||
}
|
||||
|
||||
+9
-9
@@ -8,15 +8,15 @@ package org.jetbrains.kotlin.gradle.kpm.idea
|
||||
import org.jetbrains.kotlin.gradle.plugin.sources.DefaultLanguageSettingsBuilder
|
||||
import org.jetbrains.kotlin.project.model.LanguageSettings
|
||||
|
||||
internal fun LanguageSettings.toIdeaKotlinLanguageSettings(): IdeaKotlinLanguageSettings {
|
||||
internal fun IdeaKotlinLanguageSettings(languageSettings: LanguageSettings): IdeaKotlinLanguageSettings {
|
||||
return IdeaKotlinLanguageSettingsImpl(
|
||||
languageVersion = languageVersion,
|
||||
apiVersion = apiVersion,
|
||||
isProgressiveMode = progressiveMode,
|
||||
enabledLanguageFeatures = enabledLanguageFeatures.toSet(),
|
||||
optInAnnotationsInUse = optInAnnotationsInUse.toSet(),
|
||||
compilerPluginArguments = (this as? DefaultLanguageSettingsBuilder)?.compilerPluginArguments?.toList().orEmpty(),
|
||||
compilerPluginClasspath = (this as? DefaultLanguageSettingsBuilder)?.compilerPluginClasspath?.toList().orEmpty(),
|
||||
freeCompilerArgs = (this as? DefaultLanguageSettingsBuilder)?.freeCompilerArgs?.toList().orEmpty()
|
||||
languageVersion = languageSettings.languageVersion,
|
||||
apiVersion = languageSettings.apiVersion,
|
||||
isProgressiveMode = languageSettings.progressiveMode,
|
||||
enabledLanguageFeatures = languageSettings.enabledLanguageFeatures.toSet(),
|
||||
optInAnnotationsInUse = languageSettings.optInAnnotationsInUse.toSet(),
|
||||
compilerPluginArguments = (languageSettings as? DefaultLanguageSettingsBuilder)?.compilerPluginArguments?.toList().orEmpty(),
|
||||
compilerPluginClasspath = (languageSettings as? DefaultLanguageSettingsBuilder)?.compilerPluginClasspath?.toList().orEmpty(),
|
||||
freeCompilerArgs = (languageSettings as? DefaultLanguageSettingsBuilder)?.freeCompilerArgs?.toList().orEmpty()
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import org.jetbrains.kotlin.konan.target.HostManager
|
||||
|
||||
@Suppress("unused")
|
||||
/* Receiver acts as scope, or key to that function */
|
||||
internal fun IdeaKotlinProjectModelBuildingContext.buildIdeaKotlinPlatform(variant: KotlinGradleVariant): IdeaKotlinPlatform {
|
||||
internal fun IdeaKotlinProjectModelBuildingContext.IdeaKotlinPlatform(variant: KotlinGradleVariant): IdeaKotlinPlatform {
|
||||
when (variant) {
|
||||
is KotlinJvmVariant -> return IdeaKotlinPlatform.jvm(variant.compilationData.kotlinOptions.jvmTarget ?: JvmTarget.DEFAULT.name)
|
||||
is KotlinNativeVariantInternal -> return IdeaKotlinPlatform.native(variant.konanTarget.name)
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ interface IdeaKotlinProjectModelBuilder {
|
||||
companion object
|
||||
}
|
||||
|
||||
internal fun IdeaKotlinProjectModelBuildingContext.toIdeaKotlinProjectModel(extension: KotlinPm20ProjectExtension): IdeaKotlinProjectModel {
|
||||
internal fun IdeaKotlinProjectModelBuildingContext.IdeaKotlinProjectModel(extension: KotlinPm20ProjectExtension): IdeaKotlinProjectModel {
|
||||
return IdeaKotlinProjectModelImpl(
|
||||
gradlePluginVersion = extension.project.getKotlinPluginVersion(),
|
||||
coreLibrariesVersion = extension.coreLibrariesVersion,
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ internal class IdeaKotlinProjectModelBuilderImpl @UnsafeApi("Use factory methods
|
||||
}
|
||||
|
||||
override fun buildIdeaKotlinProjectModel(): IdeaKotlinProjectModel {
|
||||
return Context().toIdeaKotlinProjectModel(extension)
|
||||
return Context().IdeaKotlinProjectModel(extension)
|
||||
}
|
||||
|
||||
override fun canBuild(modelName: String): Boolean =
|
||||
|
||||
Reference in New Issue
Block a user