Skip to content
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

[path_provider] Remove win32 #7073

Merged
merged 7 commits into from
Jul 9, 2024
Merged

Conversation

stuartmorgan
Copy link
Contributor

Per https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#dependencies, we generally do not want third-party dependencies. path_provider in particular is a key part of the ecosystem (well over 1,000 packages depend directly on it, and transitively it's probably several times that at least), and thus the maintenance and security considerations are particularly acute.

This eliminates the dependency on win32, a large third-party dependency, in favor of direct FFI code written from scratch using the official Win32 reference documentation from Microsoft as the source. The only behavioral change that should result here is that the exceptions thrown in failure cases have changed, but they were never documented, and were entirely platform-specific, so it's relatively unlikely that people will be broken by that. (As noted in a TODO, the longer term solution is to provide real exceptions for this package, and use those across platforms.)

Fixes flutter/flutter#130940

Pre-launch Checklist

/// Parses a GUID string, with optional enclosing "{}"s and optional "-"s,
/// into data.
void parse(String guid) {
final String hexOnly = guid.replaceAll(RegExp(r'[{}-]'), '');
Copy link
Member

Choose a reason for hiding this comment

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

package:win32's GUID.parse requires the {}s and -s. Should we do that as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm removing those symbols anyway to make the implementation simple, and since https://en.wikipedia.org/wiki/Universally_unique_identifier#Textual_representation says they are all valid I figured I would just accept all of them and relaxed the API accordingly. I didn't look at the win32 implementation so I don't know if there's a reason they are stricter; the only one I could think of would be efficiency, and I'm pretty confident that it's never going to matter in this use case. (If efficiency were ever actually important the way to go would be to make an API that's not string-based in the first place, and constants that built the GUIDs directly.)

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me, thanks for the thoughtful reply

Copy link
Member

@loic-sharma loic-sharma left a comment

Choose a reason for hiding this comment

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

LGTM, nice work!

@stuartmorgan stuartmorgan added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 9, 2024
Copy link
Contributor

auto-submit bot commented Jul 9, 2024

auto label is removed for flutter/packages/7073, due to - The status or check suite Mac_arm64 ios_platform_tests_shard_4 master has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 9, 2024
@stuartmorgan stuartmorgan added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 9, 2024
@auto-submit auto-submit bot merged commit 47a92db into flutter:main Jul 9, 2024
74 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 9, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 9, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 9, 2024
@stuartmorgan stuartmorgan deleted the win32-removal branch July 9, 2024 19:01
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 10, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 10, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 10, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 10, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 10, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jul 10, 2024
flutter/packages@14341d1...ea35fc6

2024-07-10 [email protected] [camera_avfoundation] Adds Swift Package Manager compatibility (flutter/packages#7080)
2024-07-10 [email protected] [webview_flutter_wkwebview] Adds Swift Package Manager compatibility (flutter/packages#7091)
2024-07-10 [email protected] [webview_flutter_web] Migrate to package:web. (flutter/packages#6792)
2024-07-10 [email protected] [camera] Clean up `maxDuration` code (flutter/packages#7039)
2024-07-10 [email protected] Update espresso dependencies (flutter/packages#7048)
2024-07-09 [email protected] [camera] Fix iOS torch mode regression (flutter/packages#7085)
2024-07-09 [email protected] [google_maps_flutter] Convert Obj-C->Dart calls to Pigeon (flutter/packages#7086)
2024-07-09 [email protected] Roll Flutter from fafd67d to 5103d75 (27 revisions) (flutter/packages#7084)
2024-07-09 [email protected] [camera_avfoundation] fix sample times not being numeric after pause/resume. (flutter/packages#6897)
2024-07-09 [email protected] [camera] Convert Windows to Pigeon (flutter/packages#6925)
2024-07-09 [email protected] [camera] Deprecate `maxDuration` in platform interface (flutter/packages#7078)
2024-07-09 [email protected] [google_maps_flutter] Semi-convert remaining iOS host API calls to Pigeon (flutter/packages#7079)
2024-07-09 [email protected] [path_provider] Remove `win32` (flutter/packages#7073)
2024-07-08 [email protected] [google_maps_flutter] Move iOS inspector to Pigeon (flutter/packages#6937)
2024-07-08 49699333+dependabot[bot]@users.noreply.github.com [camera]: Bump com.android.tools.build:gradle from 7.3.0 to 8.5.0 in /packages/camera/camera_android_camerax/android (flutter/packages#7072)
2024-07-08 49699333+dependabot[bot]@users.noreply.github.com [local_auth]: Bump com.android.tools.build:gradle from 7.3.1 to 8.5.0 in /packages/local_auth/local_auth_android/android (flutter/packages#7069)

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 [email protected],[email protected] 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
ssbigyan pushed a commit to systemsurveyor/flutter-packages that referenced this pull request Sep 3, 2024
…ower than 12 (flutter#4635)

The the solution of the issue flutter/flutter#109769 in the flutter#7073 causes a crashes when the Android SDK version is lower than 31, due to EncoderProfiles not being found on these devices. This issue was solved putting the EncoderProfiles declaration after the check for SDK version.

based on flutter/plugins#7073 by @camsim99.

Fixes flutter/flutter#109769 in Android lower than 12.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: path_provider platform-windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[path_provider] Move Windows implementation off of win32
2 participants