Skip to content

add parsing of assets transformer declarations in pubspec.yaml #143557

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 9 commits into from
Feb 16, 2024

Conversation

andrewkolos
Copy link
Contributor

@andrewkolos andrewkolos commented Feb 16, 2024

In service of #143348.

This PR enables parsing of the pubspec yaml schemes for assets with transformations as described in #143348.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@andrewkolos andrewkolos added the tool Affects the "flutter" command-line tool. See also t: labels. label Feb 16, 2024
@andrewkolos
Copy link
Contributor Author

andrewkolos commented Feb 16, 2024

FYI this is what multiple assets section errors looks like from the user's perspective:

Error detected in pubspec.yaml:
Unable to parse assets section.
In flavors section of asset "assets/a.txt": Expected flavors to be a list of String, but got {a: b} (YamlMap).
In transformers section of asset "assets/a.txt": In args section of transformer using package "yo": Expected args to be a list of String, but got {i am: a map} (YamlMap).
Please correct the pubspec.yaml file at /Users/andrewkolos/Desktop/deleteme/pubspec_testing/pubspec.yaml

@andrewkolos andrewkolos marked this pull request as ready for review February 16, 2024 04:31
@christopherfujino
Copy link
Contributor

FYI this is what multiple assets section errors looks like from the user's perspective:

Error detected in pubspec.yaml:
Unable to parse assets section.
In flavors section of asset "assets/a.txt": Expected flavors to be a list of String, but got {a: b} (YamlMap).
In transformers section of asset "assets/a.txt": In args section of transformer using package "yo": Expected args to be a list of String, but got {i am: a map} (YamlMap).
Please correct the pubspec.yaml file at /Users/andrewkolos/Desktop/deleteme/pubspec_testing/pubspec.yaml

nice! This is a big improvement.

return errors.isEmpty ? (List<T>.from(yamlList), <String>[]) : (null, errors);
}

(List<T>? result, List<String> errors) _parseNullableList<T>(Object? yamlList, String context, String typeAlias) {
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 this helper, or could we inline this at the callsites? I find the DRY benefits of this kind of trivial abstraction often not worth the cognitive overhead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

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

Nice! Ship it

@andrewkolos andrewkolos added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 16, 2024
@auto-submit auto-submit bot merged commit 3a18473 into flutter:master Feb 16, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 17, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 17, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 18, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 18, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 19, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 19, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Feb 19, 2024
Roll Flutter from d7867ca to 064c340 (33 revisions)

flutter/flutter@d7867ca...064c340

2024-02-19 [email protected] Roll Flutter Engine from f71b7eee2266 to 714215d42e57 (1 revision) (flutter/flutter#143708)
2024-02-19 [email protected] Roll Flutter Engine from 07c73b0c8413 to f71b7eee2266 (2 revisions) (flutter/flutter#143694)
2024-02-19 [email protected] Roll Flutter Engine from 80d6745c6fd6 to 07c73b0c8413 (1 revision) (flutter/flutter#143682)
2024-02-19 [email protected] Roll Flutter Engine from 67abf6eb36a1 to 80d6745c6fd6 (1 revision) (flutter/flutter#143676)
2024-02-18 [email protected] Roll Flutter Engine from 8ae232196fc9 to 67abf6eb36a1 (1 revision) (flutter/flutter#143673)
2024-02-18 [email protected] Roll Flutter Engine from f636f9635438 to 8ae232196fc9 (1 revision) (flutter/flutter#143659)
2024-02-18 [email protected] Fixed the issue of incorrect item position when prototypeItem is set in SliverReorderableList. (flutter/flutter#142880)
2024-02-18 [email protected] ShowCaretOnScreen is correctly scheduled within a SliverMainAxisGroup (flutter/flutter#141671)
2024-02-18 [email protected] Roll Flutter Engine from 0ebd580cb8a7 to f636f9635438 (1 revision) (flutter/flutter#143657)
2024-02-17 [email protected] Roll Flutter Engine from c807aeaab89c to 0ebd580cb8a7 (1 revision) (flutter/flutter#143655)
2024-02-17 [email protected] Roll Flutter Engine from e51d4f1e285a to c807aeaab89c (4 revisions) (flutter/flutter#143652)
2024-02-17 [email protected] Manual roll Packages from c56c12d to 0af905d (flutter/flutter#143651)
2024-02-17 [email protected] Add an override annotation to the lineTerminator setter in the MemoryStdout fake class (flutter/flutter#143646)
2024-02-17 [email protected] InputDecorator M3 tests migration - Step3 (flutter/flutter#143520)
2024-02-17 [email protected] Update InputDecoration.contentPadding documentation (flutter/flutter#143519)
2024-02-17 [email protected] [Impeller] skip selectable text goldens for instability. (flutter/flutter#143627)
2024-02-17 [email protected] Roll Flutter Engine from 2ed159a786ef to e51d4f1e285a (2 revisions) (flutter/flutter#143624)
2024-02-17 [email protected] [Impeller] skip perspective transformed text goldens. (flutter/flutter#143623)
2024-02-17 [email protected] [framework] Skip 5 failing framework tests. (flutter/flutter#143618)
2024-02-17 [email protected] Roll Flutter Engine from afb270929a6c to 2ed159a786ef (1 revision) (flutter/flutter#143622)
2024-02-17 [email protected] Roll Flutter Engine from c4fe6f01e0f5 to afb270929a6c (1 revision) (flutter/flutter#143619)
2024-02-16 [email protected] Implement `lineTerminator` in `MemoryStdout` Fake (flutter/flutter#143608)
2024-02-16 [email protected] Roll Flutter Engine from 2eed3fbb293a to c4fe6f01e0f5 (3 revisions) (flutter/flutter#143615)
2024-02-16 [email protected] Don't paint the cursor for an invalid selection (flutter/flutter#143533)
2024-02-16 [email protected] Roll Flutter Engine from 13dc857bf2ef to 2eed3fbb293a (2 revisions) (flutter/flutter#143609)
2024-02-16 [email protected] Fix implementation imports outside of lib (flutter/flutter#143594)
2024-02-16 [email protected] add parsing of assets transformer declarations in pubspec.yaml (flutter/flutter#143557)
2024-02-16 [email protected] Roll Flutter Engine from 5fd5ccf32d08 to 13dc857bf2ef (6 revisions) (flutter/flutter#143607)
2024-02-16 [email protected] Fix SemanticsFinder for multi-view (flutter/flutter#143485)
2024-02-16 [email protected] rebuild the asset bundle if a file has been modified between `flutter test` runs (flutter/flutter#143569)
2024-02-16 [email protected] Added Missing Field Name in Doc Comment in SnackBarThemeData (flutter/flutter#143588)
2024-02-16 [email protected] Implementing `switch` expressions [refactoring `flutter/lib/src/`] (flutter/flutter#143496)
2024-02-16 [email protected] Roll Flutter Engine from dd530f1556df to 5fd5ccf32d08 (3 revisions) (flutter/flutter#143593)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
...
@andrewkolos andrewkolos deleted the asset-transformers-parsing-2 branch April 29, 2024 18:17
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 14, 2024
arc-yong pushed a commit to Arctuition/packages-arc that referenced this pull request Jun 14, 2024
Roll Flutter from d7867ca to 064c340 (33 revisions)

flutter/flutter@d7867ca...064c340

2024-02-19 [email protected] Roll Flutter Engine from f71b7eee2266 to 714215d42e57 (1 revision) (flutter/flutter#143708)
2024-02-19 [email protected] Roll Flutter Engine from 07c73b0c8413 to f71b7eee2266 (2 revisions) (flutter/flutter#143694)
2024-02-19 [email protected] Roll Flutter Engine from 80d6745c6fd6 to 07c73b0c8413 (1 revision) (flutter/flutter#143682)
2024-02-19 [email protected] Roll Flutter Engine from 67abf6eb36a1 to 80d6745c6fd6 (1 revision) (flutter/flutter#143676)
2024-02-18 [email protected] Roll Flutter Engine from 8ae232196fc9 to 67abf6eb36a1 (1 revision) (flutter/flutter#143673)
2024-02-18 [email protected] Roll Flutter Engine from f636f9635438 to 8ae232196fc9 (1 revision) (flutter/flutter#143659)
2024-02-18 [email protected] Fixed the issue of incorrect item position when prototypeItem is set in SliverReorderableList. (flutter/flutter#142880)
2024-02-18 [email protected] ShowCaretOnScreen is correctly scheduled within a SliverMainAxisGroup (flutter/flutter#141671)
2024-02-18 [email protected] Roll Flutter Engine from 0ebd580cb8a7 to f636f9635438 (1 revision) (flutter/flutter#143657)
2024-02-17 [email protected] Roll Flutter Engine from c807aeaab89c to 0ebd580cb8a7 (1 revision) (flutter/flutter#143655)
2024-02-17 [email protected] Roll Flutter Engine from e51d4f1e285a to c807aeaab89c (4 revisions) (flutter/flutter#143652)
2024-02-17 [email protected] Manual roll Packages from c56c12d to 0af905d (flutter/flutter#143651)
2024-02-17 [email protected] Add an override annotation to the lineTerminator setter in the MemoryStdout fake class (flutter/flutter#143646)
2024-02-17 [email protected] InputDecorator M3 tests migration - Step3 (flutter/flutter#143520)
2024-02-17 [email protected] Update InputDecoration.contentPadding documentation (flutter/flutter#143519)
2024-02-17 [email protected] [Impeller] skip selectable text goldens for instability. (flutter/flutter#143627)
2024-02-17 [email protected] Roll Flutter Engine from 2ed159a786ef to e51d4f1e285a (2 revisions) (flutter/flutter#143624)
2024-02-17 [email protected] [Impeller] skip perspective transformed text goldens. (flutter/flutter#143623)
2024-02-17 [email protected] [framework] Skip 5 failing framework tests. (flutter/flutter#143618)
2024-02-17 [email protected] Roll Flutter Engine from afb270929a6c to 2ed159a786ef (1 revision) (flutter/flutter#143622)
2024-02-17 [email protected] Roll Flutter Engine from c4fe6f01e0f5 to afb270929a6c (1 revision) (flutter/flutter#143619)
2024-02-16 [email protected] Implement `lineTerminator` in `MemoryStdout` Fake (flutter/flutter#143608)
2024-02-16 [email protected] Roll Flutter Engine from 2eed3fbb293a to c4fe6f01e0f5 (3 revisions) (flutter/flutter#143615)
2024-02-16 [email protected] Don't paint the cursor for an invalid selection (flutter/flutter#143533)
2024-02-16 [email protected] Roll Flutter Engine from 13dc857bf2ef to 2eed3fbb293a (2 revisions) (flutter/flutter#143609)
2024-02-16 [email protected] Fix implementation imports outside of lib (flutter/flutter#143594)
2024-02-16 [email protected] add parsing of assets transformer declarations in pubspec.yaml (flutter/flutter#143557)
2024-02-16 [email protected] Roll Flutter Engine from 5fd5ccf32d08 to 13dc857bf2ef (6 revisions) (flutter/flutter#143607)
2024-02-16 [email protected] Fix SemanticsFinder for multi-view (flutter/flutter#143485)
2024-02-16 [email protected] rebuild the asset bundle if a file has been modified between `flutter test` runs (flutter/flutter#143569)
2024-02-16 [email protected] Added Missing Field Name in Doc Comment in SnackBarThemeData (flutter/flutter#143588)
2024-02-16 [email protected] Implementing `switch` expressions [refactoring `flutter/lib/src/`] (flutter/flutter#143496)
2024-02-16 [email protected] Roll Flutter Engine from dd530f1556df to 5fd5ccf32d08 (3 revisions) (flutter/flutter#143593)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants