Commit bdb11237 authored by Robert Iannucci's avatar Robert Iannucci Committed by Commit Bot

[osx_sdk] Fix properties when setting a single value.

Because of the (unfortunate) ways that PROPERTIES works currently,
setting defaults in the obvious way means that providing a subset of the
values as properties replaces the defaults entirely.

In this case we want to override the sdk_version without having to
override the toolchain app version.

R=jchinlee@chromium.org, tandrii@chromium.org

Change-Id: I13f4ee19e45a3bb147b37f69d10cb4ed4f734a21
Reviewed-on: https://chromium-review.googlesource.com/c/1438088
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
parent eb2767b2
......@@ -670,11 +670,11 @@ XCode installation.
Available only to Google-run bots.
#### **class [OSXSDKApi](/recipes/recipe_modules/osx_sdk/api.py#15)([RecipeApi][recipe_engine/wkt/RecipeApi]):**
#### **class [OSXSDKApi](/recipes/recipe_modules/osx_sdk/api.py#24)([RecipeApi][recipe_engine/wkt/RecipeApi]):**
API for using OS X SDK distributed via CIPD.
&emsp; **@contextmanager**<br>&mdash; **def [\_\_call\_\_](/recipes/recipe_modules/osx_sdk/api.py#25)(self, kind):**
&emsp; **@contextmanager**<br>&mdash; **def [\_\_call\_\_](/recipes/recipe_modules/osx_sdk/api.py#37)(self, kind):**
Sets up the XCode SDK environment.
......
......@@ -30,11 +30,6 @@ PROPERTIES = {
# The CIPD toolchain tool package and version
toolchain_pkg=Single(str),
toolchain_ver=Single(str),
), default={
'sdk_version': '9c40b',
'toolchain_pkg': 'infra/tools/mac_toolchain/${platform}',
'toolchain_ver': 'git_revision:796d2b92cff93fc2059623ce0a66284373ceea0a',
},
), default={},
)
}
......@@ -11,6 +11,15 @@ from contextlib import contextmanager
from recipe_engine import recipe_api
# TODO(iannucci): replace this with something sane when PROPERTIES is
# implemented with a proto message.
_PROPERTY_DEFAULTS = {
'sdk_version': '9c40b',
'toolchain_pkg': 'infra/tools/mac_toolchain/${platform}',
'toolchain_ver': 'git_revision:796d2b92cff93fc2059623ce0a66284373ceea0a',
}
class OSXSDKApi(recipe_api.RecipeApi):
"""API for using OS X SDK distributed via CIPD."""
......@@ -18,9 +27,12 @@ class OSXSDKApi(recipe_api.RecipeApi):
def __init__(self, sdk_properties, *args, **kwargs):
super(OSXSDKApi, self).__init__(*args, **kwargs)
self._sdk_version = sdk_properties['sdk_version'].lower()
self._tool_pkg = sdk_properties['toolchain_pkg']
self._tool_ver = sdk_properties['toolchain_ver']
actual_props = _PROPERTY_DEFAULTS.copy()
actual_props.update(sdk_properties)
self._sdk_version = actual_props['sdk_version'].lower()
self._tool_pkg = actual_props['toolchain_pkg']
self._tool_ver = actual_props['toolchain_ver']
@contextmanager
def __call__(self, kind):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment