diff --git a/sbt/sbt-api/src/org/jetbrains/sbt/project/settings/SbtProjectSettings.scala b/sbt/sbt-api/src/org/jetbrains/sbt/project/settings/SbtProjectSettings.scala index 601024959c7..3b62f1ed9bf 100644 --- a/sbt/sbt-api/src/org/jetbrains/sbt/project/settings/SbtProjectSettings.scala +++ b/sbt/sbt-api/src/org/jetbrains/sbt/project/settings/SbtProjectSettings.scala @@ -117,6 +117,13 @@ object SbtProjectSettings { settings } + def default(separateProdAndTestSources: Boolean): SbtProjectSettings = { + val settings = new SbtProjectSettings() + settings.converterVersion = ConverterVersion + settings.separateProdAndTestSources = separateProdAndTestSources + settings + } + def forProject(project: Project): Option[SbtProjectSettings] = { val settings = SbtSettings.getInstance(project) Option(project.getBasePath) diff --git a/sbt/sbt-impl/src/org/jetbrains/sbt/project/template/SbtModuleBuilderBase.scala b/sbt/sbt-impl/src/org/jetbrains/sbt/project/template/SbtModuleBuilderBase.scala index 1e5bc3ba361..84101d836b1 100644 --- a/sbt/sbt-impl/src/org/jetbrains/sbt/project/template/SbtModuleBuilderBase.scala +++ b/sbt/sbt-impl/src/org/jetbrains/sbt/project/template/SbtModuleBuilderBase.scala @@ -8,7 +8,7 @@ import org.jetbrains.sbt.project.settings.SbtProjectSettings @ApiStatus.Experimental abstract class SbtModuleBuilderBase extends ModuleBuilderBase[SbtProjectSettings]( SbtProjectSystem.Id, - SbtProjectSettings.default + SbtProjectSettings.default(separateProdAndTestSources = true) ) { override protected def externalSystemConfigFile: String = Sbt.BuildFile } diff --git a/sbt/sbt-impl/test/org/jetbrains/sbt/project/NewSbtProjectWizardTest.scala b/sbt/sbt-impl/test/org/jetbrains/sbt/project/NewSbtProjectWizardTest.scala index b63bd3fce14..511dae47adc 100644 --- a/sbt/sbt-impl/test/org/jetbrains/sbt/project/NewSbtProjectWizardTest.scala +++ b/sbt/sbt-impl/test/org/jetbrains/sbt/project/NewSbtProjectWizardTest.scala @@ -36,13 +36,26 @@ class NewSbtProjectWizardTest extends NewScalaProjectWizardTestBase with ExactMa libraries := scalaLibraries libraries.exactMatch() + lazy val mainModule = new module(s"$projectName.main") { + libraryDependencies := scalaLibraries + sources := Seq("scala") + } + + lazy val testModule = new module(s"$projectName.test") { + libraryDependencies := scalaLibraries + testSources := Seq("scala") + moduleDependencies += new dependency(mainModule) { isExported := false } + } + modules := Seq( new module(projectName) { - libraryDependencies := scalaLibraries - sources := Seq("src/main/scala") - testSources := Seq("src/test/scala") excluded := Seq("target") + moduleDependencies:= Seq( + new dependency(mainModule) { isExported := false }, + new dependency(testModule) { isExported := false } + ) }, + mainModule, testModule, new module(s"$projectName.$projectName-build") { // TODO: why `-build` module contains empty string? in UI the `project` folder is marked as `sources`. // Is it some implicit IntelliJ behaviour? @@ -84,6 +97,6 @@ class NewSbtProjectWizardTest extends NewScalaProjectWizardTestBase with ExactMa scalaSampleCodeData(step).setAddSampleCode(false) } - useProject(project, false, assertProjectsEqual(expectedProject, _: Project)) + useProject(project, false, assertProjectsEqual(expectedProject, _: Project, singleContentRootModules = false)) } }