-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[flutter_svg] wasm compatibility #8014
[flutter_svg] wasm compatibility #8014
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
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.
Thanks for the contribution!
@@ -36,7 +36,7 @@ dev_dependencies: | |||
sdk: flutter | |||
test: ^1.20.1 | |||
# See https://github.com/flutter/flutter/issues/157626 | |||
vector_graphics: ">=1.1.11+1 <= 1.1.12" | |||
vector_graphics: ">=1.1.11+1 <= 1.1.14" |
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.
1.1.14 doesn't exist yet, so we don't know if it'll be compatible under the versioning system vector_graphics
has used previously.
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.
Not on pub.dev, but I just bumped it here https://github.com/flutter/packages/pull/8014/files#diff-ae3c1055bc547ec174edea702c972431d2d3d46fb9bd78a31378cacf0fd051eaR8
If I don't bump the constraints here, how is it supposed to work?
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.
Sorry, I missed that you were changing vector_graphics
, because #7991 already did vector_graphics
, and the PR title says this is flutter_svg
, not vector_graphics
. If vector_graphics*
still needs changes, those should be a separate PR.
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.
You're right. Didn't notice someone already made vector_graphics wasm compatible. I just fixed the dev_dependency constraint to use the minimum the WASM version. Do you prefer another PR for a single line change (just dev_dependency)?
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.
As long as the changes aren't interdependent, they can be in a single PR. If there are still any cases where you need to both change a package, and change the minimum dependency on that package in another package, that must be multiple PRs because it won't compile in CI.
If you're only changing a dev dependency in v_g_c
, it should be fine to include here. But that would also mean you can't have (and shouldn't need) this change in the PR.
@@ -1,3 +1,7 @@ | |||
## 1.1.14 | |||
|
|||
* Make the package WASM compatible |
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.
Please see the CHANGELOG style guide linked from the PR checklist; this needs to use the repo-standard verb form and punctuation.
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.
updated
@@ -36,7 +36,7 @@ dev_dependencies: | |||
sdk: flutter | |||
test: ^1.20.1 | |||
# See https://github.com/flutter/flutter/issues/157626 | |||
vector_graphics: ">=1.1.11+1 <= 1.1.12" | |||
vector_graphics: ">=1.1.11+1 <= 1.1.14" |
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.
Isn't 1.1.13 the minimum required for wasm compatibility?
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.
vector_graphics was already at 1.1.13, I bumped it to 1.1.14 but the v1.1.13 was not used here, no idea why
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.
You bumped the maximum, not the minimum. The CHANGELOG entry says this PR makes the package wasm compatible, which would generally involve also setting the minimum versions of any dependencies to wasm-compatible versions.
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.
You're right, updated it right now
@@ -22,7 +22,7 @@ dev_dependencies: | |||
flutter_test: | |||
sdk: flutter | |||
# See https://github.com/flutter/flutter/issues/157626 | |||
vector_graphics_compiler: ">=1.1.11+1 <= 1.1.12" | |||
vector_graphics_compiler: ">=1.1.11+1 <= 1.1.13" |
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.
1.1.13 doesn't exist; what's the purpose of this change?
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 same as #8014 (comment)
vector_graphics_codec: ">=1.1.11+1 <= 1.1.12" | ||
vector_graphics_compiler: ">=1.1.11+1 <= 1.1.12" | ||
vector_graphics_compiler: ">=1.1.11+1 <= 1.1.13" |
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.
Same question here as in the other package.
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 same as #8014 (comment)
@@ -13,9 +13,9 @@ dependencies: | |||
sdk: flutter | |||
http: ^1.0.0 | |||
# See https://github.com/flutter/flutter/issues/157626 | |||
vector_graphics: ">=1.1.11+1 <= 1.1.12" | |||
vector_graphics: ">=1.1.11+1 <= 1.1.14" |
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.
Same notes here as in the other package.
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 same as #8014 (comment)
test-exempt: configuration change, rolling dependencies |
Actually, wait. @ditman Why didn't I have to add these packages to (This isn't a blocker for landing this PR, but we should figure out what's going on with our test coverage here.) |
@@ -2,4 +2,4 @@ | |||
// Use of this source code is governed by a BSD-style license that can be | |||
// found in the LICENSE file. | |||
|
|||
export '_debug_web.dart' if (dart.library.io) '_debug_io.dart'; |
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.
This code was changed for wasm support in #7991; why is it being re-changed 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.
Because I didn't now this one works too, I always used the inverse with dart.library.js_interop
to be consistent
@@ -18,9 +18,9 @@ import 'src/svg/theme.dart'; | |||
import 'src/vector_instructions.dart'; | |||
|
|||
export 'src/_initialize_path_ops_io.dart' | |||
if (dart.library.html) 'src/_initialize_path_ops_web.dart'; | |||
if (dart.library.js_interop) 'src/_initialize_path_ops_web.dart'; |
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.
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.
io
is probably more "permanent" a library, for web conditional imports js_interop
has changed in the past (used to be html
).
js_interop
however is going to be with us for a few years, so it probably doesn't matter much which conditional import to do.
(It feels a little bit weird to export "web" first though, but that's just me because I've almost always started from a mobile implementation!)
@stuartmorgan I opened another PR for the package |
Why? Per this comment I'm not clear why you are updating the minimum version in the dependencies on |
Because |
Oh, I see now. I thought the |
@stuartmorgan I fixed the conflics and merged main. If the tests pass I think it's ready to be merged |
vector_graphics_codec: ^1.1.11+1 | ||
vector_graphics_compiler: ^1.1.11+1 | ||
vector_graphics_compiler: ^1.1.13 |
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.
Based on the order things landed, this should be 1.1.14 (vector_graphics
and vector_graphics_compiler
ended up with opposite order of WASM support vs relaxed dependencies, it looks like.)
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.
you're right, fixed
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.
LGTM. Thanks for getting this submitted to the new repository so quickly, and for bearing with the churn while the dust was still settling on the initial import!
@jonahwilliams / @domesticmouse / @ditman Could one of you do the secondary approval? |
@@ -1 +1 @@ | |||
export '_file_io.dart' if (dart.library.html) '_file_none.dart'; | |||
export '_file_io.dart' if (dart.library.js_interop) '_file_none.dart'; |
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.
Sadly, this might still rank this package as NOT wasm-compatible in pub due to issues with configuration specific imports.
Better to do
export '_file_io.dart' if (dart.library.js_interop) '_file_none.dart'; | |
export '_file_none.dart' if (dart.library.io) '_file_io.dart'; |
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.
Other PRs that this one relies on have already landed using this version since #8014 (comment) didn't raise any objection.
Could you elaborate on the issue?
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.
No I can confirm this works because I did it with the fork I published, flutter_svg_plus
You can check the platform support inside the score here https://pub.dev/packages/flutter_svg_plus/score
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 have no doubt that it works at runtime. I'm concerned that the wasm classification on pub.dev
will still be broken without this change.
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.
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.
See https://pub.dev/api/packages/flutter_svg/metrics
Search for package:flutter_svg/src/utilities/file.dart
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.
If you think the score for wasm on pub.dev is wrong, I assure you it is not.
See here https://pub.dev/api/packages/flutter_svg_plus/metrics and here https://pub.dev/api/packages/vector_graphics_compiler/metrics.
The latter is the one which has been already merged using dart.library.js_interop
as a conditional import
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'm confused; I don't see anything in that issue that says that a conditional import based on js_interop
wouldn't work, and it's currently working in practice. Could you point to a specific discussion/comment that makes you think this won't work in the future?
See https://pub.dev/api/packages/flutter_svg/metrics
Search for package:flutter_svg/src/utilities/file.dart
Why are we looking at the published version of flutter_svg
, which doesn't have the fix in this PR and still uses dart:html
?
Given that the published version using |
* main: (1187 commits) [various] Update example app minSdkVersions (flutter#8035) [go_router] Activate leak testing (flutter#7546) [in_app_purchase_storekit] Add restore purchases and receipts (flutter#7964) [interactive_media_ads] Adds remaining methods for internal wrapper of the Android native `BaseManager` (flutter#7943) [google_sign_in/google_identity_services] Clear-up documentation of callbacks in various APIs and uses of those APIs (flutter#8029) [flutter_svg] wasm compatibility (flutter#8014) Applied Gradle Plugins Declaratively for Multiple Plugin Example Apps (Part 2) (flutter#8019) Roll Flutter from 29d40f7f6826 to 73546b3b71a7 (20 revisions) (flutter#8028) [ci] Upload screenshots, logs, and Xcode test results for drive and integration_test runs (flutter#7430) Remove use_modular_headers! from Podfiles (flutter#7796) [camera_avfoundation] enable more than 30 fps (flutter#7394) Roll Flutter from 8591d0c16a6c to 29d40f7f6826 (25 revisions) (flutter#8027) [ci] Add vector_graphics and flutter_svg to autolabeler (flutter#8025) [vector_graphics_compiler] wasm compatibility (flutter#8021) [vector_graphics*] Relax dependency constraints of vector_graphics, vector_graphics_codec, vector_graphics_compiler, flutter_svg (flutter#8018) [various] Add `missing_code_block_language_in_doc_comment` lint to flutter/packages. (flutter#6473) [various] Update example apps to Kotlin 1.9.0 (flutter#7998) [go_router] add current state getter (flutter#7651) Applied Gradle Plugins Declaratively for Multiple Plugin Example Apps (flutter#7968) Roll Flutter from f86b77721524 to 8591d0c16a6c (16 revisions) (flutter#8015) ... # Conflicts: # packages/quick_actions/quick_actions/CHANGELOG.md # packages/quick_actions/quick_actions_ios/CHANGELOG.md # packages/quick_actions/quick_actions_platform_interface/CHANGELOG.md
flutter/packages@bb5a258...72356fd 2024-11-08 stuartmorgan@google.com [various] Update example app minSdkVersions (flutter/packages#8035) 2024-11-07 32538273+ValentinVignal@users.noreply.github.com [go_router] Activate leak testing (flutter/packages#7546) 2024-11-07 louisehsu@google.com [in_app_purchase_storekit] Add restore purchases and receipts (flutter/packages#7964) 2024-11-07 10687576+bparrishMines@users.noreply.github.com [interactive_media_ads] Adds remaining methods for internal wrapper of the Android native `BaseManager` (flutter/packages#7943) 2024-11-07 58529443+srujzs@users.noreply.github.com [google_sign_in/google_identity_services] Clear-up documentation of callbacks in various APIs and uses of those APIs (flutter/packages#8029) 2024-11-07 alex@mariuti.com [flutter_svg] wasm compatibility (flutter/packages#8014) 2024-11-06 jessiewong401@gmail.com Applied Gradle Plugins Declaratively for Multiple Plugin Example Apps (Part 2) (flutter/packages#8019) 2024-11-06 engine-flutter-autoroll@skia.org Roll Flutter from 29d40f7 to 73546b3 (20 revisions) (flutter/packages#8028) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Make
flutter_svg
wasm compatiblePre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.