Index: tools/mb/mb.py |
diff --git a/tools/mb/mb.py b/tools/mb/mb.py |
index c3be5d7fdff88df36051b9adacdf8e160055c9c9..36fa8789fe8ad48b96b608ab7bfa4737f62d1466 100755 |
--- a/tools/mb/mb.py |
+++ b/tools/mb/mb.py |
@@ -355,9 +355,37 @@ class MetaBuildWrapper(object): |
# Do some basic sanity checking on the config so that we |
# don't have to do this in every caller. |
assert 'type' in vals, 'No meta-build type specified in the config' |
- assert vals['type'] in ('gn', 'gyp'), ( |
+ assert vals['type'] in ('gn', 'gyp', 'passthrough'), ( |
'Unknown meta-build type "%s"' % vals['gn_args']) |
+ if vals['type'] == 'passthrough': |
+ vals = self.HandlePassthrough() |
+ |
+ return vals |
+ |
+ def HandlePassthrough(self): |
+ if 'MB_TYPE' not in os.environ: |
+ raise MBErr('MB_TYPE not set in the environment') |
+ mb_type = os.environ['MB_TYPE'] |
+ if mb_type not in ('gyp', 'gn'): |
+ raise MBErr('illegal value "%s" for MB_TYPE', mb_type) |
+ |
+ vals = self.DefaultConfigVals() |
+ vals['type'] = mb_type |
+ if mb_type == 'gyp': |
+ if 'GYP_CROSSCOMPILE' in os.environ: |
+ if os.environ['GYP_CROSSCOMPILE'] == '1': |
+ vals['gyp_crosscompile'] = True |
+ if 'GYP_DEFINES' not in os.environ: |
+ raise MBErr('GYP_DEFINES not set in environment on a ' |
+ 'passthrough bot set to type GYP.') |
+ vals['gyp_defines'] = os.environ['GYP_DEFINES'] |
+ else: |
+ if 'gn_args' not in os.environ: |
+ raise MBErr('GN_ARGS not set in environment on a passthrough bot' |
+ ' set to type GN') |
+ vals['gn_args'] = os.environ.get('GN_ARGS', '') |
+ |
return vals |
def ReadConfigFile(self): |
@@ -401,17 +429,19 @@ class MetaBuildWrapper(object): |
def FlattenConfig(self, config): |
mixins = self.configs[config] |
- vals = { |
+ vals = self.DefaultConfigVals() |
+ visited = [] |
+ self.FlattenMixins(mixins, vals, visited) |
+ return vals |
+ |
+ def DefaultConfigVals(self): |
+ return { |
'type': None, |
'gn_args': [], |
'gyp_defines': '', |
'gyp_crosscompile': False, |
} |
- visited = [] |
- self.FlattenMixins(mixins, vals, visited) |
- return vals |
- |
def FlattenMixins(self, mixins, vals, visited): |
for m in mixins: |
if m not in self.mixins: |