mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 18:05:27 +07:00
[kotlin] When using compact project structure, create test sourceset but do not create folder for it
^KTIJ-27192 fixed Merge-request: IJ-MR-117721 Merged-by: Frederik Haselmeier <Frederik.Haselmeier@jetbrains.com> GitOrigin-RevId: f34966c5dafe51d9f7e08af5825a272c2d93b0bd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2e0eec3551
commit
8059da5afb
@@ -148,17 +148,16 @@ class KotlinPlugin(context: Context) : Plugin(context) {
|
||||
}
|
||||
}
|
||||
|
||||
val createResourceDirectories by booleanSetting("Generate Resource Folders", GenerationPhase.PROJECT_GENERATION) {
|
||||
defaultValue = value(true)
|
||||
}
|
||||
|
||||
val createSourcesetDirectories by pipelineTask(GenerationPhase.PROJECT_GENERATION) {
|
||||
runAfter(createModules)
|
||||
withAction {
|
||||
forEachModule { moduleIR ->
|
||||
moduleIR.sourcesets.mapSequenceIgnore { sourcesetIR ->
|
||||
// We do not create test or resource folders when creating a compact project
|
||||
moduleIR.sourcesets
|
||||
.filter { it.sourcesetType != SourcesetType.test || !StructurePlugin.useCompactProjectStructure.settingValue }
|
||||
.mapSequenceIgnore { sourcesetIR ->
|
||||
sourcesetIR.sourcePaths.filter {
|
||||
it.key != SourcesetSourceType.RESOURCES || createResourceDirectories.settingValue
|
||||
it.key != SourcesetSourceType.RESOURCES || !StructurePlugin.useCompactProjectStructure.settingValue
|
||||
}.values.mapSequence {
|
||||
with(service<FileSystemWizardService>()) {
|
||||
createDirectory(it)
|
||||
@@ -187,8 +186,7 @@ class KotlinPlugin(context: Context) : Plugin(context) {
|
||||
override val settings: List<PluginSetting<*, *>> =
|
||||
listOf(
|
||||
projectKind,
|
||||
modules,
|
||||
createResourceDirectories,
|
||||
modules
|
||||
)
|
||||
|
||||
override val pipelineTasks: List<PipelineTask> =
|
||||
|
||||
@@ -72,9 +72,7 @@ internal class IntelliJKotlinNewProjectWizard : BuildSystemKotlinNewProjectWizar
|
||||
sdk = sdk,
|
||||
buildSystemType = BuildSystemType.Jps,
|
||||
addSampleCode = false,
|
||||
useCompactProjectStructure = useCompactProject,
|
||||
createResourceDirectories = !useCompactProject,
|
||||
filterTestSourcesets = useCompactProject
|
||||
useCompactProjectStructure = useCompactProject
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.gradle.Gradl
|
||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.kotlin.KotlinPlugin
|
||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.projectTemplates.applyProjectTemplate
|
||||
import org.jetbrains.kotlin.tools.projectWizard.projectTemplates.ConsoleApplicationProjectTemplate
|
||||
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.SourcesetType
|
||||
import org.jetbrains.kotlin.tools.projectWizard.settings.version.Version
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.KotlinNewProjectWizardUIBundle
|
||||
import org.jetbrains.kotlin.tools.projectWizard.wizard.NewProjectWizardModuleBuilder
|
||||
@@ -64,9 +63,7 @@ class KotlinNewProjectWizard : LanguageNewProjectWizard {
|
||||
addSampleCode: Boolean = true,
|
||||
gradleVersion: String? = null,
|
||||
gradleHome: String? = null,
|
||||
useCompactProjectStructure: Boolean = false,
|
||||
createResourceDirectories: Boolean = true,
|
||||
filterTestSourcesets: Boolean = false
|
||||
useCompactProjectStructure: Boolean = false
|
||||
) {
|
||||
NewProjectWizardModuleBuilder()
|
||||
.apply {
|
||||
@@ -78,7 +75,6 @@ class KotlinNewProjectWizard : LanguageNewProjectWizard {
|
||||
StructurePlugin.projectPath.reference.setValue(projectPath.asPath())
|
||||
StructurePlugin.useCompactProjectStructure.reference.setValue(useCompactProjectStructure)
|
||||
StructurePlugin.isCreatingNewProjectHierarchy.reference.setValue(isProject)
|
||||
KotlinPlugin.createResourceDirectories.reference.setValue(createResourceDirectories)
|
||||
|
||||
// If a local gradle installation was selected, we want to use the local gradle installation's
|
||||
// version so that the wizard knows what kind of build scripts to generate
|
||||
@@ -97,12 +93,6 @@ class KotlinNewProjectWizard : LanguageNewProjectWizard {
|
||||
BuildSystemPlugin.type.reference.setValue(buildSystemType)
|
||||
|
||||
applyProjectTemplate(ConsoleApplicationProjectTemplate(addSampleCode = addSampleCode))
|
||||
|
||||
if (filterTestSourcesets) {
|
||||
KotlinPlugin.modules.settingValue.forEach { module ->
|
||||
module.sourceSets = module.sourceSets.filter { it.sourcesetType != SourcesetType.test }
|
||||
}
|
||||
}
|
||||
}
|
||||
}.commit(project, null, null)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user