Chromium Code Reviews| Index: build/vs_toolchain.py |
| diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py |
| index 1fd8a11445b275fce2be9029d85aadbcb6d75799..e659645c461f669e7e86701a5b1bebe0ae236cca 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_TOOLCHAIN_VERSION = '2013' |
|
brucedawson
2016/01/15 21:10:52
Should probably be "CURRENT_DEFAULT_TOOLCHAIN_VERS
Sébastien Marchand
2016/01/15 21:21:39
Done.
|
| + |
| + |
| 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) |
| @@ -105,8 +109,8 @@ def DetectVisualStudioPath(): |
| # Note that this code is used from |
| # build/toolchain/win/setup_toolchain.py as well. |
| - # Default to Visual Studio 2013 for now. |
| - version_as_year = os.environ.get('GYP_MSVS_VERSION', '2013') |
| + version_as_year = os.environ.get('GYP_MSVS_VERSION', |
| + CURRENT_TOOLCHAIN_VERSION) |
| year_to_version = { |
| '2013': '12.0', |
| '2015': '14.0', |
| @@ -263,6 +267,21 @@ 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 = os.environ.get('GYP_MSVS_VERSION', CURRENT_TOOLCHAIN_VERSION) |
| + # 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. |
| + if version != env_version: |
|
scottmg
2016/01/15 21:08:13
return version != env_version
Sébastien Marchand
2016/01/15 21:21:39
Done.
|
| + return True |
| + return False |
| + |
| + |
| 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 |