# 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 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': {
      # iOS
      'iOS32 Debug': 'ios_gn_debug_static_bot_arm_device',
      'iOS32 Release': 'ios_gn_release_bot_arm_device',
      'iOS64 Debug': 'ios_gn_debug_static_bot_arm64_device',
      'iOS64 Release': 'ios_gn_release_bot_arm64_device',
      'iOS32 Simulator Debug': 'ios_gn_debug_static_bot_x86',
      'iOS64 Simulator Debug': 'ios_gn_debug_static_bot_x64',

      # Mac
      'Mac64 Debug': 'gn_debug_bot_x64',
      'Mac64 Release': 'gn_release_bot_x64',
      'Mac Asan': 'mac_gn_asan_clang_release_bot_x64',
      'Mac64 Release [large tests]': 'gn_release_bot_x64',

      # Linux
      'Linux32 Debug': 'gn_debug_bot_x86',
      'Linux32 Release': 'gn_release_bot_x86',
      'Linux32 ARM': 'gn_release_bot_arm',
      'Linux64 Debug': 'gn_debug_bot_x64',
      'Linux64 Release': 'gn_release_bot_x64',
      'Linux Asan': 'gn_asan_lsan_clang_release_bot_x64',
      'Linux Memcheck': 'gn_release_bot_x64',
      'Linux MSan': 'gn_msan_clang_release_bot_x64',
      'Linux Tsan v2': 'gn_tsan_clang_release_bot_x64',
      'Linux UBSan': 'gn_ubsan_clang_release_bot_x64',
      'Linux UBSan vptr': 'gn_ubsan_vptr_clang_release_bot_x64',
      'Linux64 Release [large tests]': 'gn_release_bot_x64',

      # Android
      'Android32 (M Nexus5X)': 'android_gn_release_bot_arm',
      'Android32 (M Nexus5X)(dbg)': 'android_gn_debug_static_bot_arm',
      'Android64 (M Nexus5X)': 'android_gn_release_bot_arm64',
      'Android64 (M Nexus5X)(dbg)': 'android_gn_debug_static_bot_arm64',
      'Android32 Builder x86': 'android_gn_release_bot_x86',
      'Android32 Builder x86 (dbg)': 'android_gn_debug_static_bot_x86',
      'Android64 Builder x64 (dbg)': 'android_gn_debug_static_bot_x64',
      'Android32 Builder MIPS (dbg)': 'android_gn_clang_debug_static_bot_mipsel',
      'Android32 Clang (dbg)': 'android_gn_clang_debug_bot_arm',

      # Windows
      'Win32 Debug': 'gn_debug_bot_x86',
      'Win32 Release': 'gn_release_bot_x86',
      'Win64 Debug': 'gn_debug_bot_x64',
      'Win64 Release': 'gn_release_bot_x64',
      'Win32 Debug (Clang)': 'win_gn_clang_debug_bot_x86',
      'Win32 Release (Clang)': 'win_gn_clang_release_bot_x86',
      'Win64 Debug (Clang)': 'win_gn_clang_debug_bot_x64',
      'Win64 Release (Clang)': 'win_gn_clang_release_bot_x64',
      'Win SyzyASan': 'win_gn_syzyasan_release_bot_x86',
      'Win32 Release [large tests]': 'gn_release_bot_x86',
    },
    'client.webrtc.perf': {
      # Android
      'Android32 Builder': 'android_gn_release_bot_arm',
      'Android64 Builder': 'android_gn_release_bot_arm64',
      'Android32 Tests (L Nexus5)': 'none',
      'Android32 Tests (L Nexus7.2)': 'none',
      'Android64 Tests (L Nexus9)': 'none',
    },
    'client.webrtc.fyi': {
      # Mac
      'Mac Asan (swarming)': 'mac_gn_asan_clang_release_bot_x64',

      # Linux
      'Linux64 GCC': 'gn_gcc_release_bot_x64',
      'Linux Asan (swarming)': 'gn_asan_lsan_clang_release_bot_x64',
      'Linux Memcheck (swarming)': 'gn_release_bot_x64',
      'Linux MSan (swarming)': 'gn_msan_clang_release_bot_x64',
      'Linux Tsan v2 (swarming)': 'gn_tsan_clang_release_bot_x64',
      'Linux UBSan (swarming)': 'gn_ubsan_clang_release_bot_x64',
      'Linux UBSan vptr (swarming)': 'gn_ubsan_vptr_clang_release_bot_x64',

      # Android
      'Android32 Release (swarming)': 'swarming_android_gn_release_bot_arm',
      'Android32 ASan (L Nexus6)': 'android_gn_asan_shared_release_bot_arm',
      'Android32 Builder': 'android_gn_release_bot_arm',
      'Android32 Tests (J Nexus4)': 'none',
      'Android32 Tests (K Nexus5)': 'none',
      'Android32 Tests (L Nexus6)': 'none',

      # Windows
      'Win64 Debug (swarming)': 'gn_debug_bot_x64',
      'Win64 Debug (Win8)': 'gn_debug_bot_x64',
      'Win64 Debug (Win10)': 'gn_debug_bot_x64',
    },
    'tryserver.webrtc': {
      # iOS
      'ios_dbg': 'ios_gn_debug_static_bot_arm_device',
      'ios_rel': 'ios_gn_release_bot_arm_device',
      'ios_arm64_dbg': 'ios_gn_debug_static_bot_arm64_device',
      'ios_arm64_rel': 'ios_gn_release_bot_arm64_device',
      'ios32_sim_dbg': 'ios_gn_debug_static_bot_x86',
      'ios64_sim_dbg': 'ios_gn_debug_static_bot_x64',

      # Mac
      'mac_compile_dbg': 'gn_debug_bot_x64',
      'mac_compile_rel': 'gn_release_bot_x64',
      'mac_dbg': 'gn_debug_bot_x64',
      'mac_rel': 'gn_release_bot_x64',
      'mac_asan': 'mac_gn_asan_clang_release_bot_x64',
      'mac_baremetal': 'gn_release_bot_x64',
      'mac_swarming': 'swarming_gn_debug_bot_x64',

      # Linux
      'linux_compile_dbg': 'gn_debug_bot_x64',
      'linux_compile_rel': 'gn_release_bot_x64',
      'linux_dbg': 'gn_debug_bot_x64',
      'linux_rel': 'gn_release_bot_x64',
      'linux32_dbg': 'gn_debug_bot_x86',
      'linux32_rel': 'gn_release_bot_x86',
      'linux_arm': 'gn_release_bot_arm',
      'linux_asan': 'gn_asan_lsan_clang_release_bot_x64',
      'linux_memcheck': 'gn_release_bot_x64',
      'linux_msan': 'gn_msan_clang_release_bot_x64',
      'linux_tsan2': 'gn_tsan_clang_release_bot_x64',
      'linux_ubsan': 'gn_ubsan_clang_release_bot_x64',
      'linux_ubsan_vptr': 'gn_ubsan_vptr_clang_release_bot_x64',
      'linux_baremetal': 'gn_release_bot_x64',
      'linux_swarming': 'swarming_gn_debug_bot_x64',

      # Android
      'android_compile_dbg': 'android_gn_debug_static_bot_arm',
      'android_compile_rel': 'android_gn_release_bot_arm',
      'android_compile_arm64_dbg': 'android_gn_debug_static_bot_arm64',
      'android_compile_arm64_rel': 'android_gn_release_bot_arm64',
      'android_compile_x86_dbg': 'android_gn_debug_static_bot_x86',
      'android_compile_x86_rel': 'android_gn_release_bot_x86',
      'android_compile_x64_dbg': 'android_gn_debug_static_bot_x64',
      'android_compile_mips_dbg': 'android_gn_clang_debug_static_bot_mipsel',
      'android_dbg': 'android_gn_debug_static_bot_arm',
      'android_rel': 'android_gn_release_bot_arm',
      'android_clang_dbg': 'android_gn_clang_debug_bot_arm',
      'android_arm64_rel': 'android_gn_release_bot_arm64',
      'android_n6': 'android_gn_debug_static_bot_arm',
      'android_swarming': 'swarming_android_gn_release_bot_arm',

      # Windows
      'win_compile_dbg': 'gn_debug_bot_x86',
      'win_compile_rel': 'gn_release_bot_x86',
      'win_compile_x64_dbg': 'gn_debug_bot_x64',
      'win_compile_x64_rel': 'gn_release_bot_x64',
      'win_dbg': 'gn_debug_bot_x86',
      'win_rel': 'gn_release_bot_x86',
      'win_x64_dbg': 'gn_debug_bot_x64',
      'win_x64_rel': 'gn_release_bot_x64',
      'win_clang_dbg': 'win_gn_clang_debug_bot_x86',
      'win_clang_rel': 'win_gn_clang_release_bot_x86',
      'win_x64_clang_dbg': 'win_gn_clang_debug_bot_x64',
      'win_x64_clang_rel': 'win_gn_clang_release_bot_x64',
      'win_asan': 'win_gn_syzyasan_release_bot_x86',
      'win_baremetal': 'gn_release_bot_x86',
      'win_swarming': 'swarming_gn_debug_bot_x64',
      'win_x64_win8': 'gn_debug_bot_x64',
      'win_x64_win10': 'gn_debug_bot_x64',
    }
  },

  # 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
    'ios_gn_debug_static_bot_arm64_device': [
      'ios', 'gn', 'debug_static_bot', 'arm64', 'device'
    ],
    'ios_gn_release_bot_arm64_device': [
      'ios', 'gn', 'release_bot', 'arm64', 'device'
    ],
    'ios_gn_debug_static_bot_arm_device': [
      'ios', 'gn', 'debug_static_bot', 'arm', 'device'
    ],
    'ios_gn_release_bot_arm_device': [
      'ios', 'gn', 'release_bot', 'arm', 'device'
    ],
    'ios_gn_debug_static_bot_x86': [
      'ios', 'gn', 'debug_static_bot', 'x86'
    ],
    'ios_gn_debug_static_bot_x64': [
      'ios', 'gn', 'debug_static_bot', 'x64'
    ],

    # Linux, Mac and Windows
    'gn_gcc_release_bot_x64': [
      'gn', 'gcc', 'release_bot', 'x64'
    ],
    'gn_release_bot_arm': [
      'gn', 'openh264_release_bot', 'arm'
    ],
    'gn_asan_lsan_clang_release_bot_x64': [
      'gn', 'asan', 'lsan', 'clang', 'openh264_release_bot', 'x64'
    ],
    'gn_msan_clang_release_bot_x64': [
      'gn', 'msan', 'clang', 'openh264_release_bot', 'x64'
    ],
    'gn_tsan_clang_release_bot_x64': [
      'gn', 'tsan', 'clang', 'openh264_release_bot', 'x64'
    ],
    'gn_ubsan_clang_release_bot_x64': [
      'gn', 'ubsan', 'clang', 'openh264_release_bot', 'x64'
    ],
    'gn_ubsan_vptr_clang_release_bot_x64': [
      'gn', 'ubsan_vptr', 'clang', 'openh264_release_bot', 'x64'
    ],
    'gn_debug_bot_x86': [
      'gn', 'openh264_debug_bot', 'x86'
    ],
    'gn_release_bot_x86': [
      'gn', 'openh264_release_bot', 'x86'
    ],
    'gn_debug_bot_x64': [
      'gn', 'openh264_debug_bot', 'x64'
    ],
    'gn_release_bot_x64': [
      'gn', 'openh264_release_bot', 'x64'
    ],
    'swarming_gn_debug_bot_x64': [
      'swarming', 'gn', 'openh264_debug_bot', 'x64'
    ],

    # Windows
    'win_gn_clang_debug_bot_x86': [
      'gn', 'clang', 'openh264_debug_bot', 'x86',
    ],
    'win_gn_clang_release_bot_x86': [
      'gn', 'clang', 'openh264_release_bot', 'x86',
    ],
    'win_gn_clang_debug_bot_x64': [
      'gn', 'clang', 'openh264_debug_bot', 'x64',
    ],
    'win_gn_clang_release_bot_x64': [
      'gn', 'clang', 'openh264_release_bot', 'x64',
    ],
    'win_gn_syzyasan_release_bot_x86': [
      'gn', 'syzyasan', 'minimal_symbols', 'openh264_release_bot', 'x86',
    ],

    # Mac
    'mac_gn_asan_clang_release_bot_x64': [
      'gn', 'asan', 'clang', 'openh264_release_bot', 'x64',
    ],

    # Android
    'android_gn_debug_static_bot_arm': [
      'android', 'gn', 'debug_static_bot', 'arm'
    ],
    'android_gn_release_bot_arm': [
      'android', 'gn', 'release_bot', 'arm'
    ],
    'android_gn_debug_static_bot_x86': [
      'android', 'gn', 'debug_static_bot', 'x86'
    ],
    'android_gn_release_bot_x86': [
      'android', 'gn', 'release_bot', 'x86'
    ],
    'android_gn_clang_debug_bot_arm': [
      'android', 'gn', 'clang', 'debug_bot', 'arm'
    ],
    'android_gn_clang_debug_static_bot_mipsel': [
      'android', 'gn', 'clang', 'debug_static_bot', 'mipsel'
    ],
    'android_gn_debug_static_bot_arm64': [
      'android', 'gn', 'debug_static_bot', 'arm64'
    ],
    'android_gn_release_bot_arm64': [
      'android', 'gn', 'release_bot', 'arm64'
    ],
    'android_gn_debug_static_bot_x64': [
      'android', 'gn', 'debug_static_bot', 'x64'
    ],
    'android_gn_asan_shared_release_bot_arm': [
      'android', 'gn', 'asan', 'clang', 'shared', 'release_bot', 'arm'
    ],
    'swarming_android_gn_release_bot_arm': [
      'swarming', 'android', 'gn', 'release_bot', 'arm'
    ],

    # This is used for tracking purposes; any bot that uses this config
    # should never actually run MB.
    'none': [
      'error',
    ],
  },

  # 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': {
    'android': {
      'gn_args': 'target_os="android"',
    },

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

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

    'asan': {
      'gn_args': 'is_asan=true',
    },

    'clang': {
      'gn_args': 'is_clang=true',
    },

    'dcheck_always_on': {
      'gn_args': 'dcheck_always_on=true',
    },

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

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

    'debug_static_bot': {
      'mixins': ['debug', 'static', 'minimal_symbols', 'goma'],
    },

    'device': {
      'gn_args': 'ios_enable_code_signing=false',
    },

    # This mixin is used to force configs that use it to fail. It
    # is used in two cases: when we have bots that we haven't looked
    # at yet and don't know whether they need MB or not, and for bots
    # that are test-only and should never run MB.
    'error': {
      'gn_args': 'error',
    },

    'gcc': {
      'gn_args': 'is_clang=false use_sysroot=false',
      'gyp_defines': 'clang=0',
    },

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

    'goma': {
      'gn_args': 'use_goma=true',
    },

    'ios': {
      'gn_args': 'target_os="ios"',
      'gyp_defines': 'OS=ios',
    },

    'lsan': {
      'gn_args': 'is_lsan=true',
    },

    'minimal_symbols': {
      'gn_args': 'symbol_level=1',
    },

    'mipsel': {
      'gn_args': 'target_cpu="mipsel"',
    },

    'minimal_symbols': {
      'gn_args': 'symbol_level=1',
    },

    'msan': {
      'gn_args': ('is_msan=true msan_track_origins=2 '
                  'use_prebuilt_instrumented_libraries=true'),
    },

    'openh264': {
      'gn_args': 'ffmpeg_branding="Chrome" rtc_use_h264=true',
    },

    'openh264_debug_bot': {
      'mixins': ['openh264', 'debug_bot'],
    },

    'openh264_release_bot': {
      'mixins': ['openh264', 'release_bot'],
    },

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

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

    'shared': {
      'gn_args': 'is_component_build=true',
    },

    'static': {
      'gn_args': 'is_component_build=false',
    },

    'swarming': {
      'gn_args': '',
    },

    'syzyasan': {
      'gn_args': 'is_syzyasan=true',
    },

    'tsan': {
      'gn_args': 'is_tsan=true',
    },

    'ubsan': {
      'gn_args': 'is_ubsan=true',
    },

    'ubsan_vptr': {
      'gn_args': 'is_ubsan_vptr=true',
    },

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

    'x86': {
      'gn_args': 'target_cpu="x86"',
    },
  },
}
