Skip to content

Commit 8bf8228

Browse files
authored
Merge pull request #3197 from Gedochao/maintenance/export-sbt
NIT fixes for the `export` sub-command
2 parents a7372a9 + 1425103 commit 8bf8228

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

build.sc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,8 @@ trait Core extends ScalaCliCrossSbtModule
518518
| def giter8Organization = "${Deps.giter8.dep.module.organization.value}"
519519
| def giter8Name = "${Deps.giter8.dep.module.name.value}"
520520
| def giter8Version = "${Deps.giter8.dep.version}"
521+
|
522+
| def sbtVersion = "${Deps.Versions.sbtVersion}"
521523
|
522524
| def mavenVersion = "${Deps.Versions.mavenVersion}"
523525
| def mavenScalaCompilerPluginVersion = "${Deps.Versions.mavenScalaCompilerPluginVersion}"

modules/cli/src/main/scala/scala/cli/commands/export0/Export.scala

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,15 @@ object Export extends ScalaCommand[ExportOptions] {
155155
val shouldExportToSbt = options.sbt.getOrElse(false)
156156
val shouldExportToMaven = options.maven.getOrElse(false)
157157

158-
val exportOptions = List(shouldExportToMill, shouldExportToSbt, shouldExportToMaven)
159-
160-
if (exportOptions.count(identity) > 1) {
158+
val exportOptions =
159+
(if shouldExportToMill then List("Mill") else Nil) ++
160+
(if shouldExportToSbt then List("SBT") else Nil) ++
161+
(if shouldExportToMaven then List("Maven") else Nil)
162+
val exportOptionsString = exportOptions.mkString(", ")
163+
if exportOptions.length > 1 then {
161164
logger.error(
162-
s"Error: Cannot export to both mill and sbt. Please pick one build tool to export."
165+
s"""Error: Cannot export to more than one tool at once (currently chosen: $exportOptionsString).
166+
|Pick one build tool to export to.""".stripMargin
163167
)
164168
sys.exit(1)
165169
}
@@ -238,7 +242,7 @@ object Export extends ScalaCommand[ExportOptions] {
238242
project.print(System.out)
239243
}
240244
else {
241-
val sbtVersion = options.sbtVersion.getOrElse("1.10.2")
245+
val sbtVersion = options.sbtVersion.getOrElse(Constants.sbtVersion)
242246
val defaultMavenCompilerVersion = options.mvnVersion.getOrElse(Constants.mavenVersion)
243247
val defaultScalaMavenCompilerVersion =
244248
options.mvnScalaVersion.getOrElse(Constants.mavenScalaCompilerPluginVersion)

project/deps.sc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ object Deps {
124124
def javaSemanticdb = "0.10.0"
125125
def javaClassName = "0.1.3"
126126
def bloop = "2.0.0"
127+
def sbtVersion = "1.10.2"
127128
def mavenVersion = "3.8.1"
128129
def mavenScalaCompilerPluginVersion = "4.9.1"
129130
def mavenExecPluginVersion = "3.3.0"

0 commit comments

Comments
 (0)