Skip codegen if definitions are unchanged
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.)
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
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.
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.