Commit 18146207 authored by Garrett Beaty's avatar Garrett Beaty Committed by Commit Bot

Add the notion of an OS category to the os enum.

This reduces the maintenance burden of maintaining OS-specific defaults
(e.g. builderless) and enables simplifying a proposed change that goma
wishes to make for their builders.

Change-Id: Icc68cfcbbf536d28e3e0df6d7eedfb85266a4db5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1995464
Auto-Submit: Garrett Beaty <gbeaty@chromium.org>
Reviewed-by: default avatarAaron Gable <agable@chromium.org>
Commit-Queue: Garrett Beaty <gbeaty@chromium.org>
Cr-Commit-Position: refs/heads/master@{#730914}
parent 87de37d0
......@@ -31,28 +31,40 @@ cpu = struct(
)
# The category for an os: a more generic grouping than specific OS versions that
# can be used for computing defaults
os_category = struct(
ANDROID = 'Android',
LINUX = 'Linux',
MAC = 'Mac',
WINDOWS = 'Windows',
)
# The os constants to be used for the os parameter of the builder function
# The *_DEFAULT members enable distinguishing between a use that runs the
# "current" version of the OS and a use that runs against a specific version
# that happens to be the "current" version
os = struct(
ANDROID = 'Android',
def os_enum(dimension, category):
return struct(dimension=dimension, category=category)
LINUX_TRUSTY = 'Ubuntu-14.04',
LINUX_XENIAL = 'Ubuntu-16.04',
LINUX_DEFAULT = 'Ubuntu-16.04',
MAC_10_12 = 'Mac-10.12',
MAC_10_13 = 'Mac-10.13',
MAC_10_14 = 'Mac-10.14',
MAC_DEFAULT = 'Mac-10.13',
MAC_ANY = 'Mac',
WINDOWS_7 = 'Windows-7',
WINDOWS_8_1 = 'Windows-8.1',
WINDOWS_10 = 'Windows-10',
WINDOWS_DEFAULT = 'Windows-10',
WINDOWS_ANY = 'Windows',
os = struct(
ANDROID = os_enum('Android', os_category.ANDROID),
LINUX_TRUSTY = os_enum('Ubuntu-14.04', os_category.LINUX),
LINUX_XENIAL = os_enum('Ubuntu-16.04', os_category.LINUX),
LINUX_DEFAULT = os_enum('Ubuntu-16.04', os_category.LINUX),
MAC_10_12 = os_enum('Mac-10.12', os_category.MAC),
MAC_10_13 = os_enum('Mac-10.13', os_category.MAC),
MAC_10_14 = os_enum('Mac-10.14', os_category.MAC),
MAC_DEFAULT = os_enum('Mac-10.13', os_category.MAC),
MAC_ANY = os_enum('Mac', os_category.MAC),
WINDOWS_7 = os_enum('Windows-7', os_category.WINDOWS),
WINDOWS_8_1 = os_enum('Windows-8.1', os_category.WINDOWS),
WINDOWS_10 = os_enum('Windows-10', os_category.WINDOWS),
WINDOWS_DEFAULT = os_enum('Windows-10', os_category.WINDOWS),
WINDOWS_ANY = os_enum('Windows', os_category.WINDOWS),
)
......@@ -108,7 +120,7 @@ goma = struct(
# Implementation details #
################################################################################
_DEFAULT_BUILDERLESS_OSES = [os.LINUX_TRUSTY, os.LINUX_XENIAL]
_DEFAULT_BUILDERLESS_OS_CATEGORIES = [os_category.LINUX]
def _sentinel(tag):
......@@ -319,11 +331,11 @@ def builder(
os = _default('os', os)
if os:
dimensions['os'] = os
dimensions['os'] = os.dimension
builderless = _default('builderless', builderless)
if builderless == _COMPUTE:
builderless = os in _DEFAULT_BUILDERLESS_OSES
builderless = os != None and os.category in _DEFAULT_BUILDERLESS_OS_CATEGORIES
if builderless:
dimensions['builderless'] = '1'
......
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