|
|
|
@echo off
|
|
|
|
:: Copyright 2017 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.
|
|
|
|
|
|
|
|
setlocal
|
|
|
|
|
Reland "Check whether goma is running when it is enabled"
This reverts commit 428143ee24c5f084c8dfb38cd17f07b4f7ba9bf7.
Reason for revert: Fixing the issues revealed by the original change by
avoiding python3 and by checking for the existence of gomacc[.exe]
before running it.
This also relands 2241db8a1f6c05325c8a0c9eb5426d96cd6fa984 - "Avoid
capture_output to support Python 3.6", to simplify relanding and any
possible reverts.
Original change's description:
> Revert "Check whether goma is running when it is enabled"
>
> This reverts commit b7ddc5a0091bcd4d070fcd91027d7099338e84b9.
>
> Reason for revert:
> This broke the builder where depot_tools is not in PATH.
> https://logs.chromium.org/logs/infra-internal/buildbucket/cr-buildbucket.appspot.com/8858077852309878080/+/u/build/stdout
>
> Original change's description:
> > Check whether goma is running when it is enabled
> >
> > One of the mistakes one can make when running ninja is having goma
> > enabled (use_goma=true in args.gn) but not having goma running. This can
> > lead to ~1,000 failed compile steps, which is messy.
> >
> > This change teaches autoninja.py to check whether goma is running. If
> > not then it tells autoninja to just print a warning message. The
> > check costs roughly 30 ms which seems reasonable.
> >
> > In fact, because this change also switches away from vpython (necessary
> > to use python3 to use subprocess.run) it actually runs about 600 ms
> > _faster_ than before this change.
> >
> > If build acceleration is requested through use_rbe then no checking for
> > whether the service is running is done. That could be added in the
> > future.
> >
> > autoninja.py could auto-start goma but that is error prone and has
> > limited additional value.
> >
> > This was tested on Linux, OSX, and Windows.
> >
> > Bug: 868590, b/174673874
> > Change-Id: Ie773e574878471e5136b9b82d52f86af3d848318
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2627014
> > Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
> > Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
>
> TBR=yyanagisawa@google.com,dpranke@google.com,brucedawson@chromium.org,sanfin@chromium.org,infra-scoped@luci-project-accounts.iam.gserviceaccount.com
>
> Change-Id: I57a6c73ea853259f3d1ec7ad0ce51e495acc96db
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 868590
> Bug: b/174673874
> Bug: 1167064
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2632018
> Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
> Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@google.com>
TBR=yyanagisawa@google.com,dpranke@google.com,brucedawson@chromium.org,sanfin@chromium.org,infra-scoped@luci-project-accounts.iam.gserviceaccount.com
# Not skipping CQ checks because this is a reland.
Bug: 868590
Bug: b/174673874
Bug: 1167064
Change-Id: I8aa6830259bc18f8e7926cd0bf5c62e671c74a2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2634201
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
4 years ago
|
|
|
set scriptdir=%~dp0
|
|
|
|
|
|
|
|
if not defined AUTONINJA_BUILD_ID (
|
|
|
|
:: Set unique build ID.
|
|
|
|
FOR /f "usebackq tokens=*" %%a in (`%scriptdir%python-bin\python3.bat -c "import uuid; print(uuid.uuid4())"`) do set AUTONINJA_BUILD_ID=%%a
|
|
|
|
)
|
|
|
|
|
|
|
|
:: If a build performance summary has been requested then also set NINJA_STATUS
|
|
|
|
:: to trigger more verbose status updates. In particular this makes it possible
|
|
|
|
:: to see how quickly process creation is happening - often a critical clue on
|
|
|
|
:: Windows. The trailing space is intentional.
|
|
|
|
if "%NINJA_SUMMARIZE_BUILD%" == "1" set NINJA_STATUS=[%%r processes, %%f/%%t @ %%o/s : %%es ]
|
|
|
|
|
|
|
|
:loop
|
|
|
|
IF NOT "%1"=="" (
|
|
|
|
:: Tell goma or reclient to not do network compiles.
|
|
|
|
IF "%1"=="--offline" (
|
|
|
|
SET GOMA_DISABLED=1
|
|
|
|
SET RBE_remote_disabled=1
|
|
|
|
)
|
|
|
|
IF "%1"=="-o" (
|
|
|
|
SET GOMA_DISABLED=1
|
|
|
|
SET RBE_remote_disabled=1
|
|
|
|
)
|
|
|
|
SHIFT
|
|
|
|
GOTO :loop
|
|
|
|
)
|
|
|
|
|
|
|
|
:: Execute whatever is printed by autoninja.py.
|
|
|
|
:: Also print it to reassure that the right settings are being used.
|
|
|
|
:: Don't use vpython - it is too slow to start.
|
|
|
|
:: Don't use python3 because it doesn't work in git bash on Windows and we
|
|
|
|
:: should be consistent between autoninja.bat and the autoninja script used by
|
|
|
|
:: git bash.
|
|
|
|
FOR /f "usebackq tokens=*" %%a in (`%scriptdir%python-bin\python3.bat %scriptdir%autoninja.py "%*"`) do echo %%a & %%a
|
|
|
|
@if errorlevel 1 goto buildfailure
|
|
|
|
|
|
|
|
:: Use call to invoke python script here, because we use python via python3.bat.
|
|
|
|
@if "%NINJA_SUMMARIZE_BUILD%" == "1" call %scriptdir%python-bin\python3.bat %scriptdir%post_build_ninja_summary.py %*
|
|
|
|
@call %scriptdir%python-bin\python3.bat %scriptdir%ninjalog_uploader_wrapper.py --cmdline %*
|
|
|
|
|
|
|
|
exit /b %ERRORLEVEL%
|
|
|
|
:buildfailure
|
|
|
|
|
|
|
|
@call %scriptdir%python-bin\python3.bat %scriptdir%ninjalog_uploader_wrapper.py --cmdline %*
|
|
|
|
|
|
|
|
:: Return an error code of 1 so that if a developer types:
|
|
|
|
:: "autoninja chrome && chrome" then chrome won't run if the build fails.
|
|
|
|
cmd /c exit 1
|