diff --git a/webrtc/build/PRESUBMIT.py b/webrtc/build/PRESUBMIT.py new file mode 100644 index 0000000000..d364f862f2 --- /dev/null +++ b/webrtc/build/PRESUBMIT.py @@ -0,0 +1,34 @@ +# 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. + + +def _CommonChecks(input_api, output_api): + results = [] + + # Validate the format of the mb_config.pyl file. + mb_script = input_api.os_path.join(input_api.PresubmitLocalPath(), '..', + '..', 'tools', 'mb', 'mb.py') + mb_config_path = input_api.os_path.join(input_api.PresubmitLocalPath(), + 'mb_config.pyl') + cmd = [input_api.python_executable, mb_script, 'validate', '--config-file', + mb_config_path] + kwargs = {'cwd': input_api.PresubmitLocalPath()} + results.extend(input_api.RunTests([ + input_api.Command(name='mb_validate', + cmd=cmd, kwargs=kwargs, + message=output_api.PresubmitError)])) + + return results + + +def CheckChangeOnUpload(input_api, output_api): + return _CommonChecks(input_api, output_api) + + +def CheckChangeOnCommit(input_api, output_api): + return _CommonChecks(input_api, output_api) diff --git a/webrtc/build/mb_config.pyl b/webrtc/build/mb_config.pyl new file mode 100644 index 0000000000..6e352abcb6 --- /dev/null +++ b/webrtc/build/mb_config.pyl @@ -0,0 +1,137 @@ +# 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', 'goma'], + }, + + 'device': { + 'gn': 'ios_enable_code_signing=false', + 'gyp_defines': 'chromium_ios_signing=0', + }, + + 'gn': {'type': 'gn'}, + + 'goma': { + # The MB code will properly escape goma_dir if necessary in the GYP + # code path; the GN code path needs no escaping. + 'gn_args': 'use_goma=true goma_dir="$(goma_dir)"', + 'gyp_defines': 'use_goma=1 gomadir=$(goma_dir)', + }, + + 'gyp': {'type': 'gyp'}, + + 'release': { + 'gn_args': 'is_debug=false', + }, + + 'release_bot': { + 'mixins': ['release', 'static', 'goma'], + }, + + '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', + }, + 'client.webrtc.fyi': { + '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', + }, + }, + + # These lists are assumed to exist so we need them in order to be able to run + # the mb.py script in PRESUBMIT.py to verify our config is sane. + 'common_dev_configs': [], + 'private_configs': [], + 'unsupported_configs': [], +}