autoninja: use ninja in the autoninja.py directory

When people execute autoninja, I believe people would expect ninja
in the autoninja directory would be used.  However, the original code
find ninja from PATH, and ninja in other directory could be used.
People usually do not notice this because having depot_tools in
PATH is recommended for Chromium developers.  However, in some
environments, an old version ninja is pre-installed, and unexpected
version ninja could be used upon PATH environment.

Also, in most of bots, depot_tools directory is not included in PATH.
Autoninja execution would fail there because the system cannot find
ninja.

Bug: b/77176746
Change-Id: Iad8bd952dc1e34a9d303fd5b493c555156369a17
Reviewed-on: https://chromium-review.googlesource.com/c/1319489
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Fumitoshi Ukai <ukai@chromium.org>
Reviewed-by: Shinya Kawanaka <shinyak@chromium.org>
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Auto-Submit: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
changes/89/1319489/6
Yoshisato Yanagisawa 7 years ago committed by Commit Bot
parent 52a091f419
commit 4b49707cb5

@ -15,6 +15,8 @@ import os
import re
import sys
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
# The -t tools are incompatible with -j
t_specified = False
j_specified = False
@ -61,12 +63,13 @@ try:
except IOError:
pass
if sys.platform.startswith('win'):
# Specify ninja.exe on Windows so that ninja.bat can call autoninja and not
# be called back.
args = ['ninja.exe'] + input_args[1:]
else:
args = ['ninja'] + input_args[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'
# Use absolute path for ninja path,
# or fail to execute ninja if depot_tools is not in PATH.
args = [os.path.join(SCRIPT_DIR, ninja_exe)] + input_args[1:]
num_cores = multiprocessing.cpu_count()
if not j_specified and not t_specified:

Loading…
Cancel
Save