-
Notifications
You must be signed in to change notification settings - Fork 58
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
CPLAT-5152: Optimize builder's use of asset reads to avoid unnecessary rebuilds #280
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4730c9a
Remove usage of source_gen to avoid parsing elements:
evanweible-wf eccb696
Optimize the builder inputs in build.yaml:
evanweible-wf 54a17c0
Update generated assets.
evanweible-wf 37977f4
Remove now-unused source_gen Generator.
evanweible-wf b55ce60
Remove now-unused `source_gen` depenency.
evanweible-wf f24a057
Improvements to builder implementation:
evanweible-wf 93d4593
Warn if .over_react.g.dart part is missing.
evanweible-wf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test_fixtures/source_files/missing_over_react_g_part/library.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import 'package:over_react/over_react.dart'; | ||
|
||
part 'part.dart'; |
17 changes: 17 additions & 0 deletions
17
test_fixtures/source_files/missing_over_react_g_part/part.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
part of 'library.dart'; | ||
|
||
@Factory() | ||
UiFactory<BasicPartOfLibProps> BasicPartOfLib = _$BasicPartOfLib; | ||
|
||
@Props() | ||
class _$BasicPartOfLibProps extends UiProps { | ||
String basicProp; | ||
} | ||
|
||
@Component() | ||
class BasicPartOfLibComponent extends UiComponent<BasicPartOfLibProps> { | ||
@override | ||
render() { | ||
return Dom.div()('foo'); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why was this removed? I would imagine performing this regex match is faster than parsing the compilation unit. Or, is that not the case?
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.
This diff is outdated, but still applies to the new version of the file
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.
Without this change, we are no longer providing a warning in the scenario where a consumer has over_react-annotated code but did not include the
.over_react.g.dart
part file (which is something that thePartBuilder
from source_gen did for us).I didn't post these numbers but I did run a comparison between this commit and the previous commit and there was no noticeable difference in clean build or rebuild times on WSD or wdesk_sdk. I was a bit surprised by that, but my best guess is that the file reads and the AST parsing are cached.. or maybe they're just both fast? I'm not totally sure.
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.
That's a bit surprising to me, too. I know file reads are pretty fast, but I expected AST parsing to not be super cheap. 🤷♂️
I'm fine with it as-is, then!