Parcourir la source

Fix autoninja to call ninja.py

ninja.exe will be removed from depot_tools soon.
Calling ninja.py finds the ninja installed by DEPS or one in PATH.

Bug: 1340825
Change-Id: I32ed6d8e5b0498347042490eedeca19972d35233
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4061247
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Auto-Submit: Junji Watanabe <jwata@google.com>
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Junji Watanabe <jwata@google.com>
Junji Watanabe il y a 2 ans
Parent
commit
ad452a7204
1 fichiers modifiés avec 16 ajouts et 20 suppressions
  1. 16 20
      autoninja.py

+ 16 - 20
autoninja.py

@@ -121,18 +121,18 @@ def main(args):
   if (not offline and use_remoteexec and (
       not os.path.exists(reclient_bin_dir) or not os.path.exists(reclient_cfg))
      ):
-      print(("Build is configured to use reclient but necessary binaries "
-             "or config files can't be found.  Developer builds with "
-             "reclient are not yet supported.  Try regenerating your "
-             "build with use_goma in place of use_remoteexec for now."),
-             file=sys.stderr)
-      if sys.platform.startswith('win'):
-        # Set an exit code of 1 in the batch file.
-        print('cmd "/c exit 1"')
-      else:
-        # Set an exit code of 1 by executing 'false' in the bash script.
-        print('false')
-      sys.exit(1)
+    print(("Build is configured to use reclient but necessary binaries "
+           "or config files can't be found.  Developer builds with "
+           "reclient are not yet supported.  Try regenerating your "
+           "build with use_goma in place of use_remoteexec for now."),
+          file=sys.stderr)
+    if sys.platform.startswith('win'):
+      # Set an exit code of 1 in the batch file.
+      print('cmd "/c exit 1"')
+    else:
+      # Set an exit code of 1 by executing 'false' in the bash script.
+      print('false')
+    sys.exit(1)
 
   # If GOMA_DISABLED is set to "true", "t", "yes", "y", or "1"
   # (case-insensitive) then gomacc will use the local compiler instead of doing
@@ -168,11 +168,6 @@ def main(args):
           print('false')
         sys.exit(1)
 
-  # Specify ninja.exe on Windows so that ninja.bat can call autoninja and not
-  # be called back.
-  ninja_exe = 'ninja.exe' if sys.platform.startswith('win') else 'ninja'
-  ninja_exe_path = os.path.join(SCRIPT_DIR, ninja_exe)
-
   # A large build (with or without goma) tends to hog all system resources.
   # Launching the ninja process with 'nice' priorities improves this situation.
   prefix_args = []
@@ -182,9 +177,10 @@ def main(args):
     # ionice -c 3 is IO priority IDLE
     prefix_args = ['nice'] + ['-10']
 
-  # Use absolute path for ninja path,
-  # or fail to execute ninja if depot_tools is not in PATH.
-  args = prefix_args + [ninja_exe_path] + input_args[1:]
+  # Call ninja.py so that it can find ninja binary installed by DEPS or one in
+  # PATH.
+  ninja_path = os.path.join(SCRIPT_DIR, 'ninja.py')
+  args = prefix_args + [sys.executable, ninja_path] + input_args[1:]
 
   num_cores = multiprocessing.cpu_count()
   if not j_specified and not t_specified: