[kpm] IdeaKpmContentRoot: Rename SOURCE_TYPE -> SOURCES_TYPE & RESOURCE_TYPE -> RESOURCES_TYPE

^KT-52568 Verification Pending
This commit is contained in:
sebastian.sellmair
2022-06-14 13:17:56 +02:00
committed by Space
parent 70df08c678
commit 92713bdcb3
2 changed files with 11 additions and 3 deletions
@@ -3,8 +3,12 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("unused")
package org.jetbrains.kotlin.gradle.kpm.idea
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmContentRoot.Companion.RESOURCES_TYPE
import org.jetbrains.kotlin.gradle.kpm.idea.IdeaKpmContentRoot.Companion.SOURCES_TYPE
import org.jetbrains.kotlin.tooling.core.Extras
import org.jetbrains.kotlin.tooling.core.emptyExtras
import java.io.File
@@ -16,11 +20,15 @@ sealed interface IdeaKpmContentRoot : Serializable {
val type: String
companion object {
const val SOURCE_TYPE = "source"
const val RESOURCE_TYPE = "resource"
const val SOURCES_TYPE = "source"
const val RESOURCES_TYPE = "resource"
}
}
val IdeaKpmContentRoot.isSources get() = type == SOURCES_TYPE
val IdeaKpmContentRoot.isResources get() = type == RESOURCES_TYPE
@InternalKotlinGradlePluginApi
data class IdeaKpmContentRootImpl(
override val file: File,
@@ -19,7 +19,7 @@ private fun IdeaKpmProjectBuildingContext.buildIdeaKpmFragment(fragment: GradleK
languageSettings = IdeaKpmLanguageSettings(fragment.languageSettings),
dependencies = dependencyResolver.resolve(fragment).toList(),
contentRoots = fragment.kotlinSourceRoots.sourceDirectories.files.map { file ->
IdeaKpmContentRootImpl(file, type = IdeaKpmContentRoot.SOURCE_TYPE)
IdeaKpmContentRootImpl(file, type = IdeaKpmContentRoot.SOURCES_TYPE)
},
extras = fragment.extras
)