-
Notifications
You must be signed in to change notification settings - Fork 83
Added method findPackageConfigFilePath to find the package_config.json file #2587
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on Jessy!
@@ -20,7 +21,7 @@ abstract class LoadStrategy { | |||
LoadStrategy( | |||
this._assetReader, { | |||
String? packageConfigPath, | |||
}) : _packageConfigPath = packageConfigPath; | |||
}) : _packageConfigPath = packageConfigPath ?? _findPackageConfigFilePath(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should instead provide this as an optional named parameter (optional named to avoid a breaking change) to each of the FrontendServerStrategyProvider
s e.g.:
FrontendServerDdcLibraryBundleStrategyProvider( |
Flutter already calculates this, so we'd end up calculating it again. Flutter may also choose to configure the locations differently in tests for example.
I'd then imagine webdev calculating this separately and passing it to the provider (I guess in its case it'd use the BuildRunnerRequireStrategyProvider
, which should also be updated in this PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about this approach and it makes sense to update each of the providers to allow passing a _packageConfigPath
. It works for the flutter tools
case since the info is already computed, we can simply pass it to the provider. However, for Webdev
we don't have this details so what about we allow setting the value of _packageConfigPath
for all the providers but in case we don't pass this value explicitly, we can compute it with _findPackageConfigFilePath
. That way we can ensure that we always have this value set in all cases. Wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My original thought was maybe webdev should calculate it separately and then pass it to DWDS, but maybe it doesn't matter. I do like the idea of our default being a bit more robust for the case of monorepos, so I think your plan makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a similar method in Webdev to find the package config path and pass to DWDS and I also kept the default method in the load strategy class in case the value is not being passed.
…it to the load strategy
@srujzs I'm not too familiar with the release process but It looks like I need to update |
I'd avoid making changes to webdev in this PR as it relies on DWDS and I remember the bots having trouble publishing both versions at once. I'd do the following if you want to publish webdev with a new version of dwds:
|
Thanks for the clarification! That makes sense. I'll undo the webdev changes in this PR and update DWDS to 24.3.5 instead of 24.3.5-wip. I believe we also need to update the Appreciate the guidance! Let me know if there's anything else I should keep in mind. |
LGTM! Sorry for the delay, was OOO. :)
Indeed, we update packages in flutter by running the following script:
Since Flutter pins versions globally, this script goes through all the dependencies and updates their versions. The |
Revisions updated by `dart tools/rev_sdk_deps.dart`. ecosystem (https://github.com/dart-lang/ecosystem/compare/5b0d815..fe4979b): fe4979b 2025-02-10 Kevin Moore [firehose] Set exit code and return instead of calling exit(X) (dart-lang/ecosystem#341) http (https://github.com/dart-lang/http/compare/b7cdf61..e28f9f5): e28f9f5 2025-02-11 Sam Rawlins Fix typo in example in README (dart-lang/http#1714) fc59d4a 2025-02-11 Brian Quinlan Revert cronet_http gradle version (dart-lang/http#1712) protobuf (https://github.com/dart-lang/protobuf/compare/d00f905..610943a): 610943a 2025-02-12 Devon Carew update the publish workflow; add a post_summaries one (google/protobuf.dart#961) 35a1bd6 2025-02-12 Devon Carew update the repo analysis config (google/protobuf.dart#962) d3f9ad1 2025-02-12 Devon Carew updates to the gitignore files (google/protobuf.dart#960) 950b6a7 2025-02-11 Ömer Sinan Ağacan Remove redundant checkNotNull calls from pre-null-safe days (google/protobuf.dart#958) shelf (https://github.com/dart-lang/shelf/compare/2a7442f..b39e611): b39e611 2025-02-11 dependabot[bot] Bump actions/stale from 9.0.0 to 9.1.0 in the github-actions group (dart-lang/shelf#470) webdev (https://github.com/dart-lang/webdev/compare/616da45..718c39c): 718c39c3 2025-02-11 Jessy Yameogo set packageConfigPath and update DWDS version to 24.3.5 (dart-lang/webdev#2589) 4246bbc5 2025-02-11 Jessy Yameogo Added method findPackageConfigFilePath to find the package_config.json file (dart-lang/webdev#2587) Change-Id: I7e5940ad3b128d1e47c2185a1435006c2a277bc4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409621 Commit-Queue: Devon Carew <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
Added a method that returns the absolute file path of the
package_config.json
file in the.dart_tool
directory, by searching recursively from the current directory hierarchy to ensurepackageConfigPath
is initialized inLoadStrategy
at construction.Fixes #2575