Support CMake generated build files
Chromium does not use CMake, however ninja with Goma is used by LLVM
team.
Change-Id: I38349d0574048b22b32365e45c587e604e045442
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2572805
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/autoninja.py b/autoninja.py
index a19d08f..aef7f0f 100755
--- a/autoninja.py
+++ b/autoninja.py
@@ -87,12 +87,18 @@
line_without_comment):
use_remote_build = True
continue
-elif os.path.exists(os.path.join(output_dir, 'rules.ninja')):
- with open(os.path.join(output_dir, 'rules.ninja')) as file_handle:
- for line in file_handle:
- if re.match(r'^\s*command\s*=\s*\S+gomacc', line):
- use_remote_build = True
- break
+else:
+ for relative_path in [
+ '', # GN keeps them in the root of output_dir
+ 'CMakeFiles'
+ ]:
+ path = os.path.join(output_dir, relative_path, 'rules.ninja')
+ if os.path.exists(path):
+ with open(path) as file_handle:
+ for line in file_handle:
+ if re.match(r'^\s*command\s*=\s*\S+gomacc', line):
+ use_remote_build = True
+ break
# If GOMA_DISABLED is set to "true", "t", "yes", "y", or "1" (case-insensitive)
# then gomacc will use the local compiler instead of doing a goma compile. This