diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md
index 63d3b03c85..1b119765b5 100644
--- a/recipes/README.recipes.md
+++ b/recipes/README.recipes.md
@@ -854,7 +854,7 @@ This means we started running actual tests (not prerequisite steps
like checkout or compile), and some of these tests have failed.
### *recipe_modules* / [windows\_sdk](/recipes/recipe_modules/windows_sdk)
-[DEPS](/recipes/recipe_modules/windows_sdk/__init__.py#5): [recipe\_engine/cipd][recipe_engine/recipe_modules/cipd], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/step][recipe_engine/recipe_modules/step]
+[DEPS](/recipes/recipe_modules/windows_sdk/__init__.py#5): [recipe\_engine/cipd][recipe_engine/recipe_modules/cipd], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/step][recipe_engine/recipe_modules/step]
The `windows_sdk` module provides safe functions to access a hermetic
Microsoft Visual Studio installation.
@@ -865,7 +865,7 @@ Available only to Google-run bots.
API for using Windows SDK distributed via CIPD.
- **@contextmanager**
— **def [\_\_call\_\_](/recipes/recipe_modules/windows_sdk/api.py#23)(self, path=None, version=None, enabled=True):**
+ **@contextmanager**
— **def [\_\_call\_\_](/recipes/recipe_modules/windows_sdk/api.py#23)(self, path=None, version=None, enabled=True, target_arch='x64'):**
Setups the SDK environment when enabled.
@@ -875,6 +875,7 @@ Args:
version (str): CIPD version of the SDK
(default is set via $infra/windows_sdk.version property)
enabled (bool): Whether the SDK should be used or not.
+ target_arch (str): 'x86' or 'x64'.
Raises:
StepFailure or InfraFailure.
@@ -887,9 +888,9 @@ Raises:
— **def [RunSteps](/recipes/recipe_modules/bot_update/examples/full.py#18)(api):**
### *recipes* / [bot\_update:tests/ensure\_checkout](/recipes/recipe_modules/bot_update/tests/ensure_checkout.py)
-[DEPS](/recipes/recipe_modules/bot_update/tests/ensure_checkout.py#6): [bot\_update](#recipe_modules-bot_update), [gclient](#recipe_modules-gclient), [recipe\_engine/json][recipe_engine/recipe_modules/json]
+[DEPS](/recipes/recipe_modules/bot_update/tests/ensure_checkout.py#7): [bot\_update](#recipe_modules-bot_update), [gclient](#recipe_modules-gclient), [recipe\_engine/json][recipe_engine/recipe_modules/json]
-— **def [RunSteps](/recipes/recipe_modules/bot_update/tests/ensure_checkout.py#13)(api):**
+— **def [RunSteps](/recipes/recipe_modules/bot_update/tests/ensure_checkout.py#14)(api):**
### *recipes* / [cipd:examples/full](/recipes/recipe_modules/cipd/examples/full.py)
[DEPS](/recipes/recipe_modules/cipd/examples/full.py#8): [cipd](#recipe_modules-cipd), [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/step][recipe_engine/recipe_modules/step]
diff --git a/recipes/recipe_modules/windows_sdk/__init__.py b/recipes/recipe_modules/windows_sdk/__init__.py
index 3f43d744d5..0953aa5173 100644
--- a/recipes/recipe_modules/windows_sdk/__init__.py
+++ b/recipes/recipe_modules/windows_sdk/__init__.py
@@ -7,7 +7,6 @@ DEPS = [
'recipe_engine/context',
'recipe_engine/json',
'recipe_engine/path',
- 'recipe_engine/platform',
'recipe_engine/step',
]
diff --git a/recipes/recipe_modules/windows_sdk/api.py b/recipes/recipe_modules/windows_sdk/api.py
index c6ed26d55a..75a0fdfb6b 100644
--- a/recipes/recipe_modules/windows_sdk/api.py
+++ b/recipes/recipe_modules/windows_sdk/api.py
@@ -21,7 +21,7 @@ class WindowsSDKApi(recipe_api.RecipeApi):
self._sdk_properties = sdk_properties
@contextmanager
- def __call__(self, path=None, version=None, enabled=True):
+ def __call__(self, path=None, version=None, enabled=True, target_arch='x64'):
"""Setups the SDK environment when enabled.
Args:
@@ -30,6 +30,7 @@ class WindowsSDKApi(recipe_api.RecipeApi):
version (str): CIPD version of the SDK
(default is set via $infra/windows_sdk.version property)
enabled (bool): Whether the SDK should be used or not.
+ target_arch (str): 'x86' or 'x64'.
Raises:
StepFailure or InfraFailure.
@@ -39,7 +40,7 @@ class WindowsSDKApi(recipe_api.RecipeApi):
path or self.m.path['cache'].join('windows_sdk'),
version or self._sdk_properties['version'])
try:
- with self.m.context(**self._sdk_env(sdk_dir)):
+ with self.m.context(**self._sdk_env(sdk_dir, target_arch)):
yield
finally:
# cl.exe automatically starts background mspdbsrv.exe daemon which
@@ -68,13 +69,14 @@ class WindowsSDKApi(recipe_api.RecipeApi):
self.m.cipd.ensure(sdk_dir, pkgs)
return sdk_dir
- def _sdk_env(self, sdk_dir):
+ def _sdk_env(self, sdk_dir, target_arch):
"""Constructs the environment for the SDK.
Returns environment and environment prefixes.
Args:
sdk_dir (path): Path to a directory containing the SDK.
+ target_arch (str): 'x86' or 'x64'
"""
env = {}
env_prefixes = {}
@@ -89,7 +91,8 @@ class WindowsSDKApi(recipe_api.RecipeApi):
# }
# All these environment variables need to be added to the environment
# for the compiler and linker to work.
- filename = 'SetEnv.%s.json' % {32: 'x86', 64: 'x64'}[self.m.platform.bits]
+ assert target_arch in ('x86', 'x64')
+ filename = 'SetEnv.%s.json' % target_arch
step_result = self.m.json.read(
'read %s' % filename, sdk_dir.join('win_sdk', 'bin', filename),
step_test_data=lambda: self.m.json.test_api.output({