You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running melos bootstrap with repos that contain dart packages with examples can sometimes fail because of race conditions, where flutter will try to resolve the example project before melos has a chance to write its pubspec_overrides.yaml
e.g. when running melos bootstrap in a clean clone of the oidc package, you can see oidc_web_core/pubspec_overrides.yaml present, but oidc_web_core/examples/pubspec_overrides.yaml is not generated yet.
this causes the following exception:
melos bootstrap └> D:\packages\oidcRunning "flutter pub get" in workspace packages... ✓ oidc └> packages/oidc ✓ oidc_example └> packages/oidc/example ✓ oidc_android └> packages/oidc_android ✓ oidc_example_android └> packages/oidc_android/example ✓ oidc_core └> packages/oidc_core ✓ oidc_default_store └> packages/oidc_default_store ✓ oidc_desktop └> packages/oidc_desktop ✓ oidc_flutter_appauth └> packages/oidc_flutter_appauth ✓ oidc_ios └> packages/oidc_ios ✓ oidc_linux └> packages/oidc_linux ✓ oidc_loopback_listener └> packages/oidc_loopback_listener ✓ oidc_macos └> packages/oidc_macos ✓ oidc_platform_interface └> packages/oidc_platform_interface ✓ oidc_web └> packages/oidc_web ✓ oidc_example_web └> packages/oidc_web/example - oidc_web_core └> packages/oidc_web_core └> Failed to install.Resolving dependencies...Downloading packages...
# other deps commented for brevity ...! oidc_core 0.8.0 from path ..\oidc_core (overridden in .\pubspec_overrides.yaml)Changed 65 dependencies!6 packages have newer versions incompatible with dependency constraints.Try `dart pub outdated` for more information.
# this is the problematic line, where flutter tries to execute pub get on the example before melos is able to create its overrides ...Resolving dependencies in `.\example`...Because oidc_web_core_example depends on oidc_core ^0.8.0 which doesn't match any versions, version solving failed.BootstrapException: Failed to install.: oidc_web_core at d:\packages\oidc\packages\oidc_web_core.
Steps to reproduce
git clone https://github.com/Bdaya-Dev/oidc && cd oidc
git clean -xdf to make sure all caches are removed
melos bs
Expected behavior
Melos should first create pubspec_overrides.yaml for all packages, then execute pub get on them in arbitrary order
Screenshots
No response
Additional context and comments
I tried running melos bootstrap --no-example, and the first problem was resolved, but then I am facing a different error:
d:\packages\oidc\packages\oidc\example\.dart_tool\package_config.json does not exist.Did you run this command from the same directory as your pubspec.yaml file?BootstrapException: Failed to install.: oidc at d:\packages\oidc\packages\oidc.
the only workaround I have found to solve this is to run the following commands in this specific order:
melos bs
melos bs --no-example
The text was updated successfully, but these errors were encountered:
ahmednfwela
changed the title
fix: bootstrap race condition causes flutter example to be restored before its pubspec_overrides.yaml is written
fix: bootstrap race condition causes dart example to be restored before its pubspec_overrides.yaml is written
Nov 24, 2024
A workaround is to use path dependencies for the examples, since its not that important that it's not published anywhere (usually) explicit versions doesn't matter as much as for packages and apps.
yes, but I think the root problem is that melos is writing pubspec_overrides.yaml and then running pub get immediately, the correct approach would be to write out all the yaml files and then the order of running pub get will not matter
Is there an existing issue for this?
Version
6.2.0
Description
Running
melos bootstrap
with repos that contain dart packages with examples can sometimes fail because of race conditions, where flutter will try to resolve the example project before melos has a chance to write itspubspec_overrides.yaml
e.g. when running
melos bootstrap
in a clean clone of the oidc package, you can seeoidc_web_core/pubspec_overrides.yaml
present, butoidc_web_core/examples/pubspec_overrides.yaml
is not generated yet.this causes the following exception:
Steps to reproduce
git clone https://github.com/Bdaya-Dev/oidc && cd oidc
git clean -xdf
to make sure all caches are removedmelos bs
Expected behavior
Melos should first create
pubspec_overrides.yaml
for all packages, then execute pub get on them in arbitrary orderScreenshots
No response
Additional context and comments
I tried running
melos bootstrap --no-example
, and the first problem was resolved, but then I am facing a different error:the only workaround I have found to solve this is to run the following commands in this specific order:
The text was updated successfully, but these errors were encountered: