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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ninja.bat
===================================================================
--- ninja.bat (revision 133516)
+++ ninja.bat (working copy)
@@ -25,18 +25,33 @@
)
: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 not errorlevel 1 goto no_set_env
+
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%
+
+:: To pair with below when we don't skip this block.
+setlocal
+
:: 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 %*
« 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