You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
depot_tools/autoninja.bat

34 lines
1.4 KiB
Batchfile

@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
REM Set unique build ID.
FOR /f "usebackq tokens=*" %%a in (`python -c "from __future__ import print_function; import uuid; print(uuid.uuid4())"`) do set AUTONINJA_BUILD_ID=%%a
REM If a build performance summary has been requested then also set NINJA_STATUS
REM to trigger more verbose status updates. In particular this makes it possible
REM to see how quickly process creation is happening - often a critical clue on
REM Windows. The trailing space is intentional.
if "%NINJA_SUMMARIZE_BUILD%" == "1" set NINJA_STATUS=[%%r processes, %%f/%%t @ %%o/s : %%es ]
REM Execute whatever is printed by autoninja.py.
REM Also print it to reassure that the right settings are being used.
Fix autoninja to allow compiling one source file This is the second attempt at fixing autoninja to allow passing '^^' to it to specify that ninja should build the outputs of the specified file instead of building that file itself. The problem is that '^' is a special character and when extra layers of indirection are added the number of '^' characters needed grows exponentially in some poorly understood way. The first fix attempt just quoted the arguments that autoninja.bat passed to autoninja.py, but that meant they came in as one argument. This fix expands on that by modifying autoninja.py to understand how to deal with the monolithic argument. With this change this once again works: autoninja -C out\debug_component ..\..\base\win\enum_variant.cc^^ It can be convenient to have a ninja.bat file which starts goma and lets users keep typing the same build commands. However even with this fix the previously recommended ninja.bat file must be invoked with four '^' characters. If that is too much then the new recommended ninja.bat is to copy autoninja.bat and modify as needed, perhaps like this: @echo off call python c:\goma\goma-win64\goma_ctl.py ensure_start >nul FOR /f "usebackq tokens=*" %%a in (`python c:\src\depot_tools\autoninja.py "%*"`) do echo %%a & %%a BUG: 758725 Change-Id: Ieee9cf343ee5f22e9988a1969cb7a7a90687666b Reviewed-on: https://chromium-review.googlesource.com/656478 Reviewed-by: Sébastien Marchand <sebmarchand@chromium.org> Reviewed-by: Dirk Pranke <dpranke@chromium.org> Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
8 years ago
FOR /f "usebackq tokens=*" %%a in (`python %~dp0autoninja.py "%*"`) do echo %%a & %%a
@if errorlevel 1 goto buildfailure
REM Use call to invoke python script here, because we use python via python.bat.
@if "%NINJA_SUMMARIZE_BUILD%" == "1" call python.bat %~dp0post_build_ninja_summary.py %*
@call python.bat %~dp0ninjalog_uploader_wrapper.py --cmdline %*
exit /b
:buildfailure
@call python.bat %~dp0ninjalog_uploader_wrapper.py --cmdline %*
REM Return an error code of 1 so that if a developer types:
REM "autoninja chrome && chrome" then chrome won't run if the build fails.
cmd /c exit 1