Move tools/mb -> tools-webrtc/mb
In addition to moving tools/mb -> tools-webrtc/mb, also
move webrtc/build/mb_config.pyl into tools-webrtc/mb
to match the default location better.
Remove Chromium-specific check for 'mb validate' that failed
due to doing this (we never cleaned that when we forked the code).
BUG=webrtc:5006
TBR=ehmaldonado@webrtc.org
NOTRY=True
TESTED=Manually ran:
tools-webrtc/mb/mb.py gen -m client.webrtc -b 'iOS64 Release' --config-file tools-webrtc/mb/mb_config.pyl //out/Release-iphoneos
tools-webrtc/mb/mb.py gen -m client.webrtc -b 'Mac64 Release' --config-file tools-webrtc/mb/mb_config.pyl //out/Release-mac
Review-Url: https://codereview.webrtc.org/2585743002 .
Cr-Commit-Position: refs/heads/master@{#15664}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 46d1601..6926dd5 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -459,6 +459,7 @@
r'^tools[\\\/]valgrind[\\\/].*\.py$',
r'^tools[\\\/]win[\\\/].*\.py$',
# TODO(phoglund): should arguably be checked.
+ r'^tools-webrtc[\\\/]mb[\\\/].*\.py$',
r'^tools-webrtc[\\\/]valgrind[\\\/].*\.py$',
r'^xcodebuild.*[\\\/].*\.py$',),
disabled_warnings=['F0401', # Failed to import x
diff --git a/tools/mb/OWNERS b/tools-webrtc/mb/OWNERS
similarity index 100%
rename from tools/mb/OWNERS
rename to tools-webrtc/mb/OWNERS
diff --git a/tools/mb/PRESUBMIT.py b/tools-webrtc/mb/PRESUBMIT.py
similarity index 82%
rename from tools/mb/PRESUBMIT.py
rename to tools-webrtc/mb/PRESUBMIT.py
index a520ff9..d21aec1 100644
--- a/tools/mb/PRESUBMIT.py
+++ b/tools-webrtc/mb/PRESUBMIT.py
@@ -19,11 +19,7 @@
input_api, output_api, '.', [ r'^.+_unittest\.py$']))
# Validate the format of the mb_config.pyl file.
- mb_config_path = input_api.os_path.join(input_api.PresubmitLocalPath(),
- '..', '..', 'webrtc', 'build',
- 'mb_config.pyl')
- cmd = [input_api.python_executable, 'mb.py', 'validate', '--config-file',
- mb_config_path]
+ cmd = [input_api.python_executable, 'mb.py', 'validate']
kwargs = {'cwd': input_api.PresubmitLocalPath()}
results.extend(input_api.RunTests([
input_api.Command(name='mb_validate',
diff --git a/tools/mb/README.md b/tools-webrtc/mb/README.md
similarity index 100%
rename from tools/mb/README.md
rename to tools-webrtc/mb/README.md
diff --git a/tools/mb/docs/README.md b/tools-webrtc/mb/docs/README.md
similarity index 100%
rename from tools/mb/docs/README.md
rename to tools-webrtc/mb/docs/README.md
diff --git a/tools/mb/docs/design_spec.md b/tools-webrtc/mb/docs/design_spec.md
similarity index 100%
rename from tools/mb/docs/design_spec.md
rename to tools-webrtc/mb/docs/design_spec.md
diff --git a/tools/mb/docs/user_guide.md b/tools-webrtc/mb/docs/user_guide.md
similarity index 100%
rename from tools/mb/docs/user_guide.md
rename to tools-webrtc/mb/docs/user_guide.md
diff --git a/tools/mb/mb b/tools-webrtc/mb/mb
similarity index 100%
rename from tools/mb/mb
rename to tools-webrtc/mb/mb
diff --git a/tools/mb/mb.bat b/tools-webrtc/mb/mb.bat
similarity index 100%
rename from tools/mb/mb.bat
rename to tools-webrtc/mb/mb.bat
diff --git a/tools/mb/mb.py b/tools-webrtc/mb/mb.py
similarity index 97%
rename from tools/mb/mb.py
rename to tools-webrtc/mb/mb.py
index 0b4f85e..77a81e0 100755
--- a/tools/mb/mb.py
+++ b/tools-webrtc/mb/mb.py
@@ -32,8 +32,8 @@
from collections import OrderedDict
-CHROMIUM_SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(
- os.path.abspath(__file__))))
+SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
+CHROMIUM_SRC_DIR = os.path.dirname(os.path.dirname(SCRIPT_DIR))
sys.path = [os.path.join(CHROMIUM_SRC_DIR, 'build')] + sys.path
import gn_helpers
@@ -47,8 +47,7 @@
class MetaBuildWrapper(object):
def __init__(self):
self.chromium_src_dir = CHROMIUM_SRC_DIR
- self.default_config = os.path.join(self.chromium_src_dir, 'tools', 'mb',
- 'mb_config.pyl')
+ self.default_config = os.path.join(SCRIPT_DIR, 'mb_config.pyl')
self.default_isolate_map = os.path.join(self.chromium_src_dir, 'testing',
'buildbot', 'gn_isolate_map.pyl')
self.executable = sys.executable
@@ -421,29 +420,6 @@
if not mixin in referenced_mixins:
errs.append('Unreferenced mixin "%s".' % mixin)
- # If we're checking the Chromium config, check that the 'chromium' bots
- # which build public artifacts do not include the chrome_with_codecs mixin.
- if self.args.config_file == self.default_config:
- if 'chromium' in self.masters:
- for builder in self.masters['chromium']:
- config = self.masters['chromium'][builder]
- def RecurseMixins(current_mixin):
- if current_mixin == 'chrome_with_codecs':
- errs.append('Public artifact builder "%s" can not contain the '
- '"chrome_with_codecs" mixin.' % builder)
- return
- if not 'mixins' in self.mixins[current_mixin]:
- return
- for mixin in self.mixins[current_mixin]['mixins']:
- RecurseMixins(mixin)
-
- for mixin in self.configs[config]:
- RecurseMixins(mixin)
- else:
- errs.append('Missing "chromium" master. Please update this '
- 'proprietary codecs check with the name of the master '
- 'responsible for public build artifacts.')
-
if errs:
raise MBErr(('mb config file %s has problems:' % self.args.config_file) +
'\n ' + '\n '.join(errs))
diff --git a/webrtc/build/mb_config.pyl b/tools-webrtc/mb/mb_config.pyl
similarity index 100%
rename from webrtc/build/mb_config.pyl
rename to tools-webrtc/mb/mb_config.pyl
diff --git a/tools/mb/mb_unittest.py b/tools-webrtc/mb/mb_unittest.py
similarity index 94%
rename from tools/mb/mb_unittest.py
rename to tools-webrtc/mb/mb_unittest.py
index fc69828..3f9a6c9 100755
--- a/tools/mb/mb_unittest.py
+++ b/tools-webrtc/mb/mb_unittest.py
@@ -26,7 +26,7 @@
# Override vars for test portability.
if win32:
self.chromium_src_dir = 'c:\\fake_src'
- self.default_config = 'c:\\fake_src\\tools\\mb\\mb_config.pyl'
+ self.default_config = 'c:\\fake_src\\tools-webrtc\\mb\\mb_config.pyl'
self.default_isolate_map = ('c:\\fake_src\\testing\\buildbot\\'
'gn_isolate_map.pyl')
self.platform = 'win32'
@@ -34,7 +34,7 @@
self.sep = '\\'
else:
self.chromium_src_dir = '/fake_src'
- self.default_config = '/fake_src/tools/mb/mb_config.pyl'
+ self.default_config = '/fake_src/tools-webrtc/mb/mb_config.pyl'
self.default_isolate_map = '/fake_src/testing/buildbot/gn_isolate_map.pyl'
self.executable = '/usr/bin/python'
self.platform = 'linux2'
@@ -176,35 +176,6 @@
}
"""
-
-TEST_BAD_CONFIG = """\
-{
- 'configs': {
- 'gn_rel_bot_1': ['gn', 'rel', 'chrome_with_codecs'],
- 'gn_rel_bot_2': ['gn', 'rel', 'bad_nested_config'],
- },
- 'masters': {
- 'chromium': {
- 'a': 'gn_rel_bot_1',
- 'b': 'gn_rel_bot_2',
- },
- },
- 'mixins': {
- 'gn': {'type': 'gn'},
- 'chrome_with_codecs': {
- 'gn_args': 'proprietary_codecs=true',
- },
- 'bad_nested_config': {
- 'mixins': ['chrome_with_codecs'],
- },
- 'rel': {
- 'gn_args': 'is_debug=false',
- },
- },
-}
-"""
-
-
GYP_HACKS_CONFIG = """\
{
'masters': {
@@ -798,34 +769,6 @@
mbw = self.fake_mbw()
self.check(['validate'], mbw=mbw, ret=0)
- def test_bad_validate(self):
- mbw = self.fake_mbw()
- mbw.files[mbw.default_config] = TEST_BAD_CONFIG
- self.check(['validate'], mbw=mbw, ret=1)
-
- def test_gyp_env_hacks(self):
- mbw = self.fake_mbw()
- mbw.files[mbw.default_config] = GYP_HACKS_CONFIG
- self.check(['lookup', '-c', 'fake_config'], mbw=mbw,
- ret=0,
- out=("GYP_DEFINES='foo=bar baz=1'\n"
- "GYP_LINK_CONCURRENCY=1\n"
- "LLVM_FORCE_HEAD_REVISION=1\n"
- "python build/gyp_chromium -G output_dir=_path_\n"))
-
-
-if __name__ == '__main__':
- unittest.main()
-
- def test_validate(self):
- mbw = self.fake_mbw()
- self.check(['validate'], mbw=mbw, ret=0)
-
- def test_bad_validate(self):
- mbw = self.fake_mbw()
- mbw.files[mbw.default_config] = TEST_BAD_CONFIG
- self.check(['validate'], mbw=mbw, ret=1)
-
def test_gyp_env_hacks(self):
mbw = self.fake_mbw()
mbw.files[mbw.default_config] = GYP_HACKS_CONFIG
diff --git a/webrtc/build/PRESUBMIT.py b/webrtc/build/PRESUBMIT.py
deleted file mode 100644
index d364f86..0000000
--- a/webrtc/build/PRESUBMIT.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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)