-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add an analysis_server
binary with dart_model
implementation injected
#120
Conversation
/// Only works for one path, see `packageConfig` path hardcoded below. | ||
void main(List<String> args) async { | ||
final home = Platform.environment['HOME']!; | ||
injected.macroImplementation = await AnalyzerMacroImplementation.start( |
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 am curious how we are going to handle enabling/disabling this in general?
If we are going to attempt to support old and new macros together, then the way we are injecting things right now won't really work, because it is a global setting, and you might have multiple projects open with different macro implementations.
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'm sure I wrote a reply to this, not sure where it went...
My expectation is that we'll switch from one to the other without supporting both, and possibly with some downtime in between when we support neither.
It would be more work+complexity to support both for external users, e.g. we'd have to do something about package:macros
being used in two different ways, or use two different packages.
For our own use for development I guess one or the other is enough, or we can add something more fine-grained if needed.
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.
An atomic switch will probably be a bit tricky given all the tests which work with the existing API as well as the JSON macro (which lives in the SDK but we could move it out which might help).
It might still be the easiest answer though.
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, PTAL.
There are definitely some correctness issues, in particular it looks like the cached results from with no macro impl injected prevent macros running, so I had to add some change to trigger macros.
But it does work interactively on e.g.
json_codable_test.dart
.