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

Unified Diff: native_client_sdk/src/build_tools/buildbot_common.py

Issue 811533002: [NaCl SDK] Update Windows build to use vs2013 from depot_tools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge master Created 5 years, 11 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
Index: native_client_sdk/src/build_tools/buildbot_common.py
diff --git a/native_client_sdk/src/build_tools/buildbot_common.py b/native_client_sdk/src/build_tools/buildbot_common.py
index 7fad468c97a51e838a8d3543f0b4c36ebc7f168b..d0186d5538663ef10157b81e8a88de3ae1efb6cd 100644
--- a/native_client_sdk/src/build_tools/buildbot_common.py
+++ b/native_client_sdk/src/build_tools/buildbot_common.py
@@ -58,6 +58,10 @@ def Trace(msg):
def GetWindowsEnvironment():
+ if oshelpers.FindExeInPath('cl.exe') is not None:
+ # cl.exe is already in the path, let's just use that.
+ return os.environ
+
sys.path.append(os.path.join(NACL_DIR, 'buildbot'))
import buildbot_standard
@@ -85,12 +89,30 @@ def GetWindowsEnvironment():
context = FakeContext()
buildbot_standard.SetupWindowsEnvironment(context)
- # buildbot_standard.SetupWindowsEnvironment adds the directory which contains
- # vcvarsall.bat to the path, but not the directory which contains cl.exe,
- # link.exe, etc.
- # Running vcvarsall.bat adds the correct directories to the path, which we
- # extract below.
- process = subprocess.Popen('vcvarsall.bat x86 > NUL && set',
+ env_script = 'vcvarsall.bat'
+
+ if not oshelpers.FindExeInPath(env_script):
+ # This might happen if Visual Studio is not installed. Check to see if
+ # vs2013 is in depot_tools.
+
+ # Find depot_tools by looking for gclient.bat.
+ gclient_bat = oshelpers.FindExeInPath('gclient.bat')
+ if gclient_bat is None:
+ ErrorExit('gclient.bat is not in the path. Where is depot_tools?')
+
+ depot_tools_dir = os.path.dirname(gclient_bat)
+ vs2013_dir = os.path.join(depot_tools_dir, 'win_toolchain', 'vs2013_files')
+ if not os.path.exists(vs2013_dir):
+ ErrorExit('Visual Studio not installed normally or in depot_tools.')
+
+ # The depot_tools vs2013 toolchain has its own batch file (not
+ # vcvarsall.bat) for setting the environment variables needed by vs2013.
+ env_script = os.path.join(vs2013_dir, 'win8sdk', 'bin', 'SetEnv.cmd')
+
+ # Running the env_script adds the correct directories to the path for
+ # executables (e.g. cl.exe, link.exe), include paths, lib directories, etc,
+ # which we extract below.
+ process = subprocess.Popen(env_script + ' x86 > NUL && set',
stdout=subprocess.PIPE, env=context.env, shell=True)
stdout, _ = process.communicate()
« no previous file with comments | « native_client_sdk/src/build_tools/build_sdk.py ('k') | native_client_sdk/src/build_tools/tests/build_artifacts_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698