Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Conversation

@harryterkelsen
Copy link
Contributor

If building for WASM, change the default target to build the WASM artifacts needed by the Web SDK.

This change is necessary for gn gen to work when target_cpu = "wasm" since the imports from //flutter/BUILD.gn lead to a check in //flutter/shell/platform/BUILD.gn which throws if the target CPU is not recognized.

We do not (currently?) want to compile the Flutter SDK to WASM. Our only current use case is building CanvasKit for the Flutter Web SDK.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

BUILD.gn Outdated
]
if (target_os == "wasm") {
deps = [
"//flutter/web_sdk/wasm:wasm_artifacts"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think if we change things here, we should just make some specific target for wasm e.g. //flutter/wasm that is not specific to the web_sdk.

Alternatively, we should do this in //flutter/BUILD.gn.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Putting it in //flutter/BUILD.gn causes problems due to targets and imports eventually leading somewhere that will throw due to target_cpu = "wasm". But putting it in //flutter/wasm/BUILD.gn sounds good to me. The WASM stuff needs to be quarantined from the normal Flutter SDK build rules because otherwise gn gen will error out.

@harryterkelsen
Copy link
Contributor Author

FYI here is the corresponding engine change with the //flutter/wasm/BUILD.gn rules in it: flutter/engine#32510

BUILD.gn Outdated
]
if (target_os == "wasm") {
deps = [
"//flutter/wasm:wasm_artifacts"
Copy link
Contributor

Choose a reason for hiding this comment

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

Uber not: just make the target wasm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants