sdk
sdk copied to clipboard
fix_data.yaml compiled from multiple files
The fix_data.yaml file in flutter/flutter is growing, it is (at time of writing) about 4000 lines long.
I am looking into writing rules to migrate to the new button universe, and I expect these rules will be many many lines themselves.
It would be nice if I could break up the fix_data.yaml file into multiple files.
They could be organized by library, or in the case I am working on now, I might like to just have one for buttons since it is expected to be substantial. Maybe the top-level fix_data.yaml can coalesce multiple .yaml fix files from a subdirectory called fix_data.
cc @bwilkerson
These are all pretty closely related, linking for reference:
- https://github.com/flutter/flutter/issues/95284
- #47945
- #47944
- #47943
I think at this point the question is what would be most convenient. I can think of a couple of possibilities, but you might have other thoughts.
-
We could define an "include" directive that could be added to the
fix_data.yamlfile that would take a list of (relative?) paths to be loaded. The main file could then consist of a single "include" and all of the transforms could be in separate files. The advantage is that you'd have complete control over where the individual files are located (as long as it's a location thatpubwill copy when downloading a package). -
We could define a hardcoded directory that the tool looks in to find the data files (like
fix_data?). The advantage is that you wouldn't need to maintain the list of files manually, you could just drop a new YAML file into the directory at any time and it would automatically be discovered. We could even make the discovery recurse into subdirectories so that you could provide further organization for the files.
Either sounds perfectly fine. :) Thanks @bwilkerson!
https://dart-review.googlesource.com/c/sdk/+/260581
This does not appear to be working. I split up the massive fix_data.yaml file in the framework into several .yaml files in lib/fix_data, but none of the fixes work. Is there documentation on how to do this? Are we doing it the wrong way?
https://github.com/flutter/flutter/pull/114192
The current implementation checks for lib/fix_data folder, then is recursively process all files under that folder.
In the PR, the folder is lib/src/fix_data, let me know if we need to change the location from lib/fix_data to lib/src/fix_data in the analysis server. I don't think we should recursively try to find all folders named fix_data inside lib (for performance reasons).
Ah! I did not realized it was in lib/src accidentally. Phew! I was hoping I had made some obvious mistake I wasn't seeing. 🤦 Thank you very much for contributing this, and for pointing out my error!