flutter_rust_bridge icon indicating copy to clipboard operation
flutter_rust_bridge copied to clipboard

Skip codegen if definitions are unchanged

Open Desdaemon opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. Codegen takes a non-insignificant amount of time to run, especially when invoked in build scripts. Even if we mark the build script to rerun only on changes to the API file, sometimes the function signatures and struct definitions may remain the same and need no regeneration.

Describe the solution you'd like When an IrFile is parsed, we create a build cache somewhere in target with its bytes. On next invocation, if we have a cache hit we compare the current IrFile with the cached version to see if they are identical, in which case skip generation altogether.

Describe alternatives you've considered None yet.

Additional context Consider cases where a cache hit might actually be a false positive (missing or mangled files, etc.)

Desdaemon avatar Aug 11 '22 20:08 Desdaemon

Good idea!

As for how to implement this feature clearly - I personally suggest look at how build systems usually implement caches. For example, gradle, maven, etc.

I guess they use "dependency graph". (If you want me to elaborate just tell me :) )

Then, we can do caching for multiple levels. For example, cbindgen, ffigen, flutter build_runner, etc

fzyzcjy avatar Aug 11 '22 23:08 fzyzcjy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 11 '22 00:10 stale[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.

github-actions[bot] avatar Nov 01 '22 06:11 github-actions[bot]