Skip to content

Commit

Permalink
getdeps: avoid blowing away too much data when invalidating the CMake…
Browse files Browse the repository at this point in the history
… cache

Summary:
Previously getdeps would remove the entire top-level `CMakeFiles` directory
from the build output when it wanted to invalidate the CMake cache.  This
directory is used to keep all of the compiled object files for any libraries
or executables defined in the top-level CMakeLists.txt file.  Blowing away
this directory forces all of these sources to be re-compiled, even if this was
not necessary.  This is particularly problematic for folly, which compiles all
of its source files via rules in the top-level CMakeLists.txt target file.

I did have the code still blow away the CMake error and output logs in this
directory: in the past I have seen situations where CMake would not update
these files on new CMake runs if they already existed.

Reviewed By: wez

Differential Revision: D21360668

fbshipit-source-id: 6fcd1a8e371d756114fbab60d8636be8cd5f8978
  • Loading branch information
simpkins authored and facebook-github-bot committed May 5, 2020
1 parent 97a2fc1 commit 4fbb7cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion build/fbcode_builder/getdeps/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,11 @@ def __init__(
self.defines = defines or {}

def _invalidate_cache(self):
for name in ["CMakeCache.txt", "CMakeFiles"]:
for name in [
"CMakeCache.txt",
"CMakeFiles/CMakeError.log",
"CMakeFiles/CMakeOutput.log",
]:
name = os.path.join(self.build_dir, name)
if os.path.isdir(name):
shutil.rmtree(name)
Expand Down

0 comments on commit 4fbb7cf

Please sign in to comment.