Skip to content

Support lazily created SDK configurations. #1510

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

Merged
merged 11 commits into from
Feb 18, 2022

Conversation

annagrin
Copy link
Contributor

@annagrin annagrin commented Feb 17, 2022

  • Add SdkConfigurationInterface and a default implementation.
  • Pass SdkConfiguration to dwds and ExpressionCompilerService.
  • Add tests.

Note: this change will enable us to add debugging for scenarios where SDK files are generated and copied during the build.

- Add SdkConfigurationInterface and a default implementation.
- Pass SdkConfiguration to dwds and ExpressionCompilerService.
- Add tests.
@annagrin annagrin requested review from grouma and elliette February 17, 2022 02:54
@annagrin annagrin requested a review from jacob314 February 17, 2022 17:25
Future<Uri> get sdkDirectoryUri =>
sdkDirectory.then((value) => value == null ? null : p.toUri(value));

Future<Uri> get soundSdkSummaryUri => soundSdkSummaryPath
Copy link
Member

Choose a reason for hiding this comment

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

Curious why these have to be async? Would it be better to have an async "constructor"? Or would it be slightly cleaner to have an async init function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Uri getters are just helpers to construct Uris from the SDK paths, which in turn are async because we need to wait to create them in some scenarios (ie, until the build has finished and we query it for where the files can be located).

So I went with the idea here is a lazily-created data class - the instance is created before dwds.start, but the Uris are used later when the build has finished and the isolate is created in the debugger (to start the expression compiler and record dart Uris). By that time we have enough information from the build system to detect where the SDK paths are.

Another idea would be keeping SdkConfiguration a simple data class (no async methods), but having a separate SdkConfigurationProvider class with and async createConfiguration method that the implementations can override. Does this seem better?

Copy link
Member

Choose a reason for hiding this comment

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

I think your suggestion seems better as it makes it clear why we need async.

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!

@annagrin annagrin requested a review from grouma February 18, 2022 00:00
@annagrin annagrin requested a review from elliette February 18, 2022 01:53
@annagrin annagrin merged commit 1931dc9 into dart-lang:master Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants