Commit d8168ba9 authored by Wez Furlong's avatar Wez Furlong Committed by Facebook GitHub Bot

getdeps: refine makefiles matcher for cmake reconfigure

Summary:
Only run cmake reconfigure for .cmake, .cmake.in and CMakeLists.txt
files changes.

Previously we would reconfigure for any change to a file with a path that
matched `cmake` which could result in false positives in cases where
you may be iterating on .py or .c files in shared cmake directories.

This also reclassifies non-cmake files under fbcode_builder/CMake as source
files so that we run cmake for those; previously they would cause a
reconfigure and build, now they just cause a build.

Reviewed By: xavierd

Differential Revision: D21364133

fbshipit-source-id: a1231f657d6c6056b269656c677d3449d8715cf6
parent 99536b53
......@@ -35,6 +35,16 @@ except ImportError:
from urllib.request import urlretrieve
def file_name_is_cmake_file(file_name):
file_name = file_name.lower()
base = os.path.basename(file_name)
return (
base.endswith(".cmake")
or base.endswith(".cmake.in")
or base == "cmakelists.txt"
)
class ChangeStatus(object):
""" Indicates the nature of changes that happened while updating
the source directory. There are two broad uses:
......@@ -71,12 +81,13 @@ class ChangeStatus(object):
might need to rebuild, so we ignore it.
Otherwise we record the file as a source file change. """
if "cmake" in file_name.lower():
file_name = file_name.lower()
if file_name_is_cmake_file(file_name):
self.make_files += 1
return
if "/fbcode_builder/" in file_name:
return
self.source_files += 1
elif "/fbcode_builder/cmake" in file_name:
self.source_files += 1
elif "/fbcode_builder/" not in file_name:
self.source_files += 1
def sources_changed(self):
""" Returns true if any source files were changed during
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment