Skip to content

Commit 1111765

Browse files
committed
Force-upgrade sbt-scalajs to scalaJSVersion in community builds that need it.
Currently, this is only for cats-effect-2.
1 parent 480bb7c commit 1111765

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

community-build/src/scala/dotty/communitybuild/projects.scala

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ lazy val sbtPluginFilePath: String =
1515
new File(sys.props("user.home") + "/.sbt/1.0/plugins").mkdirs()
1616
communitybuildDir.resolve("sbt-dotty-sbt").toAbsolutePath().toString()
1717

18+
lazy val sbtScalaJSPluginFilePath: String =
19+
communitybuildDir.resolve("sbt-scalajs-sbt").toAbsolutePath().toString()
20+
1821
def log(msg: String) = println(Console.GREEN + msg + Console.RESET)
1922

2023
/** Executes shell command, returns false in case of error. */
@@ -65,6 +68,7 @@ final case class SbtCommunityProject(
6568
project: String,
6669
sbtTestCommand: String,
6770
extraSbtArgs: List[String] = Nil,
71+
forceUpgradeSbtScalajsPlugin: Boolean = false,
6872
dependencies: List[CommunityProject] = Nil,
6973
sbtPublishCommand: String = null) extends CommunityProject:
7074
override val binaryName: String = "sbt"
@@ -77,10 +81,14 @@ final case class SbtCommunityProject(
7781
val sbtProps = Option(System.getProperty("sbt.ivy.home")) match
7882
case Some(ivyHome) => List(s"-Dsbt.ivy.home=$ivyHome")
7983
case _ => Nil
84+
val scalaJSPluginArgs =
85+
if (forceUpgradeSbtScalajsPlugin) List(s"--addPluginSbtFile=$sbtScalaJSPluginFilePath")
86+
else Nil
8087
extraSbtArgs ++ sbtProps ++ List(
8188
"-sbt-version", "1.3.8",
8289
"-Dsbt.supershell=false",
83-
s"--addPluginSbtFile=$sbtPluginFilePath")
90+
s"--addPluginSbtFile=$sbtPluginFilePath"
91+
) ++ scalaJSPluginArgs
8492

8593
object projects:
8694
lazy val utest = MillCommunityProject(
@@ -310,7 +318,8 @@ object projects:
310318

311319
lazy val catsEffect2 = SbtCommunityProject(
312320
project = "cats-effect-2",
313-
sbtTestCommand = "test"
321+
sbtTestCommand = "test",
322+
forceUpgradeSbtScalajsPlugin = true
314323
)
315324

316325
lazy val catsEffect3 = SbtCommunityProject(

project/Build.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,9 @@ object Build {
12041204
s"""updateOptions in Global ~= (_.withLatestSnapshots(false))
12051205
|addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "$sbtDottyVersion")""".stripMargin
12061206
IO.write(baseDirectory.value / "sbt-dotty-sbt", pluginText)
1207+
val scalaJSPluginText =
1208+
s"""addSbtPlugin("org.scala-js" % "sbt-scalajs" % "$scalaJSVersion")\n"""
1209+
IO.write(baseDirectory.value / "sbt-scalajs-sbt", scalaJSPluginText)
12071210
IO.write(baseDirectory.value / "scala3-bootstrapped.version", dottyVersion)
12081211
},
12091212
testOptions in Test += Tests.Argument(

0 commit comments

Comments
 (0)