Skip to content
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

Core Gradle native compile state doesn't account for changes to the initial macros #863

Open
lacasseio opened this issue May 14, 2024 · 0 comments

Comments

@lacasseio
Copy link
Member

If the initial macros change, Gradle will detect the task to be out-of-date but will reuse the compile state for each file as none of the files (source or headers) have changed. If the initial macros contain a macro participating in a macro include, the headerDependencies will be wrong as the graph will be reused on the basis that no files changed. The third build will be up-to-date as no file changes, and the initial macros haven't changed. In this case, the wrong header graph will be reused again. Suppose the build code containing the new initial macros is committed; any new workspace will compute a different header graph, making the cache key incompatible with the original build. Note that the second build can also corrupt the build cache by providing the result of a compilation for the wrong cache key. The chance of this particular case happening is very slim, but it would still affect the correctness of the build.

The simplest patch is to include the initial macros inside the compile state. However, this approach may over-invalidate as not all initial macros may participate in the header discovery.

A more complicated patch would require tracking which macros affect the header discovery and tracking only those initial macros. The file hashing covers any macros found during the discovery process.

The macros passed by the compiler arguments are not currently taken into account. The same is true for the default includes and macOS framework headers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant