-
Notifications
You must be signed in to change notification settings - Fork 220
Support --version in pub workspace #2538
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
base: master
Are you sure you want to change the base?
Conversation
Closes #2535 Add a check for the `workspace_ref.json` file in place of the `pubspec.lock` file that exists for single package pub solutions. When the workspace ref exists, follow it and read the `package_graph.json` file from the workspace root.
@jonasfj - do you have any concerns about the test running reading |
PR HealthChangelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with |
@natebosch I just noticed this in the comments:
The code just seems to return the |
The existing code path that reads from test/pkgs/test_core/lib/src/runner/version.dart Lines 77 to 95 in cd8e74d
I didn't replicate it mostly because I don't expect it to be worth the effort. Barely anyone uses a git or path dependency on the test runner. I think it's safe enough for dart-code to assume it will only ever see a semver version there. If removing it doesn't break much on CI we could also drop that behavior entirely. |
The test had been passing because the `testVersion` variable was null in the pub workspace which matched the behavior of the test_descriptor package within the test..
Follow up to #2538 This is only relevant when using the test runner as a git or path dependency. In these cases the version will already end in `-WIP` with out current development practices and in the places where it may come up the users don't need help understanding where the code is coming from.
Checking the feasibility in #2539 |
@sigurdm do you have any concerns about this usage? Are |
Ah, thanks for the info. I'll leave Dart-Code as it is then. We do handle when we can't parse a version from the output and it sounds like you might remove this anyway. If it can't be removed and it turns out to be a problem, I'll just trim after the first space. |
I don't think reading workspace_ref is any big issue. Flutter tools already relies on the file being there, so it is probably not going anywhere. But I think it would be easier to use https://api.dart.dev/dart-isolate/Isolate/packageConfigSync.html to find the package config, and then find package_graph.json next to that. You can rely on the package_graph always being present, so if you are ok with just the version number (no information about the source), you should be able to leave out the code reading pubspec.lock |
And, alternatively, if you want to always read the pubspec.lock file, it will always be present in the parent directory of the package_config.json file, then you don't need to read package_graph.json. |
Closes #2535
Add a check for the
workspace_ref.json
file in place of thepubspec.lock
file that exists for single package pub solutions.When the workspace ref exists, follow it and read the
package_graph.json
file from the workspace root.