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

Allow client to specify how to find the package config #2199

Merged
merged 9 commits into from
Aug 22, 2023

Conversation

elliette
Copy link
Contributor

@elliette elliette commented Aug 17, 2023

Work towards #2198

The package config is not located at .dart_tool/package_config.json for google3 apps, therefore we need to provide a way for the code runner to specify where to look for it.

CC @helin24

@elliette elliette changed the title Allow code runner to specify how to find the package config Allow client to specify how to find the package config Aug 17, 2023
Copy link
Contributor

@annagrin annagrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Elliott, left some comments.

void setPackageConfigPath(path) => _packageConfigPath = path;

/// The default package config path, if none is provided by the load strategy.
String get _defaultPackageConfigPath => p.join(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add tests for a scenario where the package config is not located in a usual place?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, added a load_strategy_test for this

@@ -368,7 +371,7 @@ class FakeStrategy implements LoadStrategy {
MetadataProvider(entrypoint, FakeAssetReader());

@override
void trackEntrypoint(String entrypoint) {}
Future<void> trackEntrypoint(String entrypoint) => Future.value(null);
Copy link
Contributor

@annagrin annagrin Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be Future<void> trackEntrypoint(String entrypoint) async {} instead?

https://dart.dev/effective-dart/usage#asynchrony

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this because the FakeStrategy now extends instead of implements the LoadStrategy

import 'package:path/path.dart' as p;

/// The path to the package config.
String get packageConfigPath => _packageConfigPath ?? _defaultPackageConfigPath;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a special global for this? Can it be just a part of the global strategy, to minimize the number of globals?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, moved to global strategy instead

@elliette elliette merged commit b244b89 into dart-lang:master Aug 22, 2023
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants