sdk icon indicating copy to clipboard operation
sdk copied to clipboard

fix_data.yaml compiled from multiple files

Open Piinks opened this issue 3 years ago • 4 comments
trafficstars

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.

Piinks avatar Dec 15 '21 20:12 Piinks

cc @bwilkerson

Piinks avatar Dec 15 '21 21:12 Piinks

These are all pretty closely related, linking for reference:

  • https://github.com/flutter/flutter/issues/95284
  • #47945
  • #47944
  • #47943

Piinks avatar Dec 15 '21 23:12 Piinks

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.

  1. We could define an "include" directive that could be added to the fix_data.yaml file 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 that pub will copy when downloading a package).

  2. 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.

bwilkerson avatar Dec 16 '21 17:12 bwilkerson

Either sounds perfectly fine. :) Thanks @bwilkerson!

Piinks avatar Dec 16 '21 17:12 Piinks

https://dart-review.googlesource.com/c/sdk/+/260581

asashour avatar Sep 22 '22 13:09 asashour

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

Piinks avatar Oct 28 '22 00:10 Piinks

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).

asashour avatar Oct 28 '22 08:10 asashour

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!

Piinks avatar Oct 28 '22 13:10 Piinks