Install ninja to crashpad using DEPS

Ninja will be installed to the following paths.
- Linux: third_party/ninja/linux/ninja
- Mac: third_party/ninja/mac/ninja
- Windows: third_party/ninja/ninja.exe

This supports a workflow with VMs on the same host machine.

On Unix, `ninja` command wrapper in depot_tools will trigger third_party/ninja/ninja, which call linux or mac ninja.
On Windows, the depot_tools wrapper will trigger third_party/ninja/ninja.exe.

See the the discussions on the previous CL https://crrev.com/c/3924593 for more context.

See also chromium/src's CL https://crrev.com/c/3869740 for CIPD ninja migration.

Bug: chromium:1340825
Change-Id: Ia4ff83b4fdc5cb07b5c737cb9d00eaa167f0ffb0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3990128
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Junji Watanabe 2022-11-07 15:44:43 +09:00 committed by Crashpad LUCI CQ
parent 0729b08ace
commit 58c68181ea
4 changed files with 111 additions and 0 deletions

3
.gitignore vendored
View File

@ -38,6 +38,9 @@
/third_party/lss/lss
/third_party/gyp/gyp
/third_party/mini_chromium/mini_chromium
/third_party/ninja/linux
/third_party/ninja/mac*
/third_party/ninja/ninja.exe
/third_party/zlib/zlib
/xcodebuild
tags

48
DEPS
View File

@ -15,6 +15,9 @@
vars = {
'chromium_git': 'https://chromium.googlesource.com',
'gn_version': 'git_revision:2ecd43a10266bd091c98e6dcde507c64f6a0dad3',
# ninja CIPD package version.
# https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/ninja
'ninja_version': 'version:2@1.8.2.chromium.3',
'pull_linux_clang': False,
'pull_win_toolchain': False,
# Controls whether crashpad/build/ios/setup-ios-gn.py is run as part of
@ -133,6 +136,51 @@ deps = {
'condition': 'checkout_fuchsia and host_os == "linux"',
'dep_type': 'cipd'
},
# depot_tools/ninja wrapper calls third_party/ninja/{ninja, ninja.exe}.
# crashpad/third_party/ninja/ninja is another wrapper to call linux ninja
# or mac ninja.
# This allows crashpad developers to work for multiple platforms on the same
# machine.
'crashpad/third_party/ninja': {
'packages': [
{
'package': 'infra/3pp/tools/ninja/${{platform}}',
'version': Var('ninja_version'),
}
],
'condition': 'host_os == "win"',
'dep_type': 'cipd',
},
'crashpad/third_party/ninja/linux': {
'packages': [
{
'package': 'infra/3pp/tools/ninja/${{platform}}',
'version': Var('ninja_version'),
}
],
'condition': 'host_os == "linux"',
'dep_type': 'cipd',
},
'crashpad/third_party/ninja/mac-amd64': {
'packages': [
{
'package': 'infra/3pp/tools/ninja/mac-amd64',
'version': Var('ninja_version'),
}
],
'condition': 'host_os == "mac" and host_cpu == "amd64"',
'dep_type': 'cipd',
},
'crashpad/third_party/ninja/mac-arm64': {
'packages': [
{
'package': 'infra/3pp/tools/ninja/mac-arm64',
'version': Var('ninja_version'),
}
],
'condition': 'host_os == "mac" and host_cpu == "arm64"',
'dep_type': 'cipd',
},
'crashpad/third_party/win/toolchain': {
# This package is only updated when the solution in .gclient includes an
# entry like:

17
third_party/ninja/README.crashpad vendored Normal file
View File

@ -0,0 +1,17 @@
Name: ninja
Short Name: ninja
URL: https://github.com/ninja-build/ninja
Revision: See the CIPD version in DEPS
License: Apache License 2.0
License File: https://github.com/ninja-build/ninja/blob/master/COPYING
Security Critical: no
Description:
Ninja is a small build system with a focus on speed, and is used to build
this project.
The CIPD packages are built using the 3pp pipeline.
https://chromium.googlesource.com/infra/infra/+/refs/heads/main/3pp/ninja/
Local Modifications:
None

43
third_party/ninja/ninja vendored Executable file
View File

@ -0,0 +1,43 @@
#!/bin/sh
# Copyright 2022 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.
set -eu
OS="$(uname -s)"
THIS_DIR="$(dirname "${0}")"
function print_help() {
cat <<EOF >&2
No ninja binary is available for this system.
Try building your own binary by doing:
cd ~
git clone https://github.com/ninja-build/ninja.git
cd ninja && ./configure.py --bootstrap
Then add ~/ninja/ to your PATH.
EOF
}
case "${OS}" in
Linux)
exec "${THIS_DIR}/linux/ninja" "$@";;
Darwin)
ARCH="$(uname -m)"
case "${ARCH}" in
x86_64)
exec "${THIS_DIR}/mac-amd64/ninja" "$@";;
arm64)
exec "${THIS_DIR}/mac-arm64/ninja" "$@";;
*)
echo "Unsupported architecture ${ARCH}" >&2
print_help
exit 1;;
esac
;;
*)
echo "Unsupported OS ${OS}" >&2
print_help
exit 1;;
esac