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

CMake: Further fix amalgamation file gen on change #6854

Merged

Conversation

Smjert
Copy link
Member

@Smjert Smjert commented Dec 27, 2020

The previous PR (#6832) was not enough to cover all type of changes
to the inputs of the generation of the amalgamation file.
The previous PR was only fixing the case where a spec file would change
(it's mtime would be newer than the output, to be specific),
but not if the dependency list itself would change.
So if a new spec file was added or one was removed, it would not rerun.

Moreover, with build systems that are not Ninja,
any generated artifact that due to a config change is not generated anymore,
will remain in the build folder, affecting the amalgamation file
generation.
Specifically if a table is disabled and its .cpp is not generated
anymore, but previously it was generated, the amalgamate script
will still pick it up because it doesn't receive a list of files
to use, but uses the content of a folder.

Finally, better express the dependency of the amalgamation file,
so that it depends on the output of the targets/commands that
generate the table source code, not the spec files
(which are already input/dependency of the custom commands generating
the tables source code) and not the tables source code generating target names
(which would only express the need to run those targets before the
amalgamation file generation, not the need to rerun the generation).


As an additional info, the first issue doesn't appear if the inputs the custom command depends on appear on the COMMAND, generating a command line change whenever a dependency is added/removed/changes name.

The previous PR (osquery#6832) was not enough to cover all type of changes
to the inputs of the generation of the amalgamation file.
The previous PR was only fixing the case where a spec file would change
(it's mtime would be newer than the output, to be specific),
but not if the dependency list itself would change.
So if a new spec file was added or one was removed, it would not rerun.

Moreover, with build systems that are not Ninja,
any generated artifact that due to a config change is not generated anymore,
will remain in the build folder, affecting the amalgamation file
generation.
Specifically if a table is disabled and its .cpp is not generated
anymore, but previously it was generated, the amalgamate script
will still pick it up because it doesn't receive a list of files
to use, but uses the content of a folder.

Finally, better express the dependency of the amalgamation file,
so that it depends on the output of the targets/commands that
generate the table source code, not the spec files
(which are already input/dependency of the custom commands generating
the tables source code) and not the tables source code generating target names
(which would only express the need to run those targets before the
amalgamation file generation, not the need to rerun the generation).
@Smjert Smjert added the cmake pure cmake changes label Dec 27, 2020
@theopolis theopolis merged commit 858915e into osquery:master Dec 28, 2020
@mike-myers-tob mike-myers-tob deleted the stefano/build/fix-amalgamation-gen branch January 5, 2021 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake pure cmake changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants