-
-
Notifications
You must be signed in to change notification settings - Fork 354
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
Link Scala.js using Directory path when available #1714
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This doesn't change any API but makes the Scala.js emit top level exports.
lefou
approved these changes
Jan 29, 2022
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.
Looks good to me. Thank you!
Does this fix #1684 ? |
lefou
added a commit
that referenced
this pull request
May 3, 2022
## Motivation We want to support the latest Scala.js features without breaking the support for older versions. In #1714 I migrated to the new Scala.js API which generated a wrong filename (`main.js` instead of `out.js`) in case the build contained multiple modules. It broke some people tests that were assuming a `out.js` file being created where the real file was a different one. ## Approach Since workers are internal API, this PR takes a step further in insulating them (using the same approach adopted in mill-mima https://github.com/lolgab/mill-mima/pull/42/files) by duplicating its model classes in two sets: - the user facing APIs need to be stable and are serialized to json with upickle - the worker facing APIs need to not depend on mill internals and are unstable/internal. Now the worker is responsible to convert between these two APIs. The user facing API was moved into the main artifact, while the new internal worker-api was moved to a new artifact which is not checked by mima. ## New Features This PR introduces two new targets that deprecate the main `fastOpt` and `fullOpt`: `fastLinkJS` and `fullLinkJS`. These two targets return a `Report` which is an adaptation of the Scala.js API [`Report`](https://www.scala-js.org/api/scalajs-linker-interface/1.10.0/org/scalajs/linker/interface/Report.html) These two targets are polyfilled for Scala.js 0.6 - 1.2 by generating the new output from the old API output. This is needed to make `test` work consistently on all versions since it's hard in Mill to run different targets depending on the value of a target like: ```scala val task = if(scalaJSVersion() > "1.2") fastLinkJSTest else fastOptTest ``` ## Changes - Introduce `Report` adapted from ScalaJS linker API - Introduce `fastLinkJS` and `fastOptJS` which return `Report` - Make test use `fastLinkJSTest` - Make Scala.js 1.2- and 0.6 always link in legacy mode - Pass `forceOutJs` boolean parameter to Worker implementation to switch between Directory API and File (legacy) API - deprecate old implementation Pull request: #1851
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This doesn't change any API but makes the Scala.js emit top level
exports.
Motivation
Thinking about APIs is hard, so I tried to make the process of support the new
faskLinkJS
a two step approach. For now I migrated only the implementation to the new api usingDirectoryOutputPath
(in Scala. js 1.3+ only) but maintaed theout.js
output path. It doesn't fail anymore if you try to export a module from the Scala.js code. At the same time it is not optimal since the ausiliary files are not returned by thefastOpt
task, so are not considered for the tasks cache purposes.