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

Proposal: package_incompatibilities.yaml in the Dart SDK #3962

Open
jonasfj opened this issue Jul 4, 2023 · 4 comments
Open

Proposal: package_incompatibilities.yaml in the Dart SDK #3962

jonasfj opened this issue Jul 4, 2023 · 4 comments
Labels
type-enhancement A request for a change that isn't a bug

Comments

@jonasfj
Copy link
Member

jonasfj commented Jul 4, 2023

The general idea is that in the root of the Dart SDK we should introduce a package_incompatibilities.yaml file.
It should sit next to the existing version and revision files, and it should be explained in the README.md file.

The package_incompatibilities.yaml file should have the following form:

incompatibilities:
- package: foo
  ranges:
  - >=3.0.0 <3.1.0
  reason: |-
    Libraries opt-out of null-safety using language version marker.
- package: bar
  ranges:
  - 1.0.0
  - 1.2.0
  reason: |-
    Relies on APIs that were removed in Dart 3.0.0

In essences the file would allow SDK developers to declare specific package versions to be incompatible with future versions of the Dart SDK.

Behavior:

  • If a package version matching package_incompatibilities.yaml is in pubspec.lock then using it is fine.
  • Otherwise, dart pub get should never allow a package version matched in package_incompatibilities.yaml.
  • If a conflict arises, then the "reason" from package_incompatibilities.yaml can be surfaced.

Use cases:

  • We've removed a deprecated API or feature that only affects a few packages.
  • We're using an experimental feature and published with SDK constraint ^3.1.0-dev instead of >=3.1.0-dev <3.1.0 (and we regret it because the experimental feature was changed).

Whether we'd frequently want to use this functionality I don't know, I recall a few cases where it would have been a nice tool. I don't envision us wanting to use this frequently or at scale.

Mostly, I'm writing this proposal, so that we can consider implementing it should become relevant in the future.

@jonasfj jonasfj added the type-enhancement A request for a change that isn't a bug label Jul 4, 2023
@LongXiangGuo
Copy link

It's sounds more like to verify the runtime error in the pub get phase, that's a good idea.

@dcharkes
Copy link
Contributor

  • We're using an experimental feature and published with SDK constraint ^3.1.0-dev instead of >=3.1.0-dev <3.1.0 (and we regret it because the experimental feature was changed).

That could be useful for restricting packages that implement a protocol that talks with the Dart SDK dart-lang/native#93.

If @bkonyi ever needs to do a breaking change to the vm_service again (hopefully never), It would also help there I believe.

@bkonyi
Copy link
Contributor

bkonyi commented Jan 25, 2024

If @bkonyi ever needs to do a breaking change to the vm_service again (hopefully never), It would also help there I believe.

I'm not sure it'd help with package:vm_service. The VM service target could be running on a version of the SDK that's compatible with the version of package:vm_service used by a client that's using an older SDK that would have an incompatible protocol version. I think this feature only helps cases where the protocol and package are used in the same runtime instance.

@dcharkes
Copy link
Contributor

I'm not sure it'd help with package:vm_service. The VM service target could be running on a version of the SDK that's compatible with the version of package:vm_service used by a client that's using an older SDK that would have an incompatible protocol version. I think this feature only helps cases where the protocol and package are used in the same runtime instance.

Ah right, the vscode plugin contains an already compiled version of the vm_service protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants