# Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS.  All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.

# FOR DETAILS ON THIS FILE SEE THE MAIN COPY IN //tools/mb/mb_config.pyl.
# This is configuration for standalone WebRTC bots. It is used to keep the bot
# configurations source-side instead of in the buildbot scripts. That makes it
# easy to try different configurations of GYP and GN in tryjob patches.

{
  # This is the list of configs that you can pass to mb; each config
  # represents a particular combination of GYP_DEFINES/gn args that
  # we must support. A given config *may* be platform-specific but
  # is not necessarily so (i.e., we might have mac, win, and linux
  # bots all using the 'gn_release_bot' config).
  'configs': {
    'ios_gn_debug_bot_arm64_device': ['ios', 'gn', 'debug_bot', 'arm64', 'device'],
    'ios_gn_release_bot_arm64_device': ['ios', 'gn', 'release_bot', 'arm64', 'device'],
    'ios_gyp_debug_bot_arm_device': ['ios', 'gyp', 'debug_bot', 'arm', 'device'],
    'ios_gyp_release_bot_arm_device': ['ios', 'gyp', 'release_bot', 'arm', 'device'],
    'ios_gyp_debug_bot_arm64_device': ['ios', 'gyp', 'debug_bot', 'arm64', 'device'],
    'ios_gyp_release_bot_arm64_device': ['ios', 'gyp', 'release_bot', 'arm64', 'device'],
    'ios_gyp_debug_bot_x86': ['ios', 'gyp', 'debug_bot', 'x86'],
    'ios_gyp_debug_bot_x64': ['ios', 'gyp', 'release_bot', 'x64'],
  },

  # This is a dict mapping a given 'mixin' name to a dict of settings that
  # mb should use. See //tools/mb/docs/user_guide.md for more information.
  'mixins': {
    'ios': {
      'gn_args': 'target_os="ios"',
      'gyp_defines': 'OS=ios',
    },

    'arm': {
      'gn_args': 'target_cpu="arm"',
      'gyp_defines': 'target_arch=arm',
    },

    'arm64': {
      'gn_args': 'target_cpu="arm64"',
      'gyp_defines': 'target_arch=arm64',
    },

    'debug': {
      'gn_args': 'is_debug=true',
    },

    'debug_bot': {
      'mixins': ['debug', 'shared'],
    },

    'device': {
      'gn_args': 'ios_enable_code_signing=false',
      'gyp_defines': 'chromium_ios_signing=0',
    },

    'gn': {'type': 'gn'},

    'gyp': {'type': 'gyp'},

    'release': {
      'gn_args': 'is_debug=false',
    },

    'release_bot': {
      'mixins': ['release', 'static'],
    },

    'shared': {
      'gn_args': 'is_component_build=true',
      'gyp_defines': 'component=shared_library',
    },

    'static': {
      'gn_args': 'is_component_build=false',
      'gyp_defines': 'component=static_library',
    },

    'x64': {
      'gn_args': 'target_cpu="x64"',
      'gyp_defines': 'target_arch=x64',
    },

    'x86': {
      'gn_args': 'target_cpu="x86"',
      'gyp_defines': 'target_arch=ia32',
    },
  },

  # This is a map of buildbot master names -> buildbot builder names ->
  # config names (where each config name is a key in the 'configs' dict,
  # above). mb uses this dict to look up which config to use for a given bot.
  # The builders should be sorted by the order they appear in the /builders
  # page on the buildbots, *not* alphabetically.
  'masters': {
    'client.webrtc': {
      'iOS32 Debug': 'ios_gyp_debug_bot_arm_device',
      'iOS32 Release': 'ios_gyp_release_bot_arm_device',
      'iOS64 Debug': 'ios_gyp_debug_bot_arm64_device',
      'iOS64 Release': 'ios_gyp_release_bot_arm64_device',
      'iOS32 Debug Simulator': 'ios_gyp_debug_bot_x86',
      'iOS64 Debug Simulator': 'ios_gyp_debug_bot_x64',
      'iOS64 Debug (GN)': 'ios_gn_debug_bot_arm64_device',
      'iOS64 Release (GN)': 'ios_gn_release_bot_arm64_device',
    },
    'tryserver.webrtc': {
      'ios_dbg': 'ios_gyp_debug_bot_arm_device',
      'ios_rel': 'ios_gyp_release_bot_arm_device',
      'ios_arm64_dbg': 'ios_gyp_debug_bot_arm64_device',
      'ios_arm64_rel': 'ios_gyp_release_bot_arm64_device',
      'ios32_sim_dbg': 'ios_gyp_debug_bot_x86',
      'ios64_sim_dbg': 'ios_gyp_debug_bot_x64',
      'ios64_gn_dbg': 'ios_gn_debug_bot_arm64_device',
      'ios64_gn_rel': 'ios_gn_release_bot_arm64_device',
    },
  },
}