Skip to content

Upgrade to Scala.js 1.3.0. #10013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions community-build/src/scala/dotty/communitybuild/projects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ 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. */
Expand Down Expand Up @@ -65,6 +68,7 @@ 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"
Expand All @@ -77,10 +81,14 @@ 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.3.8",
"-Dsbt.supershell=false",
s"--addPluginSbtFile=$sbtPluginFilePath")
s"--addPluginSbtFile=$sbtPluginFilePath"
) ++ scalaJSPluginArgs

object projects:
lazy val utest = MillCommunityProject(
Expand Down Expand Up @@ -310,7 +318,8 @@ object projects:

lazy val catsEffect2 = SbtCommunityProject(
project = "cats-effect-2",
sbtTestCommand = "test"
sbtTestCommand = "test",
forceUpgradeSbtScalajsPlugin = true
)

lazy val catsEffect3 = SbtCommunityProject(
Expand Down
12 changes: 7 additions & 5 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ object Build {

fetchScalaJSSource := {
import org.eclipse.jgit.api._
import org.eclipse.jgit.lib._

val s = streams.value
val ver = scalaJSVersion
Expand All @@ -946,12 +947,14 @@ object Build {
new CloneCommand()
.setDirectory(trgDir)
.setURI("https://github.com/scala-js/scala-js.git")
.setNoCheckout(true)
.call()
}

// Checkout proper ref. We do this anyway so we fail if something is wrong
val git = Git.open(trgDir)
s.log.info(s"Checking out Scala.js source version $ver")
git.getRepository().getConfig().setEnum("core", null, "autocrlf", CoreConfig.AutoCRLF.FALSE)
git.checkout().setName(s"v$ver").call()

trgDir
Expand Down Expand Up @@ -1029,7 +1032,7 @@ object Build {
++ (dir / "shared/src/test/require-jdk7" ** "*.scala").get

++ (dir / "js/src/test/scala" ** (("*.scala": FileFilter)
-- "ExportsTest.scala" // JS exports + do not compile because of a var in a structural type
-- "ExportsTest.scala" // JS exports + IR checking error
-- "ObjectTest.scala" // compile errors caused by #9588
-- "StackTraceTest.scala" // would require `npm install source-map-support`
-- "UnionTypeTest.scala" // requires the Scala 2 macro defined in Typechecking*.scala
Expand All @@ -1045,12 +1048,8 @@ object Build {
// Putting them here instead of above makes sure that we do not regress on compilation+linking.
Test / testOptions += Tests.Filter { name =>
!Set[String](
"org.scalajs.testsuite.compiler.InteroperabilityTest", // 3 tests require JS exports, all other tests pass

"org.scalajs.testsuite.jsinterop.AsyncTest", // needs JS exports in PromiseMock.scala
"org.scalajs.testsuite.jsinterop.DynamicTest", // one test requires JS exports, all other tests pass
"org.scalajs.testsuite.jsinterop.JSExportStaticTest", // JS exports
"org.scalajs.testsuite.jsinterop.NonNativeJSTypeTest", // 1 test fails because of a progression for value class fields (needs an update upstream)

// Not investigated so far
"org.scalajs.testsuite.junit.JUnitAbstractClassTestCheck",
Expand Down Expand Up @@ -1205,6 +1204,9 @@ object Build {
s"""updateOptions in Global ~= (_.withLatestSnapshots(false))
|addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "$sbtDottyVersion")""".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(
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// e.g. addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.1.0")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.2.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.0")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.6")

Expand Down
2 changes: 1 addition & 1 deletion sbt-dotty/sbt-test/scalajs/basic/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version"))
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.2.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.0")