Bläddra i källkod

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>
Vitaly Buka 4 år sedan
förälder
incheckning
b2c18f2f62
1 ändrade filer med 12 tillägg och 6 borttagningar
  1. 12 6
      autoninja.py

+ 12 - 6
autoninja.py

@@ -87,12 +87,18 @@ if os.path.exists(os.path.join(output_dir, 'args.gn')):
                    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