mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 02:31:29 +00:00
This reverts commit3133f98f3f. Reason for revert: angle recipe fails to find third_party/depot_tool/ninja.exe https://luci-milo.appspot.com/ui/p/angle/builders/try/win-trace/2061/overview https://source.chromium.org/chromium/chromium/src/+/main:third_party/angle/src/tests/capture_replay_tests.py;l=134;drc=1d67951e0851d855c016c04cd5d11e10a0e12454 Original change's description: > Retry switching to use CIPD ninja v1.8.2 > > This reverts commit0a5bae7ebc+ some modifications on recipe module. > > The previous CL https://crrev.com/c/3697958 ensures depot_tools/.cipd_bin in recipe environments. This CL copies ninja.exe from .cipd_bin to depot_tools root as cipd_bin_setup.bat. > For developers, it's expected to run update_depot_tools which triggers cipd_bin_setup. > For CI/CQ, depot_tools._cipd_bin_setup() should be called before using ninja/autoninja recipe module APIs. > > Builds with depot_tools recipe bundle are tested using led. > > # Windows > > led get-build 8811491780369249585 | led edit-recipe-bundle -O depot_tools="$HOME/depot_tools" | led launch > https://ci.chromium.org/swarming/task/5b7512ee9d91fc10? > > # Linux > > led get-build 8811504372914233697 | led edit-recipe-bundle -O depot_tools="$HOME/depot_tools" | led launch > https://ci.chromium.org/swarming/task/5b7515832d0f7c10 > > Original change's description: > > Revert "Switch to use CIPD ninja v1.8.2" > > > > This reverts commitc90a982106. > > > > Reason for revert: > > https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket/8811949917908303825/+/u/compile/stdout > > > > Original change's description: > > > Switch to use CIPD ninja v1.8.2 > > > > > > https://crrev.com/c/3674981 installed CIPD ninja packages. > > > This CL switches from the old ninja binaries to them. > > > > > > Note that this CL doesn't change ninja version. the old/CIPD ninja binaries are v1.8.2. > > > > > > The differences from the old binaries are > > > - the CIPD packages don't use chromium's clang. > > > - the CIPD package for Linux doesn't use chromium's sysroot. > > > - the min macOS version is 10.13, which was 10.6. > > > Please also see https://crsrc.org/i/3pp/ninja/install_bootstrap.sh > > > > > > > > > On Windows, ninja.exe will be installed under .cipd_bin. > > > But there are many places that assume that ninja.exe exists on depot_tools root. So this CL also copies the ninja.exe from .cipd_bin to root in cipd_bin_setup.bat. > > > > > > Bug: 931218 > > > Change-Id: Ib67eee5e9b6ad9b2937b789626970d9c85867dbd > > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3674982 > > > Commit-Queue: Junji Watanabe <jwata@google.com> > > > Reviewed-by: Philipp Wollermann <philwo@google.com> > > > Reviewed-by: Takuto Ikuta <tikuta@chromium.org> > > > Reviewed-by: Nico Weber <thakis@chromium.org> > > > Reviewed-by: Josip Sokcevic <sokcevic@google.com> > > > > Bug: 931218 > > Change-Id: I08d61dad119a0d23ae9ec8b1ed787dd3915de697 > > No-Presubmit: true > > No-Tree-Checks: true > > No-Try: true > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3686854 > > Auto-Submit: Takuto Ikuta <tikuta@chromium.org> > > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > > Commit-Queue: Takuto Ikuta <tikuta@chromium.org> > > Owners-Override: Takuto Ikuta <tikuta@chromium.org> > > Bug: 931218 > Recipe-Nontrivial-Roll: build > Recipe-Nontrivial-Roll: build_limited > Recipe-Nontrivial-Roll: chrome_release > Recipe-Nontrivial-Roll: infra > Change-Id: Ic7a9395c0e858823375f1a6ec79034dbc54230bb > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3696963 > Reviewed-by: Fumitoshi Ukai <ukai@google.com> > Reviewed-by: Josip Sokcevic <sokcevic@google.com> > Commit-Queue: Junji Watanabe <jwata@google.com> > Reviewed-by: Takuto Ikuta <tikuta@chromium.org> Bug: 931218 Recipe-Nontrivial-Roll: build Recipe-Nontrivial-Roll: build_limited Recipe-Nontrivial-Roll: chrome_release Recipe-Nontrivial-Roll: infra Change-Id: I6d44be002940331eb4b7cf88ca7aa1e717ba1514 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3708294 Auto-Submit: Junji Watanabe <jwata@google.com> Commit-Queue: Junji Watanabe <jwata@google.com> Reviewed-by: Takuto Ikuta <tikuta@chromium.org> Owners-Override: Takuto Ikuta <tikuta@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
90 lines
2.4 KiB
Python
90 lines
2.4 KiB
Python
# Copyright 2016 The Chromium Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
"""The `depot_tools` module provides safe functions to access paths within
|
|
the depot_tools repo."""
|
|
|
|
import contextlib
|
|
|
|
from recipe_engine import recipe_api
|
|
|
|
class DepotToolsApi(recipe_api.RecipeApi):
|
|
def __init__(self, **kwargs):
|
|
super(DepotToolsApi, self).__init__(**kwargs);
|
|
self._cipd_bin_setup_called = False
|
|
|
|
@property
|
|
def download_from_google_storage_path(self):
|
|
return self.repo_resource('download_from_google_storage.py')
|
|
|
|
@property
|
|
def upload_to_google_storage_path(self):
|
|
return self.repo_resource('upload_to_google_storage.py')
|
|
|
|
@property
|
|
def root(self):
|
|
"""Returns (Path): The "depot_tools" root directory."""
|
|
return self.repo_resource()
|
|
|
|
@property
|
|
def cros_path(self):
|
|
return self.repo_resource('cros')
|
|
|
|
@property
|
|
def gn_py_path(self):
|
|
return self.repo_resource('gn.py')
|
|
|
|
# TODO(dnj): Remove this once everything uses the "gsutil" recipe module
|
|
# version.
|
|
@property
|
|
def gsutil_py_path(self):
|
|
return self.repo_resource('gsutil.py')
|
|
|
|
@property
|
|
def ninja_path(self):
|
|
self._cipd_bin_setup()
|
|
ninja_exe = 'ninja.exe' if self.m.platform.is_win else 'ninja'
|
|
return self.repo_resource(ninja_exe)
|
|
|
|
@property
|
|
def autoninja_path(self):
|
|
self._cipd_bin_setup()
|
|
autoninja = 'autoninja.bat' if self.m.platform.is_win else 'autoninja'
|
|
return self.repo_resource(autoninja)
|
|
|
|
@property
|
|
def presubmit_support_py_path(self):
|
|
return self.repo_resource('presubmit_support.py')
|
|
|
|
@contextlib.contextmanager
|
|
def on_path(self):
|
|
"""Use this context manager to put depot_tools on $PATH.
|
|
|
|
Example:
|
|
|
|
```python
|
|
with api.depot_tools.on_path():
|
|
# run some steps
|
|
```
|
|
"""
|
|
# By default Depot Tools do not auto update on the bots.
|
|
# (crbug/1090603)
|
|
self._cipd_bin_setup()
|
|
with self.m.context(
|
|
**{'env_suffixes': {
|
|
'PATH': [self.root],
|
|
'DEPOT_TOOLS_UPDATE': '0'
|
|
}}):
|
|
yield
|
|
|
|
def _cipd_bin_setup(self):
|
|
"""Installs CIPD packages under .cipd_bin."""
|
|
if self._cipd_bin_setup_called:
|
|
return
|
|
self.m.cipd.ensure(
|
|
self.repo_resource('.cipd_bin'),
|
|
self.repo_resource('cipd_manifest.txt'),
|
|
'ensure depot_tools/.cipd_bin')
|
|
self._cipd_bin_setup_called = True
|