-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make Scala.js usable for people #9637
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Commit Messages
We want to keep history, but for that to actually be useful we have
some rules on how to format our commit messages (relevant xkcd).
Please stick to these guidelines for commit messages:
- Separate subject from body with a blank line
- When fixing an issue, start your commit message with
Fix #<ISSUE-NBR>:
- Limit the subject line to 72 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line ("Add" instead of "Added")
- Wrap the body at 80 characters
- Use the body to explain what and why vs. how
adapted from https://chris.beams.io/posts/git-commit
Have an awesome day! ☀️
@@ -169,6 +170,12 @@ object DottyPlugin extends AutoPlugin { | |||
override def projectSettings: Seq[Setting[_]] = { | |||
Seq( | |||
isDotty := scalaVersion.value.startsWith("0.") || scalaVersion.value.startsWith("3."), | |||
isDottyJS := { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way this works basically assumes that the settings of ScalaJSPlugin
will be applied before those of DottyPlugin
. It seems to be the case in the tests I did, perhaps because ScalaJSPlugin
is explicitly enabled, while DottyPlugin
is triggered. However, I could not find an authoritative source on the topic.
I have an alternative implementation in mind, that would not have that assumption: it would be to have another DottyJSPlugin
, that would be auto-triggered by the presence of DottyPlugin
and ScalaJSPlugin
. That plugin would be guaranteed to have its settings be applied after both of them, by the documented rules. However, that would require sbt-dotty
to depend on sbt-scalajs
to be able to refer to ScalaJSPlugin
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully in the not-too-distant future sbt-dotty will be obsoleted by sbt supporting dotty natively, so we need to plan for that too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When that happens, the Scala.js-Dotty combination will have to be handled by sbt-scalajs. Currently though, since apparently DottyPlugin
gets applied after ScalaJSPlugin
, there's nothing sbt-scalajs can do, AFAICT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When that happens, the Scala.js-Dotty combination will have to be handled by sbt-scalajs.
OK, can you add a comment mentioning this around here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
4414a9d
to
a6ff937
Compare
@@ -169,6 +170,12 @@ object DottyPlugin extends AutoPlugin { | |||
override def projectSettings: Seq[Setting[_]] = { | |||
Seq( | |||
isDotty := scalaVersion.value.startsWith("0.") || scalaVersion.value.startsWith("3."), | |||
isDottyJS := { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When that happens, the Scala.js-Dotty combination will have to be handled by sbt-scalajs.
OK, can you add a comment mentioning this around here?
@anatoliykmetyuk To publish a new version of sbt-dotty we just need to push a tag |
c5d9b7c
to
14c1478
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything specific you want me to review here? This seems to be mostly dotty build and library setup plumbing. I have no clue about these :-/
So there is nothing that looks wrong, but I also cannot really gauge if anything is right.
@gzm0 It was mostly about the last commit, which are changes to sbt-dotty that interact with sbt-scalajs in non-obvious ways. |
moduleID.name == "scalajs-library" || moduleID.name == "scalajs-compiler" | ||
) | ||
} | ||
// Apply withDottyCompat to the dependency on scalajs-test-bridge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this applies transitively to scalajs-test-interface
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because the dependency on scalajs-test-interface will be lookup up in its POM file. And in the POM file, this has already been hard-wired to scalajs-test-interface_2.13.
In addition to remove the `-bootstrapped` suffix, we must also remove the `js` suffix.
…ate. So that it gets published together with the rest of the distribution.
This allows `withDottyCompat` to work for Scala.js dependencies, for example.
This also implies changes in the build for JS projects, since they will now get the configuration for JS from `DottyPlugin`.
14c1478
to
0a7d9dc
Compare
Yes, publishing SBT plugin is done by tagging. |
This PR contains a series of polishing commits that make the Scala.js support in Dotty usable for people using Dotty in their projects. After this PR, if someone adds the
ScalaJSPlugin
to a project, and the build has thesbt-dotty
plugin, that project will be correctly configured to use Dotty with the Scala.js support.