diff --git a/.gitignore b/.gitignore index e41ec8cbd..7f90bd510 100644 --- a/.gitignore +++ b/.gitignore @@ -6,9 +6,6 @@ /.cipd_client* /.versions -# ignore ninja.exe copied from .cipd_bin. -/ninja.exe - # Ignore "disable auto update" sentinel file. .disable_auto_update diff --git a/cipd_bin_setup.bat b/cipd_bin_setup.bat index 3936fc0d5..11350cdea 100644 --- a/cipd_bin_setup.bat +++ b/cipd_bin_setup.bat @@ -3,6 +3,4 @@ :: Use of this source code is governed by a BSD-style license that can be :: found in the LICENSE file. -call "%~dp0\cipd.bat" ensure -log-level warning -ensure-file "%~dp0\cipd_manifest.txt" -root "%~dp0\.cipd_bin" -:: copy ninja.exe to the root since many places assume ninja.exe exists in depot_tools. -copy /y "%~dp0\.cipd_bin\ninja.exe" "%~dp0\ninja.exe" > nul +"%~dp0\cipd.bat" ensure -log-level warning -ensure-file "%~dp0\cipd_manifest.txt" -root "%~dp0\.cipd_bin" diff --git a/ninja b/ninja index 99a6c7e35..4b3f98702 100755 --- a/ninja +++ b/ninja @@ -1,11 +1,40 @@ #!/usr/bin/env bash -# Copyright 2022 The Chromium Authors. All rights reserved. +# Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# See revert instructions in cipd_manifest.txt +OS="$(uname -s)" +THIS_DIR="$(dirname "${0}")" -MYPATH="$(dirname "${BASH_SOURCE[0]}")" +function print_help() { +cat <<-EOF +No prebuilt ninja binary was found for this system. +Try building your own binary by doing: + cd ~ + git clone https://github.com/ninja-build/ninja.git -b v1.8.2 + cd ninja && ./configure.py --bootstrap +Then add ~/ninja/ to your PATH. +EOF +} -exec "$MYPATH/.cipd_bin/ninja" "$@" +case "$OS" in + Linux) + MACHINE=$(uname -m) + case "$MACHINE" in + x86_64) + exec "${THIS_DIR}/ninja-linux64" "$@";; + *) + echo Unsupported architecture \($MACHINE\) -- unable to run ninja. + print_help + exit 1;; + esac + ;; + Darwin) exec "${THIS_DIR}/ninja-mac" "$@";; + CYGWIN*) exec cmd.exe /c $(cygpath -t windows $0).exe "$@";; + MINGW*) cmd.exe //c $0.exe "$@";; + MSYS_NT*) cmd.exe //c $0.exe "$@";; + *) echo "Unsupported OS ${OS}" + print_help + exit 1;; +esac diff --git a/ninja-linux64 b/ninja-linux64 new file mode 100755 index 000000000..d72fb5679 Binary files /dev/null and b/ninja-linux64 differ diff --git a/ninja-mac b/ninja-mac new file mode 100755 index 000000000..995ccc000 Binary files /dev/null and b/ninja-mac differ diff --git a/ninja.exe b/ninja.exe new file mode 100755 index 000000000..f86ef0738 Binary files /dev/null and b/ninja.exe differ diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index 9b09a72e3..7b1297c8d 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -119,7 +119,7 @@ Sets a fixed revision for a single dependency using project revision properties. ### *recipe_modules* / [depot\_tools](/recipes/recipe_modules/depot_tools) -[DEPS](/recipes/recipe_modules/depot_tools/__init__.py#7): [recipe\_engine/cipd][recipe_engine/recipe_modules/cipd], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/file][recipe_engine/recipe_modules/file], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/runtime][recipe_engine/recipe_modules/runtime] +[DEPS](/recipes/recipe_modules/depot_tools/__init__.py#7): [recipe\_engine/cipd][recipe_engine/recipe_modules/cipd], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/runtime][recipe_engine/recipe_modules/runtime] PYTHON_VERSION_COMPATIBILITY: PY2+3 diff --git a/recipes/recipe_modules/depot_tools/__init__.py b/recipes/recipe_modules/depot_tools/__init__.py index 4d6d352dd..c9f0de463 100644 --- a/recipes/recipe_modules/depot_tools/__init__.py +++ b/recipes/recipe_modules/depot_tools/__init__.py @@ -7,7 +7,6 @@ PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'recipe_engine/cipd', 'recipe_engine/context', - 'recipe_engine/file', 'recipe_engine/platform', 'recipe_engine/runtime', ] diff --git a/recipes/recipe_modules/depot_tools/api.py b/recipes/recipe_modules/depot_tools/api.py index db1407322..a5d260358 100644 --- a/recipes/recipe_modules/depot_tools/api.py +++ b/recipes/recipe_modules/depot_tools/api.py @@ -86,11 +86,4 @@ class DepotToolsApi(recipe_api.RecipeApi): self.repo_resource('.cipd_bin'), self.repo_resource('cipd_manifest.txt'), 'ensure depot_tools/.cipd_bin') - if self.m.platform.is_win: - # Copy ninja.exe from .cipd_bin to depot_tools root because there are - # many places that assume depot_tools/ninja.exe exists. - self.m.file.copy( - 'copy depot_tools/.cipd_bin/ninja.exe to depot_tools/', - self.repo_resource('.cipd_bin', 'ninja.exe'), - self.repo_resource('ninja.exe')) self._cipd_bin_setup_called = True diff --git a/recipes/recipe_modules/depot_tools/examples/full.expected/win.json b/recipes/recipe_modules/depot_tools/examples/full.expected/win.json index 239addbad..8ae032a4e 100644 --- a/recipes/recipe_modules/depot_tools/examples/full.expected/win.json +++ b/recipes/recipe_modules/depot_tools/examples/full.expected/win.json @@ -62,20 +62,6 @@ "@@@STEP_LOG_END@json.output@@@" ] }, - { - "cmd": [ - "vpython3", - "-u", - "RECIPE_MODULE[recipe_engine::file]\\resources\\fileutil.py", - "--json-output", - "/path/to/tmp/json", - "copy", - "RECIPE_REPO[depot_tools]\\.cipd_bin\\ninja.exe", - "RECIPE_REPO[depot_tools]\\ninja.exe" - ], - "infra_step": true, - "name": "copy depot_tools/.cipd_bin/ninja.exe to depot_tools/" - }, { "cmd": [ "ls",