pw_presubmit: check_builds_for_files fix
Only check builds (GN or Bazel) if directories were provided for that
build. Previously, check_builds_for_files would report files as missing
from a build that was not present.
Change-Id: I09e497843cb52ac136083d75a86278dc510bbe9b
diff --git a/pw_presubmit/py/pw_presubmit/build.py b/pw_presubmit/py/pw_presubmit/build.py
index 3180fe9..dde488b 100644
--- a/pw_presubmit/py/pw_presubmit/build.py
+++ b/pw_presubmit/py/pw_presubmit/build.py
@@ -120,11 +120,11 @@
missing: Dict[str, List[Path]] = collections.defaultdict(list)
for path in (p for p in files if p.suffix in extensions_to_check):
- if path.suffix != '.rst' and path not in bazel_builds:
+ if bazel_dirs and path.suffix != '.rst' and path not in bazel_builds:
# TODO(pwbug/176) Replace this workaround for fuzzers.
if 'fuzz' not in str(path):
missing['Bazel'].append(path)
- if path not in gn_builds:
+ if gn_dirs and path not in gn_builds:
missing['GN'].append(path)
for builder, paths in missing.items():