diff --git a/community-build/community-projects/munit b/community-build/community-projects/munit index 84325e516d47..3ce72dda2454 160000 --- a/community-build/community-projects/munit +++ b/community-build/community-projects/munit @@ -1 +1 @@ -Subproject commit 84325e516d47401c735a8a5132d1763d75033ce8 +Subproject commit 3ce72dda2454d1a1cd8d1b150d3b9120cd541869 diff --git a/community-build/community-projects/scala-parallel-collections b/community-build/community-projects/scala-parallel-collections index 4f0cc945bc83..0d8cdab0b16c 160000 --- a/community-build/community-projects/scala-parallel-collections +++ b/community-build/community-projects/scala-parallel-collections @@ -1 +1 @@ -Subproject commit 4f0cc945bc83d00104ad88faf36934f94e1658ad +Subproject commit 0d8cdab0b16cc1c17dd2867cb2300b30f1e53cc6 diff --git a/community-build/community-projects/scalatest b/community-build/community-projects/scalatest index d6e75ea20cc2..5098af41b4b8 160000 --- a/community-build/community-projects/scalatest +++ b/community-build/community-projects/scalatest @@ -1 +1 @@ -Subproject commit d6e75ea20cc2d8b2ba5b9d2b08400c118f3556eb +Subproject commit 5098af41b4b8dfca2b0844f83a28bbf7351eca49 diff --git a/community-build/community-projects/scalatestplus-scalacheck b/community-build/community-projects/scalatestplus-scalacheck index fb66f0cfa9ca..010387f5854e 160000 --- a/community-build/community-projects/scalatestplus-scalacheck +++ b/community-build/community-projects/scalatestplus-scalacheck @@ -1 +1 @@ -Subproject commit fb66f0cfa9ca4bf7abe2c32fef83d0b6f1a157d2 +Subproject commit 010387f5854eb473ddc71ecd2d6a0183dfebfbcb diff --git a/community-build/community-projects/scodec b/community-build/community-projects/scodec index 620880b81bff..2aff4c2f11bc 160000 --- a/community-build/community-projects/scodec +++ b/community-build/community-projects/scodec @@ -1 +1 @@ -Subproject commit 620880b81bff1cb365f28ff4cbf93e799265bf4d +Subproject commit 2aff4c2f11bcd9f4d108f82754da2eba02c61297 diff --git a/community-build/community-projects/scodec-bits b/community-build/community-projects/scodec-bits index dc2c5ee6560e..c6dbf213f2e8 160000 --- a/community-build/community-projects/scodec-bits +++ b/community-build/community-projects/scodec-bits @@ -1 +1 @@ -Subproject commit dc2c5ee6560ec0b6430736358a539311ad6cc00f +Subproject commit c6dbf213f2e8b442b0584af702ee830579147993 diff --git a/community-build/sbt-scalajs-sbt b/community-build/sbt-scalajs-sbt deleted file mode 100644 index 8f1d0ac9bcc4..000000000000 --- a/community-build/sbt-scalajs-sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.1") diff --git a/community-build/src/scala/dotty/communitybuild/projects.scala b/community-build/src/scala/dotty/communitybuild/projects.scala index 6fdc5658cfdd..a14eb96e11d2 100644 --- a/community-build/src/scala/dotty/communitybuild/projects.scala +++ b/community-build/src/scala/dotty/communitybuild/projects.scala @@ -15,9 +15,6 @@ lazy val sbtPluginFilePath: String = new File(sys.props("user.home") + "/.sbt/1.0/plugins").mkdirs() communitybuildDir.resolve("sbt-dotty-sbt").toAbsolutePath().toString() -lazy val sbtScalaJSPluginFilePath: String = - communitybuildDir.resolve("sbt-scalajs-sbt").toAbsolutePath().toString() - def log(msg: String) = println(Console.GREEN + msg + Console.RESET) /** Executes shell command, returns false in case of error. */ @@ -30,6 +27,18 @@ def exec(projectDir: Path, binary: String, arguments: String*): Int = exitCode +/** Versions of published projects, needs to be updated when a project in the build is updated. + * + * TODO: instead of harcoding these numbers, we could get them from the + * projects themselves. This likely requires injecting a custom task in the + * projects to output the version number to a file. + */ +object Versions: + val scalacheck = "1.15.2-SNAPSHOT" + val scalatest = "3.2.3" + val munit = "0.7.19+DOTTY-SNAPSHOT" + val scodecBits = "1.1+DOTTY-SNAPSHOT" + sealed trait CommunityProject: private var published = false @@ -68,15 +77,26 @@ final case class SbtCommunityProject( project: String, sbtTestCommand: String, extraSbtArgs: List[String] = Nil, - forceUpgradeSbtScalajsPlugin: Boolean = false, dependencies: List[CommunityProject] = Nil, sbtPublishCommand: String = null) extends CommunityProject: override val binaryName: String = "sbt" + // A project in the community build can depend on an arbitrary version of + // another project in the build, so we force the use of the version that is + // actually in the community build. val dependencyOverrides = List( // dependencyOverrides doesn't seem to understand `%%%` - """"org.scalacheck" %% "scalacheck" % "1.15.2-SNAPSHOT"""", - """"org.scalacheck" %% "scalacheck_sjs1" % "1.15.2-SNAPSHOT"""" + s""""org.scalacheck" %% "scalacheck" % "${Versions.scalacheck}"""", + s""""org.scalacheck" %% "scalacheck_sjs1" % "${Versions.scalacheck}"""", + s""""org.scalatest" %% "scalatest" % "${Versions.scalatest}"""", + s""""org.scalatest" %% "scalatest_sjs1" % "${Versions.scalatest}"""", + s""""org.scalameta" %% "munit" % "${Versions.munit}"""", + s""""org.scalameta" %% "munit_sjs1" % "${Versions.munit}"""", + s""""org.scalameta" %% "munit-scalacheck" % "${Versions.munit}"""", + s""""org.scalameta" %% "munit-scalacheck_sjs1" % "${Versions.munit}"""", + s""""org.scalameta" %% "junit-interface" % "${Versions.munit}"""", + s""""org.scodec" %% "scodec-bits" % "${Versions.scodecBits}"""", + s""""org.scodec" %% "scodec-bits_sjs1" % "${Versions.scodecBits}"""", ) private val baseCommand = @@ -92,14 +112,11 @@ final case class SbtCommunityProject( val sbtProps = Option(System.getProperty("sbt.ivy.home")) match case Some(ivyHome) => List(s"-Dsbt.ivy.home=$ivyHome") case _ => Nil - val scalaJSPluginArgs = - if (forceUpgradeSbtScalajsPlugin) List(s"--addPluginSbtFile=$sbtScalaJSPluginFilePath") - else Nil extraSbtArgs ++ sbtProps ++ List( "-sbt-version", "1.4.4", "-Dsbt.supershell=false", s"--addPluginSbtFile=$sbtPluginFilePath" - ) ++ scalaJSPluginArgs + ) object projects: lazy val utest = MillCommunityProject( @@ -127,19 +144,19 @@ object projects: lazy val ujson = MillCommunityProject( project = "upickle", baseCommand = s"ujson.jvm[$compilerVersion]", - dependencies = List(scalatest, scalacheck, scalatestplusScalacheck, geny) + dependencies = List(geny) ) lazy val upickle = MillCommunityProject( project = "upickle", baseCommand = s"upickle.jvm[$compilerVersion]", - dependencies = List(scalatest, scalacheck, scalatestplusScalacheck, geny, utest) + dependencies = List(geny, utest) ) lazy val upickleCore = MillCommunityProject( project = "upickle", baseCommand = s"core.jvm[$compilerVersion]", - dependencies = List(scalatest, scalacheck, scalatestplusScalacheck, geny, utest) + dependencies = List(geny, utest) ) lazy val geny = MillCommunityProject( @@ -280,21 +297,25 @@ object projects: ) lazy val munit = SbtCommunityProject( - project = "munit", - sbtTestCommand = "testsJVM/test", + project = "munit", + sbtTestCommand = "testsJVM/test;testsJS/test;", + // Hardcode the version to avoid having to deal with something set by sbt-dynver + sbtPublishCommand = s"""set every version := "${Versions.munit}"; munitJVM/publishLocal; munitJS/publishLocal; munitScalacheckJVM/publishLocal; munitScalacheckJS/publishLocal; junit/publishLocal""", + dependencies = List(scalacheck) ) lazy val scodecBits = SbtCommunityProject( project = "scodec-bits", - sbtTestCommand = "coreJVM/test", - sbtPublishCommand = "coreJVM/publishLocal", - dependencies = List(scalatest, scalacheck, scalatestplusScalacheck) + sbtTestCommand = "coreJVM/test;coreJS/test", + // Hardcode the version to avoid having to deal with something set by sbt-git + sbtPublishCommand = s"""set every version := "${Versions.scodecBits}"; coreJVM/publishLocal;coreJS/publishLocal""", + dependencies = List(munit) ) lazy val scodec = SbtCommunityProject( project = "scodec", sbtTestCommand = "unitTests/test", - dependencies = List(scalatest, scalacheck, scalatestplusScalacheck, scodecBits) + dependencies = List(munit, scodecBits) ) lazy val scalaParserCombinators = SbtCommunityProject( @@ -320,8 +341,7 @@ object projects: lazy val catsEffect2 = SbtCommunityProject( project = "cats-effect-2", - sbtTestCommand = "test", - forceUpgradeSbtScalajsPlugin = true + sbtTestCommand = "test" ) lazy val catsEffect3 = SbtCommunityProject( diff --git a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala index 747893264b43..bcefd88aa726 100644 --- a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala +++ b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala @@ -93,8 +93,6 @@ class CommunityBuildTestA extends CommunityBuildTest: @Test def scalatest = projects.scalatest.run() @Test def scalatestplusScalacheck = projects.scalatestplusScalacheck.run() @Test def sourcecode = projects.sourcecode.run() - @Test def scodec = projects.scodec.run() - @Test def scodecBits = projects.scodecBits.run() @Test def ujson = projects.ujson.run() @Test def upickle = projects.upickle.run() @Test def utest = projects.utest.run() @@ -114,6 +112,8 @@ class CommunityBuildTestB extends CommunityBuildTest: @Test def intent = projects.intent.run() @Test def minitest = projects.minitest.run() @Test def munit = projects.munit.run() + @Test def scodec = projects.scodec.run() + @Test def scodecBits = projects.scodecBits.run() @Test def scalap = projects.scalap.run() @Test def scalaCollectionCompat = projects.scalaCollectionCompat.run() @Test def scalaParallelCollections = projects.scalaParallelCollections.run() diff --git a/project/Build.scala b/project/Build.scala index 614719e8cfa6..916b7f2e4719 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1309,11 +1309,9 @@ object Build { // (publishLocal in `scala3-staging`).value val pluginText = s"""updateOptions in Global ~= (_.withLatestSnapshots(false)) - |addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "$sbtDottyVersion")""".stripMargin + |addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "$sbtDottyVersion") + |addSbtPlugin("org.scala-js" % "sbt-scalajs" % "$scalaJSVersion")""".stripMargin IO.write(baseDirectory.value / "sbt-dotty-sbt", pluginText) - val scalaJSPluginText = - s"""addSbtPlugin("org.scala-js" % "sbt-scalajs" % "$scalaJSVersion")\n""" - IO.write(baseDirectory.value / "sbt-scalajs-sbt", scalaJSPluginText) IO.write(baseDirectory.value / "scala3-bootstrapped.version", dottyVersion) }, testOptions in Test += Tests.Argument(