Skip to content
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

Update Scala.js to 1.8.0 #597

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
11 changes: 6 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ def scala3 = "3.1.0"
def scala2Versions = List(scala212, scala211, scala213)
def allScalaVersions = scala2Versions :+ scala3

def scalajs = "1.7.1"
def scala2js = "1.8.0"
def scala3js = "1.7.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no reason to make those different. You can always use 1.8.0, since Scala.js IR is backward binary compatible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, except we seem to be running into forward-compatibility problem here only on Scala 3.

mdoc.internal.markdown.ModifierException: mdoc:js exception
Caused by: org.scalajs.ir.IRVersionNotSupportedException: Failed to deserialize a file compiled with Scala.js 1.8 (supported up to: 1.7): /home/runner/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-js/scalajs-library_2.13/1.8.0/scalajs-library_2.13-1.8.0.jar:/scala/volatile.sjsir

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That must be due to something in your infrastructure that I am not familiar with. This is because the linker being used is 1.7.x instead of being 1.8.0. But Scala 3 per se doesn't even get to choose that. It must be something else in your infrastructure that selects the 1.7.x linker, whereas it should always select the 1.8.0 linker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. So @tgodzik it's back to my original question, where else do I need to change the version number 😆

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea 😓 There seem to be no place where we define 1.7 linker so that must be brought in by the compiler maybe? Doesn't the Scala 3 compiler need to be able to read 1.8 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For locally released version everything seems to be correct:

cs resolve -t org.scalameta:mdoc-js_3:2.2.22+71-5ab2f66a+20211222-1821-SNAPSHOT | grep -B 12 -A 10 linker                           
  Result:
└─ org.scalameta:mdoc-js_3:2.2.22+71-5ab2f66a+20211222-1821-SNAPSHOT
   ├─ org.scala-js:scalajs-linker_2.13:1.8.0
   │  ├─ com.google.javascript:closure-compiler:v20211201
   │  ├─ org.scala-js:scalajs-ir_2.13:1.8.0
   │  │  └─ org.scala-lang:scala-library:2.13.6 -> 2.13.7
   │  ├─ org.scala-js:scalajs-linker-interface_2.13:1.8.0
   │  │  ├─ org.scala-js:scalajs-ir_2.13:1.8.0
   │  │  │  └─ org.scala-lang:scala-library:2.13.6 -> 2.13.7
   │  │  ├─ org.scala-js:scalajs-logging_2.13:1.1.1
   │  │  │  └─ org.scala-lang:scala-library:2.13.2 -> 2.13.7
   │  │  └─ org.scala-lang:scala-library:2.13.6 -> 2.13.7
   │  ├─ org.scala-lang:scala-library:2.13.6 -> 2.13.7
   │  └─ org.scala-lang.modules:scala-parallel-collections_2.13:0.2.0
   │     └─ org.scala-lang:scala-library:2.13.0 -> 2.13.7
   ├─ org.scala-lang:scala3-library_3:3.1.0
   │  └─ org.scala-lang:scala-library:2.13.6 -> 2.13.7

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sjrd what would cause it to always work after you upgrade version such as https://github.com/lampepfl/dotty/pull/13734/files ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC (which I very well may not) the Scala 3 compiler uses the .class files of dependencies for compiling. Linking is what uses the .sjsir files and depends on the IR version (hence it is the linker throwing this error), but there is no Scala 3 linker—as described in this blog post:

The .sjsir format and specification is independent of Scala, its compiler or its standard library. In fact, there is nothing Scala-specific in the entire linker, other than a few optimizations targeted at Scala-like code. This is important because it means that the linker is independent of the version of Scala: we use the same linker irrespective of the version of Scala that was used to create the .sjsir files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Classpath for the compiler seems to be:

/home/tgodzik/Documents/mdoc/tests/jsdocs/target/scala-3.1.0/classes:/home/tgodzik/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_sjs1_3/3.1.0/scala3-library_sjs1_3-3.1.0.jar:/home/tgodzik/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-js/scalajs-library_2.13/1.8.0/scalajs-library_2.13-1.8.0.jar:/home/tgodzik/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-js/scalajs-dom_sjs1_3/2.0.0/scalajs-dom_sjs1_3-2.0.0.jar:/home/tgodzik/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.6/scala-library-2.13.6.jar

And the compiler isn't able to read? Should the classpath contain the linker?

def scalajsBinaryVersion = "1"
def scalajsDom = "2.0.0"

Expand Down Expand Up @@ -400,11 +401,11 @@ lazy val js = project
libraryDependencies ++= crossSetting(
scalaVersion.value,
if2 = List(
"org.scala-js" % "scalajs-compiler" % scalajs cross CrossVersion.full,
"org.scala-js" %% "scalajs-linker" % scalajs
"org.scala-js" % "scalajs-compiler" % scala2js cross CrossVersion.full,
"org.scala-js" %% "scalajs-linker" % scala2js
),
if3 = List(
"org.scala-js" %% "scalajs-linker" % scalajs cross CrossVersion.for3Use2_13
"org.scala-js" %% "scalajs-linker" % scala3js cross CrossVersion.for3Use2_13
)
)
)
Expand Down Expand Up @@ -437,7 +438,7 @@ lazy val docs = project
"VERSION" -> stableVersion,
"SCALA_BINARY_VERSION" -> scalaBinaryVersion.value,
"SCALA_VERSION" -> scalaVersion.value,
"SCALAJS_VERSION" -> scalajs,
"SCALAJS_VERSION" -> scala2js,
"SCALAJS_BINARY_VERSION" -> scalajsBinaryVersion,
"SCALAJS_DOM_VERSION" -> scalajsDom
)
Expand Down
2 changes: 1 addition & 1 deletion mdoc-sbt/src/sbt-test/sbt-mdoc/basic/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % sys.props("plugin.version"))
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.1.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.20.0")

libraryDependencies ++= List(
Expand Down