diff options
author | sebmarchand <sebmarchand@chromium.org> | 2016-01-15 14:29:57 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-15 22:30:53 +0000 |
commit | e44b02e42a8b593a83bc569240923d0e6faa64d0 (patch) | |
tree | 0e702bd9dcb6986b5429983fa02473dfebd383e9 /build | |
parent | 16bd343376b9ff8f6e01a3eede74c732e15e4c19 (diff) | |
download | chromium_src-e44b02e42a8b593a83bc569240923d0e6faa64d0.zip chromium_src-e44b02e42a8b593a83bc569240923d0e6faa64d0.tar.gz chromium_src-e44b02e42a8b593a83bc569240923d0e6faa64d0.tar.bz2 |
Update the toolchain if there's a mismatch between the env and win_toolchain.json
BUG=569152
Review URL: https://codereview.chromium.org/1582173003
Cr-Commit-Position: refs/heads/master@{#369867}
Diffstat (limited to 'build')
-rwxr-xr-x | build/vs_toolchain.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py index a326f4b..6a0e6c9 100755 --- a/build/vs_toolchain.py +++ b/build/vs_toolchain.py @@ -21,6 +21,10 @@ json_data_file = os.path.join(script_dir, 'win_toolchain.json') import gyp +# Use MSVS2013 as the default toolchain. +CURRENT_DEFAULT_TOOLCHAIN_VERSION = '2013' + + def SetEnvironmentAndGetRuntimeDllDirs(): """Sets up os.environ to use the depot_tools VS toolchain with gyp, and returns the location of the VS runtime DLLs so they can be copied into @@ -33,7 +37,7 @@ def SetEnvironmentAndGetRuntimeDllDirs(): # been downloaded before (in which case json_data_file will exist). if ((sys.platform in ('win32', 'cygwin') or os.path.exists(json_data_file)) and depot_tools_win_toolchain): - if not os.path.exists(json_data_file): + if ShouldUpdateToolchain(): Update() with open(json_data_file, 'r') as tempf: toolchain_data = json.load(tempf) @@ -99,9 +103,9 @@ def _RegistryGetValue(key, value): def GetVisualStudioVersion(): - """Return GYP_MSVS_VERSION of Visual Studio, default to 2013 for now. + """Return GYP_MSVS_VERSION of Visual Studio. """ - return os.environ.get('GYP_MSVS_VERSION', '2013') + return os.environ.get('GYP_MSVS_VERSION', CURRENT_DEFAULT_TOOLCHAIN_VERSION) def DetectVisualStudioPath(): @@ -272,6 +276,19 @@ def _GetDesiredVsToolchainHashes(): return ['9ff97c632ae1fee0c98bcd53e71770eb3a0d8deb'] +def ShouldUpdateToolchain(): + """Check if the toolchain should be upgraded.""" + if not os.path.exists(json_data_file): + return True + with open(json_data_file, 'r') as tempf: + toolchain_data = json.load(tempf) + version = toolchain_data['version'] + env_version = GetVisualStudioVersion() + # If there's a mismatch between the version set in the environment and the one + # in the json file then the toolchain should be updated. + return version != env_version + + def Update(force=False): """Requests an update of the toolchain to the specific hashes we have at this revision. The update outputs a .json of the various configuration |