-
Notifications
You must be signed in to change notification settings - Fork 55
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
Scala.js options overwritten on Scala 3 #102
Comments
While any Scala.js-focused project would pick up on a warning during local development, unfortunately for many projects/maintainers Scala.js is a cross-build that primarily depends on CI to be tested. If it does not error fatally the problem is unlikely to be noticed. Context: typelevel/sbt-tpolecat#102, a popular plugin used in many cross-building projects.
I just stumbled across this issue via this project ( github.com/objektwerks/scalajs/blob/master/build.sbt ). To avoid getting this error during sbt clean test ( java.lang.AssertionError: assertion failed: asTerm called on not-a-Term val ), I had to add scalacOptions ++= Seq("-scalajs") to the build.sbt. Apparently sbt-tpolecat was removing the -scalajs option added by the Scalajs plugin ( addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1") ). |
Unfortunately the obvious fix to this - appending the existing |
Beyond simple tasks, Sbt is like an extreme sport. So be careful. :) |
Just bumping this issue, it only occurred for me when I tried to go from
|
Sorry for the silence on this one folks - I'm going mad trying to find a way to solve this without breaking any of the previous behaviours of the library and while still accomodating the ways that folks set the various keys of the library. The combination of |
Sorry for adding more salt to the wound, but I just found that sbt-tpolecat also causes problems with metals / semanticdb; where this plugin ends up removing the required Apparently, the issue is related to the exclusions rule. Test / tpolecatExcludeOptions ++= ScalacOptions.defaultConsoleExclude Then metals is broken on the test files. |
We now maintain a set of `ScalacOptions` "managed" by sbt-tpolecat. When computing `scalacOptions`, we do not overwrite them, but instead we get the previous `scalacOptions.value` and we modify it. We only remove options that are managed by sbt-tpolecat. And we only add options that are not already there (because they were already added in an upper delegate scope). By default, we automatically compute the set of managed options as all the options that are "ever" added once by sbt-tpolecat in the delegate chain.
PR available: #126 |
Fix #102: Do not overwrite other plugins' `scalacOptions`.
I can confirm that reproducer no longer works with a locally published version of the plugin 🎉 |
On Scala 3,
-scalajs
option is required to generate IR files. Without it, the compiler will complain, and the linking will succeed without actually doing anything.In the app you will likely notice it immediately, in the libraries - not so much.
Desired behaviour:
-scalajs
option, if present, is preservedThe text was updated successfully, but these errors were encountered: