Chromium Code Reviews| Index: ninja.bat |
| =================================================================== |
| --- ninja.bat (revision 133516) |
| +++ ninja.bat (working copy) |
| @@ -25,18 +25,30 @@ |
| ) |
| :done_dash_c |
| +:: Try running the compiler. If it fails, then we assume we need to set up the |
| +:: environment for the compiler. |
| +:: TODO(scottmg): We should also try to detect if we have the right version |
| +:: of the compiler too (i.e. If generation specified 2010, but we're running |
| +:: from a 2008 command prompt). |
| +cl 2>nul >nul |
| +if %errorlevel% EQU 0 goto no_set_env |
|
Marc-Antoine Ruel (Google)
2012/04/25 17:55:49
back in my days I would have written
if not errorl
|
| + |
| if not exist "%cd_path%\set_environment.bat" ( |
| echo ninja.bat: set_environment.bat not found in '%cd_path%'. Is -C arg correct? |
| goto :EOF |
| ) |
| call "%cd_path%\set_environment.bat" |
| +:: Export only the path changes out of the script. |
| +endlocal & set PATH=%PATH% & set INCLUDE=%INCLUDE% & set LIBPATH=%LIBPATH% & set LIB=%LIB% |
|
Marc-Antoine Ruel (Google)
2012/04/25 17:55:49
nice construct, never thought about doing that. Bu
|
| + |
| :: Add python to the path, many gyp rules assume it's there. |
| :: Add ninja directory to the path (to find ninja and ninja-deplist-helper). |
| -:: Then, export only the path changes out of the script so that next time we |
| -:: just run ninja directly (otherwise, this script adds about 500-800ms to |
| +:: Put it at the front so that ninja.exe is found before this wrapper so that |
| +:: next time we just run it directly (otherwise, this script adds 500-800ms to |
| :: ninja invocations). |
| -endlocal & set PATH=%~dp0python_bin;%~dp0ninja-win;%PATH% & set INCLUDE=%INCLUDE% & set LIBPATH=%LIBPATH% & set LIB=%LIB% |
| +:no_set_env |
| +endlocal & set PATH=%~dp0python_bin;%~dp0ninja-win;%PATH% |
| :: Now run the actual build. |
| ninja.exe %* |