-
Notifications
You must be signed in to change notification settings - Fork 82
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
Support lazily created SDK configurations. #1510
Conversation
- Add SdkConfigurationInterface and a default implementation. - Pass SdkConfiguration to dwds and ExpressionCompilerService. - Add tests.
Future<Uri> get sdkDirectoryUri => | ||
sdkDirectory.then((value) => value == null ? null : p.toUri(value)); | ||
|
||
Future<Uri> get soundSdkSummaryUri => soundSdkSummaryPath |
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.
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?
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.
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?
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 your suggestion seems better as it makes it clear why we need async
.
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.
Done!
Note: this change will enable us to add debugging for scenarios where SDK files are generated and copied during the build.