From e7fb0d9c75caea8bfc32a32531f429932127a820 Mon Sep 17 00:00:00 2001 From: Aleksandra Zdrojowa Date: Tue, 8 Oct 2024 16:30:20 +0200 Subject: [PATCH] using sbt project name as the artifact name in IdeaConfigBuilder (as it is done for IdeaArtifactXmlBuilder) --- .../tasks/GenerateIdeaRunConfigurations.scala | 8 +------- .../sbtidea/tasks/IdeaConfigBuilder.scala | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/ideaSupport/src/main/scala/org/jetbrains/sbtidea/tasks/GenerateIdeaRunConfigurations.scala b/ideaSupport/src/main/scala/org/jetbrains/sbtidea/tasks/GenerateIdeaRunConfigurations.scala index 3d8b28f..17fbe36 100644 --- a/ideaSupport/src/main/scala/org/jetbrains/sbtidea/tasks/GenerateIdeaRunConfigurations.scala +++ b/ideaSupport/src/main/scala/org/jetbrains/sbtidea/tasks/GenerateIdeaRunConfigurations.scala @@ -18,7 +18,6 @@ object GenerateIdeaRunConfigurations extends SbtIdeaTask[Unit] { PluginLogger.bind(new SbtPluginLogger(streams.value)) val buildInfo = sbtidea.Keys.intellijBuildInfo.in(ThisBuild).value val vmOptions = intellijVMOptions.value.copy(debug = false) - val configName = name.value val dotIdeaFolder = baseDirectory.in(ThisBuild).value / ".idea" val sbtRunEnv = envVars.value val sbtTestEnv = envVars.in(Test).value @@ -45,13 +44,8 @@ object GenerateIdeaRunConfigurations extends SbtIdeaTask[Unit] { .map(x => if (x.ideaRunEnv.isEmpty) x.copy(ideaRunEnv = sbtRunEnv) else x) .map(x => if (x.ideaTestEnv.isEmpty) x.copy(ideaTestEnv = sbtTestEnv) else x) .get - val projectName = name.value - val moduleName = - if (hasProdTestSeparationEnabled) s"$projectName.main" - else projectName val configBuilder = new IdeaConfigBuilder( - moduleName = moduleName, - configName = configName, + projectName = name.value, intellijVMOptions = vmOptions, dataDir = intellijPluginDirectory.value, intellijBaseDir = intellijBaseDirectory.in(ThisBuild).value, diff --git a/ideaSupport/src/main/scala/org/jetbrains/sbtidea/tasks/IdeaConfigBuilder.scala b/ideaSupport/src/main/scala/org/jetbrains/sbtidea/tasks/IdeaConfigBuilder.scala index 2548c5d..5038483 100644 --- a/ideaSupport/src/main/scala/org/jetbrains/sbtidea/tasks/IdeaConfigBuilder.scala +++ b/ideaSupport/src/main/scala/org/jetbrains/sbtidea/tasks/IdeaConfigBuilder.scala @@ -2,6 +2,7 @@ package org.jetbrains.sbtidea.tasks import coursier.{Dependency, Fetch, Module, ModuleName, Organization} import org.jetbrains.sbtidea.Keys.IdeaConfigBuildingOptions +import org.jetbrains.sbtidea.packaging.hasProdTestSeparationEnabled import org.jetbrains.sbtidea.productInfo.ProductInfoExtraDataProvider import org.jetbrains.sbtidea.runIdea.{IntellijAwareRunner, IntellijVMOptions} import org.jetbrains.sbtidea.tasks.IdeaConfigBuilder.{computeJupiterRuntimeDependencies, pathPattern, pluginsPattern} @@ -13,15 +14,12 @@ import java.io.File import java.nio.file.{Path, Paths} import java.util.regex.Pattern import scala.annotation.tailrec -import scala.collection.mutable -import scala.collection.mutable.ArrayBuffer /** * @param testPluginRoots contains only those plugins which are listed in the project IntelliJ plugin dependencies and their transitive dependencies */ class IdeaConfigBuilder( - moduleName: String, - configName: String, + projectName: String, intellijVMOptions: IntellijVMOptions, dataDir: File, intellijBaseDir: File, @@ -37,10 +35,14 @@ class IdeaConfigBuilder( private val IDEA_ROOT_KEY = "idea.installation.dir" + private val moduleName: String = + if (hasProdTestSeparationEnabled) s"$projectName.main" + else projectName + def build(): Unit = { if (options.generateDefaultRunConfig) { - val content = buildRunConfigurationXML(configName, intellijVMOptions) - writeToFile(runConfigDir / s"$configName.xml", content) + val content = buildRunConfigurationXML(projectName, intellijVMOptions) + writeToFile(runConfigDir / s"$projectName.xml", content) } if (options.generateJUnitTemplate) writeToFile(runConfigDir / "_template__of_JUnit.xml", buildJUnitTemplate) @@ -190,7 +192,7 @@ class IdeaConfigBuilder( | | | | @@ -259,7 +261,7 @@ class IdeaConfigBuilder( | | | |