diff --git a/.gitignore b/.gitignore index 4de7d077..bf9b495c 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/DEPS b/DEPS index cd9ee99f..7392ac6d 100644 --- a/DEPS +++ b/DEPS @@ -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: diff --git a/third_party/ninja/README.crashpad b/third_party/ninja/README.crashpad new file mode 100644 index 00000000..e79bd45f --- /dev/null +++ b/third_party/ninja/README.crashpad @@ -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 diff --git a/third_party/ninja/ninja b/third_party/ninja/ninja new file mode 100755 index 00000000..4dfba212 --- /dev/null +++ b/third_party/ninja/ninja @@ -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 <&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