Skip to content

[packages] Migrate package groupings to use workspaces #161385

Open

Description

@Rexios80

Now that the workspace feature is stable, it makes sense to start using it. Sub-groupings of packages in the packages repo should be migrated to workspaces.

This migration will enable the following benefits:

  • Dependency overrides will no longer be necessary during development of package updates
  • Only one pub get will be necessary per workspace
  • More efficient code analysis

Justification:

These are the groupings that should be consolidated into workspaces:

  • camera
  • file_selector
  • google_maps_flutter
  • google_sign_in
  • image_picker
  • in_app_purchase
  • local_auth
  • path_provider
  • pointer_interceptor
  • quick_actions
  • shared_preferences
  • url_launcher
  • video_player
  • webview_flutter

Activity

  1. added
    packageflutter/packages repository. See also p: labels.
    on Jan 9, 2025
  2. self-assigned this
    on Jan 9, 2025
  3. stuartmorgan-g commented on Jan 9, 2025

    @stuartmorgan-g
    Contributor

    Do you have a design doc with a proposal for how this would be used and how it would interact with the various CI processes and repo tool options? Just adding workspaces unconditionally won't work for flutter/packages.

    Justification:

    Other repos have different processes, so the fact that a workflow works elsewhere doesn't mean it will work here.

  4. Rexios80 commented on Jan 9, 2025

    @Rexios80
    MemberAuthor

    Tooling might be more efficient if we updated it to support workspaces, but migrating to workspaces shouldn't break any existing tooling since CLI commands behave the same in any workspace package

  5. stuartmorgan-g commented on Jan 9, 2025

    @stuartmorgan-g
    Contributor

    Tooling might be more efficient if we updated it to support workspaces, but migrating to workspaces shouldn't break any existing tooling

    Could you describe how the draft PR does not regress our CI's system of ensuring that updates to a package are compatible with both the cross-package updates and with the currently published packages? A system that was intentionally designed to avoid situations like melos-based CI systems have had where people accidentally published breaking changes as non-breaking without any CI catching it?

  6. Rexios80 commented on Jan 9, 2025

    @Rexios80
    MemberAuthor

    You are correct that the draft PR makes that check not work. We would need to update the tooling to insert a pubspec_overrides.yaml file with an empty resolution key as described here: https://dart.dev/tools/pub/workspaces#temporarily-resolving-a-package-outside-its-workspace

  7. Rexios80 commented on Jan 9, 2025

    @Rexios80
    MemberAuthor

    @stuartmorgan do you think this is worth pursuing further? Workspaces would make development a lot easier in most cases, but they would probably need to be disabled before any analysis is done.

  8. stuartmorgan-g commented on Jan 9, 2025

    @stuartmorgan-g
    Contributor

    I'm not sure what exactly "this" is, which makes that hard to answer. If it's some kind of adoption of workspaces as part of flutter/packages tooling and processes, then sure, and the next step is a design document. If it's the draft PR's approach of just unconditionally enabling it without regard for how it will affect the existing systems, then no, because I'm not going to approve a PR without a doc that gives me confidence that the effects have been sufficiently evaluated (and certainly not a PR that I'm confident regresses critical safety features of our current system).

  9. stuartmorgan-g commented on Jan 9, 2025

    @stuartmorgan-g
    Contributor

    (Also, even ignoring CI, the assertion that the change as written will not break any existing tooling is almost certainly incorrect; the repo tooling makes inferences about what kinds of packages things are based on detection of what is a package and what is an enclosing folder, and adding puspec.yaml to directories that did not previous have them makes the assumptions several parts of the tooling are built on incorrect.)

  10. Rexios80 commented on Jan 9, 2025

    @Rexios80
    MemberAuthor

    I'm not sure what exactly "this" is

    I meant the adoption of workspaces in the flutter/packages repository

    If it's the draft PR's approach of just unconditionally enabling it without regard for how it will affect the existing systems

    I didn't intend for that PR to land as-is. I wanted to see how much, if any, of the existing CI infrastructure would be unhappy with the change.

    adding puspec.yaml to directories that did not previous have them...

    Yes we would need to handle the new workspace pubspecs, as is evidenced by CI failures in the draft PR

    the next step is a design document

    This is a process I have not done before, and I am not sure when or if I will be able to create a design document for this. I will close the draft PR since I got the information I needed from it, and leave this issue for someone else to tackle if they wish.

  11. removed their assignment
    on Jan 9, 2025
  12. added
    c: contributor-productivityTeam-specific productivity, code health, technical debt.
    P3Issues that are less important to the Flutter project
    on Jan 9, 2025
  13. stuartmorgan-g commented on Jun 4, 2025

    @stuartmorgan-g
    Contributor

    Some other wrinkles:

    If we do a whole-repo workspace:

    • We could get significant differences in external dependency resolution for some packages. E.g., if one package allows foo: >= 0.1.0 < 0.30 and another unrelated package allows foo: ^0.1.0, we'll still always analyze the first package with foo 0.1.x even though many of its clients would get 0.2.x.
    • Major version bumps of our own packages where there are interdependencies would become problematic. (make-deps-path-based handles this, in contrast.)

    If we don't do a whole-repo workspace, then we can't do pathified analysis of our cross-package dependencies unless we maintain the current system in addition, adding a bunch of complexity to the repo tool. That analysis has occasionally prevented us from post-publish OOB breaking in our example apps (usually due to analyzer issues that we treat as errors).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: contributor-productivityTeam-specific productivity, code health, technical debt.packageflutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions