Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: ninja.bat

Issue 10222010: Don't set up environment for ninja if the compiler is already available (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 @echo off 1 @echo off
2 2
3 :: Copyright (c) 2012 Google Inc. All rights reserved. 3 :: Copyright (c) 2012 Google Inc. All rights reserved.
4 :: Use of this source code is governed by a BSD-style license that can be 4 :: Use of this source code is governed by a BSD-style license that can be
5 :: found in the LICENSE file. 5 :: found in the LICENSE file.
6 6
7 setlocal enabledelayedexpansion 7 setlocal enabledelayedexpansion
8 8
9 :: Parse args to see if a -C argument (to change working directory) is being 9 :: Parse args to see if a -C argument (to change working directory) is being
10 :: supplied. We expect project generation to output a set_environment.bat that 10 :: supplied. We expect project generation to output a set_environment.bat that
11 :: will set up the environment (variables and path). This script generally 11 :: will set up the environment (variables and path). This script generally
12 :: just calls the correct VS vars batch file, but only gyp has the knowledge 12 :: just calls the correct VS vars batch file, but only gyp has the knowledge
13 :: to determine which version of the IDE/toolchain it wants to use, so we have 13 :: to determine which version of the IDE/toolchain it wants to use, so we have
14 :: to defer to it to make that decision. 14 :: to defer to it to make that decision.
15 set found_dash_c=0 15 set found_dash_c=0
16 set cd_path=. 16 set cd_path=.
17 for %%A in (%*) do ( 17 for %%A in (%*) do (
18 if "!found_dash_c!"=="1" ( 18 if "!found_dash_c!"=="1" (
19 set cd_path=%%A 19 set cd_path=%%A
20 goto done_dash_c 20 goto done_dash_c
21 ) 21 )
22 if "%%A"=="-C" ( 22 if "%%A"=="-C" (
23 set found_dash_c=1 23 set found_dash_c=1
24 ) 24 )
25 ) 25 )
26 :done_dash_c 26 :done_dash_c
27 27
28 :: Try running the compiler. If it fails, then we assume we need to set up the
29 :: environment for the compiler.
30 :: TODO(scottmg): We should also try to detect if we have the right version
31 :: of the compiler too (i.e. If generation specified 2010, but we're running
32 :: from a 2008 command prompt).
33 cl 2>nul >nul
34 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
35
28 if not exist "%cd_path%\set_environment.bat" ( 36 if not exist "%cd_path%\set_environment.bat" (
29 echo ninja.bat: set_environment.bat not found in '%cd_path%'. Is -C arg correc t? 37 echo ninja.bat: set_environment.bat not found in '%cd_path%'. Is -C arg correc t?
30 goto :EOF 38 goto :EOF
31 ) 39 )
32 call "%cd_path%\set_environment.bat" 40 call "%cd_path%\set_environment.bat"
33 41
42 :: Export only the path changes out of the script.
43 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
44
34 :: Add python to the path, many gyp rules assume it's there. 45 :: Add python to the path, many gyp rules assume it's there.
35 :: Add ninja directory to the path (to find ninja and ninja-deplist-helper). 46 :: Add ninja directory to the path (to find ninja and ninja-deplist-helper).
36 :: Then, export only the path changes out of the script so that next time we 47 :: Put it at the front so that ninja.exe is found before this wrapper so that
37 :: just run ninja directly (otherwise, this script adds about 500-800ms to 48 :: next time we just run it directly (otherwise, this script adds 500-800ms to
38 :: ninja invocations). 49 :: ninja invocations).
39 endlocal & set PATH=%~dp0python_bin;%~dp0ninja-win;%PATH% & set INCLUDE=%INCLUDE % & set LIBPATH=%LIBPATH% & set LIB=%LIB% 50 :no_set_env
51 endlocal & set PATH=%~dp0python_bin;%~dp0ninja-win;%PATH%
40 52
41 :: Now run the actual build. 53 :: Now run the actual build.
42 ninja.exe %* 54 ninja.exe %*
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698