Skip to content

Commit

Permalink
Make MB aware of iOS bot configs and get iOS working.
Browse files Browse the repository at this point in the history
With these changes, the ios trybots should start working.

Part of this change makes MB aware of the bot config files
in //ios/build/bots, so that we don't have to configure
the iOS bots in two different places.

See the updated MB docs for details.

R=smut@google.com, sdefresne@chromium.org, stuartmorgan@chromium.org
BUG=517216

Review URL: https://codereview.chromium.org/1411183010

Cr-Commit-Position: refs/heads/master@{#360688}
  • Loading branch information
dpranke authored and Commit bot committed Nov 19, 2015
1 parent 1cec15c commit e0f486f
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 12 deletions.
25 changes: 25 additions & 0 deletions ios/build/bots/chromium.mac/iOS_Device_GN.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"owners": [
"dpranke",
"smut"
],
"comments": [
"GN + Ninja fat binary builder."
],
"xcode version": "7.0",
"GYP_DEFINES": {
"chromium_ios_signing": "0",
"target_subarch": "both"
},
"gn_args": [
"ios_enable_code_signing=false",
"target_cpu=\"arm\"",
"target_os=\"ios\""
],
"mb_type": "gn",
"compiler": "ninja",
"configuration": "Release",
"sdk": "iphoneos9.0",
"tests": [
]
}
23 changes: 23 additions & 0 deletions ios/build/bots/chromium.mac/iOS_Simulator_GN_(dbg).json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"owners": [
"dpranke",
"smut"
],
"comments": [
"GN + Ninja simulator build."
],
"xcode version": "7.0",
"GYP_DEFINES": {
"chromium_ios_signing": "0",
"target_subarch": "both"
},
"gn_args": [
"target_os=\"ios\""
],
"mb_type": "gn",
"compiler": "ninja",
"configuration": "Debug",
"sdk": "iphonesimulator9.0",
"tests": [
]
}
23 changes: 23 additions & 0 deletions ios/build/bots/tryserver.chromium.mac/ios_dbg_simulator_gn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"owners": [
"dpranke",
"smut"
],
"comments": [
"GN + Ninja simulator build."
],
"xcode version": "7.0",
"GYP_DEFINES": {
"chromium_ios_signing": "0",
"target_subarch": "both"
},
"gn_args": [
"target_os=\"ios\""
],
"mb_type": "gn",
"compiler": "ninja",
"configuration": "Debug",
"sdk": "iphonesimulator9.0",
"tests": [
]
}
25 changes: 25 additions & 0 deletions ios/build/bots/tryserver.chromium.mac/ios_rel_device_gn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"owners": [
"dpranke",
"smut"
],
"comments": [
"GN + Ninja fat binary builder."
],
"xcode version": "7.0",
"GYP_DEFINES": {
"chromium_ios_signing": "0",
"target_subarch": "both"
},
"gn_args": [
"ios_enable_code_signing=false",
"target_cpu=\"arm\"",
"target_os=\"ios\""
],
"mb_type": "gn",
"compiler": "ninja",
"configuration": "Release",
"sdk": "iphoneos9.0",
"tests": [
]
}
15 changes: 12 additions & 3 deletions tools/mb/docs/design_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,18 @@ It is structured as a single binary that supports a list of subcommands:

### Configurations

`mb` looks in the `//tools/mb/mb_config.pyl` config file to determine whether
to use GYP or GN for a particular build directory, and what set of flags
(`GYP_DEFINES` or `gn args`) to use.
`mb` will first look for a bot config file in a set of different locations
(initially just in //ios/build/bots). Bot config files are JSON files that
contain keys for 'GYP_DEFINES' (a list of strings that will be joined together
with spaces and passed to GYP, or a dict that will be similarly converted),
'gn_args' (a list of strings that will be joined together), and an
'mb_type' field that says whether to use GN or GYP. Bot config files
require the full list of settings to be given explicitly.

If no mathcing bot config file is found, `mb` looks in the
`//tools/mb/mb_config.pyl` config file to determine whether to use GYP or GN
for a particular build directory, and what set of flags (`GYP_DEFINES` or `gn
args`) to use.

A config can either be specified directly (useful for testing) or by specifying
the master name and builder name (useful on the bots so that they do not need
Expand Down
8 changes: 5 additions & 3 deletions tools/mb/docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ a directory, then runs GYP or GN as appropriate:
Either the `-c/--config` flag or the `-m/--master` and `-b/--builder` flags
must be specified so that `mb` can figure out which config to use.

By default, MB will look in `//tools/mb/mb_config.pyl` to look up the config
information, but you can specify a custom config file using the
`-f/--config-file` flag.
By default, MB will look for a bot config file under `//ios/build/bots` (see
[design_spec.md](the design spec) for details of how the bot config files
work). If no matching one is found, will then look in
`//tools/mb/mb_config.pyl` to look up the config information, but you can
specify a custom config file using the `-f/--config-file` flag.

The path must be a GN-style "source-absolute" path (as above).

Expand Down
36 changes: 30 additions & 6 deletions tools/mb/mb.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,15 @@ def GNValsFromDir(self, build_dir):
}

def Lookup(self):
self.ReadConfigFile()
config = self.ConfigFromArgs()
if not config in self.configs:
raise MBErr('Config "%s" not found in %s' %
(config, self.args.config_file))
vals = self.ReadBotConfig()
if not vals:
self.ReadConfigFile()
config = self.ConfigFromArgs()
if not config in self.configs:
raise MBErr('Config "%s" not found in %s' %
(config, self.args.config_file))

vals = self.FlattenConfig(config)
vals = self.FlattenConfig(config)

# Do some basic sanity checking on the config so that we
# don't have to do this in every caller.
Expand All @@ -360,6 +362,28 @@ def Lookup(self):

return vals

def ReadBotConfig(self):
if not self.args.master or not self.args.builder:
return {}
path = self.PathJoin(self.chromium_src_dir, 'ios', 'build', 'bots',
self.args.master, self.args.builder + '.json')
if not self.Exists(path):
return {}

contents = json.loads(self.ReadFile(path))
gyp_vals = contents.get('GYP_DEFINES', {})
if isinstance(gyp_vals, dict):
gyp_defines = ' '.join('%s=%s' % (k, v) for k, v in gyp_vals.items())
else:
gyp_defines = ' '.join(gyp_vals)
gn_args = ' '.join(contents.get('gn_args', []))

return {
'type': contents.get('mb_type', ''),
'gn_args': gn_args,
'gyp_defines': gyp_defines,
}

def ReadConfigFile(self):
if not self.Exists(self.args.config_file):
raise MBErr('config file not found at %s' % self.args.config_file)
Expand Down

0 comments on commit e0f486f

Please sign in to comment.