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: fix custom target dependencies #675

Conversation

sogartar
Copy link

@sogartar sogartar commented May 6, 2022

This fixes dependency issues where a dependency of a custom command
on a custom target guarantees only the order of building and does
not guarantee that the custom command would rerun every time
when the custom target is rebuilt.

The approach to fix this is for custom targets to record in the
OUTPUTS target property their output files. Then the dependent
custom command depends on the contents of the OUTPUTS property
using generator expressions. This creates a file level dependencies
that triggers rebuilds on change.

Fixes #636

This fixes dependency issues where a dependency of a custom command
on a custom target guarantees only the order of building and does
not guarantee that the custom command would rerun every time
when the custom target is rebuilt.

The approach to fix this is for custom targets to record in the
OUTPUTS target property their output files. Then the dependent
custom command depends on the contents of the OUTPUTS property
using generator expressions. This creates a file level dependencies
that triggers rebuilds on change.
@sogartar sogartar requested a review from ChrisCummins May 6, 2022 15:07
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 6, 2022
@codecov-commenter
Copy link

codecov-commenter commented May 6, 2022

Codecov Report

Merging #675 (c25d3ad) into development (66bea84) will decrease coverage by 0.12%.
The diff coverage is 93.16%.

@@               Coverage Diff               @@
##           development     #675      +/-   ##
===============================================
- Coverage        88.38%   88.26%   -0.13%     
===============================================
  Files              119      125       +6     
  Lines             7497     7565      +68     
===============================================
+ Hits              6626     6677      +51     
- Misses             871      888      +17     
Impacted Files Coverage Δ
compiler_gym/bin/service.py 75.80% <0.00%> (ø)
compiler_gym/service/proto/__init__.py 100.00% <ø> (ø)
compiler_gym/util/runfiles_path.py 91.07% <ø> (ø)
compiler_gym/validation_error.py 0.00% <0.00%> (-90.00%) ⬇️
compiler_gym/envs/compiler_env.py 75.44% <75.00%> (-0.35%) ⬇️
compiler_gym/envs/__init__.py 85.71% <77.77%> (-14.29%) ⬇️
compiler_gym/errors/validation_errors.py 90.00% <90.00%> (ø)
compiler_gym/service/connection.py 79.87% <90.90%> (+1.83%) ⬆️
compiler_gym/spaces/runtime_reward.py 96.87% <96.87%> (ø)
compiler_gym/__init__.py 87.50% <100.00%> (ø)
... and 31 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ac34498...c25d3ad. Read the comment docs.

@sogartar sogartar marked this pull request as draft May 6, 2022 16:22
@sogartar sogartar marked this pull request as ready for review May 6, 2022 22:15
@ChrisCummins
Copy link
Contributor

I don't fully understand the code so I appreciate the detailed PR description. 🙂 Thanks @sogartar!

Cheers,
Chris

@ChrisCummins ChrisCummins merged commit 63dbfac into facebookresearch:development May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dependencies of custom commands on custom targets in CMake do not trigger a remake
4 participants