packages icon indicating copy to clipboard operation
packages copied to clipboard

[camera_web] Migrate to `package:web`

Open Rexios80 opened this issue 1 year ago • 5 comments

Fixes https://github.com/flutter/flutter/issues/139748

Notes:

  • Some fields are no longer nullable in package:web. We need to decide if we want to make them nullable again.

Pre-launch Checklist

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

Rexios80 avatar Jun 28 '24 19:06 Rexios80

I figured out how to run the tests compiled to WASM. Working on resolving the issues.

Rexios80 avatar Jun 28 '24 20:06 Rexios80

Alright I think all the tests pass when compiled to WASM now

Rexios80 avatar Jun 29 '24 00:06 Rexios80

The example app is having this issue: https://github.com/flutter/flutter/issues/146539

Rexios80 avatar Jun 29 '24 00:06 Rexios80

I figured out how to run the tests compiled to WASM. Working on resolving the issues.

@Rexios80 Please describe? :)

ditman avatar Jun 29 '24 03:06 ditman

@ditman it's just flutter drive -d chrome --wasm

Probably requires master channel

Rexios80 avatar Jun 29 '24 03:06 Rexios80

This is just a reminder to myself to merge with main and update https://github.com/flutter/packages/blob/main/script/configs/exclude_all_packages_app_wasm.yaml to remove this plugin from the exclusions

(away from dev computer right now)

Rexios80 avatar Jul 11 '24 20:07 Rexios80

Will work on this next, will try to get the update with main done and review locally. Thanks @Rexios80!

ditman avatar Jul 11 '24 22:07 ditman

Force-pushed the rebase, but I think I broke:

integration_test/zoom_level_capability_test.dart is being served at http://localhost:7357

It seems to be timing out :/

ditman avatar Jul 12 '24 02:07 ditman

I'm not sure what the Flutter team's policy is for rebase vs merge commits but I much prefer merge commits for the future if that's okay with you. It appears that the rebase invalidated my commit signing and we also lost easy access to the old CI runs.

Rexios80 avatar Jul 12 '24 04:07 Rexios80

@ditman It runs fine for me individually

Rexios80 avatar Jul 12 '24 18:07 Rexios80

Okay the test hangs locally too... but the Chrome dev console says the tests pass

 This app is linked to the debug service: ws://127.0.0.1:64966/3_JgbVVF6ak=/ws
dart_sdk.js:37972 00:00 +0: CameraWebException sets all properties
dart_sdk.js:37972 00:00 +1: CameraWebException toString includes all properties
dart_sdk.js:37972 00:00 +2: (tearDownAll)
dart_sdk.js:37972 00:00 +3: All tests passed!
:7357/$dwdsSseHandler?sseClientId=InjectedClient-25923bcd-467a-457b-98b1-ba47d869a2ac:1 
        
        
       Failed to load resource: net::ERR_CONNECTION_REFUSED

Is this an issue with the test driver?

Rexios80 avatar Jul 12 '24 21:07 Rexios80

Related to https://github.com/flutter/flutter/issues/151561#issuecomment-2226200260 maybe?

Rexios80 avatar Jul 12 '24 21:07 Rexios80

This is happing in a PR without these changes so it's not this PR's fault

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8742583604102720209/+/u/Run_package_tests/drive_examples/stdout

Rexios80 avatar Jul 12 '24 22:07 Rexios80

I much prefer merge commits for the future if that's okay with you.

Yep, apologies @Rexios80, I normally only rebase in my own branches or things that are "one commit away" from landing, didn't mean to mess the branch too badly!

About running the tests in --wasm, it's a nice to have, but shouldn't be a blocker. Maybe the test that I saw hanging happened because my flutter master wasn't new enough to get the --canvaskit fixes (?).

I'll come back to this PR ASAP!

ditman avatar Jul 17 '24 02:07 ditman

@ditman The reason I think WASM integration tests should block this is because I'm 100% sure they are failing even if the canvaskit tests pass. I think https://github.com/flutter/flutter/issues/146539 is the biggest issue right now for compiling plugins to WASM that have platform views. I'm willing to bet every single plugin that deals with platform views has failing WASM integration tests because of that issue.

Rexios80 avatar Jul 22 '24 12:07 Rexios80

Actually it looks like a possible fix for that issue was recently merged. Let me test it.

Rexios80 avatar Jul 22 '24 12:07 Rexios80

Welp video_player_web needs updated to package:web version 1.0.0 to test that. I'm really confused how the example is even resolving dependencies right now. Isn't 0.x.x to 1.x.x supposed count as a major version increase? But somehow the example is resolving web: 1.0.0 even though video_player_web depends on a 0.x.x version?????? Which is causing compile time errors. Is this known behavior? If not that's a pretty bad bug in dependency resolution.

Rexios80 avatar Jul 22 '24 12:07 Rexios80

The pub get is failing in CI which is even more confusing. I'm on the latest Flutter commit locally and flutter pub get succeeds in packages/camera/camera/example and resolves web: 1.0.0

Rexios80 avatar Jul 22 '24 12:07 Rexios80

I have some good news! The fix for platform view rendering seems to work for google_maps_flutter at least. You can see it in action here: https://beta.madadmaps.com/

I'm still having issues with pointer_interceptor when compiled to WASM. Maybe WASM integration tests would help catch that issue? Tracking here: https://github.com/flutter/flutter/issues/152109

Rexios80 avatar Jul 22 '24 16:07 Rexios80

Welp video_player_web needs updated to package:web version 1.0.0 to test that. I'm really confused how the example is even resolving dependencies right now. Isn't 0.x.x to 1.x.x supposed count as a major version increase? But somehow the example is resolving web: 1.0.0 even though video_player_web depends on a 0.x.x version?????? Which is causing compile time errors. Is this known behavior? If not that's a pretty bad bug in dependency resolution.

It's actually resolving the version of video_player_web before package:web was added which is... I guess technically correct? But quite unfortunate.

Rexios80 avatar Jul 23 '24 16:07 Rexios80

I'm still having issues with pointer_interceptor when compiled to WASM. Maybe WASM integration tests would help catch that issue? Tracking here: https://github.com/flutter/flutter/issues/152109

This is being currently looked at (by @eyebrowsoffire), IIRC this is also affecting dart devtools, so it's a high priority!

It's actually resolving the version of video_player_web before package:web was added which is... I guess technically correct? But quite unfortunate.

Yikes, I didn't see this one coming, I guess there can be multiple plugins with the same issue with the way that we version. I'll see what's up with the package:web 1 stuff.

ditman avatar Jul 23 '24 18:07 ditman

Because every version of cross_file from path depends on web ^0.5.0
and every version of camera_web from path depends on web ^1.0.0,
cross_file from path is incompatible with camera_web from path.

I'm going to try and create a migration from web:^0.5.0 to ^1.0.0, so this change lands more smoothly.

ditman avatar Jul 23 '24 19:07 ditman

@ditman You'll probably have to migrate all packages to web 1.0.0 to fix that error. That's just the first issue dependency resolution ran into. There's an issue to track that migration here: https://github.com/flutter/flutter/issues/151981

Rexios80 avatar Jul 23 '24 19:07 Rexios80

Getting

UnimplementedError: CrossFile is not available in your current platform.

when running integration tests compiled to WASM. Caused by cross_file not supporting web: 1.0.0 yet.

Blocked on

  • https://github.com/flutter/packages/pull/7202

Rexios80 avatar Jul 26 '24 01:07 Rexios80

https://github.com/flutter/packages/pull/7202 is ready to land.

ditman avatar Aug 01 '24 02:08 ditman

https://github.com/flutter/packages/pull/7202 landed!

kevmoo avatar Aug 01 '24 22:08 kevmoo

@ditman Is there an issue to track cleaning up code related to script/configs/exclude_all_packages_app_wasm.yaml after this PR lands?

Rexios80 avatar Aug 01 '24 22:08 Rexios80

@Rexios80 just created this one:

  • https://github.com/flutter/flutter/issues/152716

ditman avatar Aug 01 '24 23:08 ditman

(I have some time, I'm going to rebase this branch to make it match the rest of the repo!)

ditman avatar Aug 01 '24 23:08 ditman

type 'Null' is not a subtype of type 'YamlList' in type cast
...
#6      PackageCommand._expandYamlInPackageList (package:flutter_plugin_tools/src/common/package_command.dart:292:8)
#7      PackageCommand.getExcludedPackageNames (package:flutter_plugin_tools/src/common/package_command.dart:298:9)
...

Hehe, looks like the tool doesn't like the exclusion yaml file to be completely empty!

ditman avatar Aug 02 '24 01:08 ditman