dart-lang / native

Dart packages related to FFI and native assets bundling.
BSD 3-Clause "New" or "Revised" License
117 stars 40 forks source link

[infra] Convert this mono_repo to use pub workspaces #1223

Open dcharkes opened 3 months ago

dcharkes commented 3 months ago

From Dart 3.5 on, pub supports single resolution for related packages.

This would be very useful for:

We can get rid of all the path dependencies / overrides.

Also, having a single resolution ensures that package:jni for example doesn't have any dependency conflicts with package:native_assets_cli.

It might be a slight over-specification to have all packages in this repo as a single resolution, and it would mean bumping major versions needs to be done in PRs that touch all packages. But that might be a small price to pay.

We have to wait until Dart 3.5 reaches stable, the SDK constraint for the packages must be at least 3.5, and we don't want to push the packages to only work on beta/dev.

Thanks for the great work @sigurdm! ❤️

FYI @HosseinYousefi @liamappelbe @mosuem

dcharkes commented 3 months ago

We might also need the resolution: local feature (https://github.com/dart-lang/pub/issues/4317), we have some example/test projects with a pubspec.yaml that are intentionally a different resolution:

@sigurdm What about projects that have sdk: flutter how does that relate to the requirement to have sdk: 3.5.0?

sigurdm commented 3 months ago

What about projects that have sdk: flutter how does that relate to the requirement to have sdk: 3.5.0?

If you have sdk:flutter you need to have a flutter sdk with a dart that includes that specific version. (You might get away with pointing FLUTTER_ROOT to a flutter repo if you just want to resolve)

sigurdm commented 3 months ago

flutter commands (flutter_tools) still don't support workspaces. We'll have to wait for https://github.com/flutter/flutter/issues/150196