summaryrefslogtreecommitdiff
path: root/build/util
diff options
context:
space:
mode:
Diffstat (limited to 'build/util')
-rw-r--r--build/util/LASTCHANGE4
-rw-r--r--build/util/LASTCHANGE.committime2
-rwxr-xr-xbuild/util/action_remote.py34
-rwxr-xr-xbuild/util/android_chrome_version.py13
-rw-r--r--build/util/android_chrome_version_test.py38
-rw-r--r--build/util/generate_wrapper.gni61
-rwxr-xr-xbuild/util/java_action.py2
-rwxr-xr-xbuild/util/lastchange.py3
-rw-r--r--build/util/lib/common/perf_tests_results_helper.py1
-rwxr-xr-xbuild/util/lib/common/unittest_util_test.py2
-rw-r--r--build/util/lib/results/DIR_METADATA11
-rw-r--r--build/util/lib/results/result_sink.py7
-rwxr-xr-xbuild/util/lib/results/result_sink_test.py18
-rwxr-xr-xbuild/util/version.py1
14 files changed, 134 insertions, 63 deletions
diff --git a/build/util/LASTCHANGE b/build/util/LASTCHANGE
index 524ffa034..564068ddb 100644
--- a/build/util/LASTCHANGE
+++ b/build/util/LASTCHANGE
@@ -1,2 +1,2 @@
-LASTCHANGE=7946990e1bb93eade39cc6383d2ff19939f9f4fb-refs/branch-heads/5481_123@{#5}
-LASTCHANGE_YEAR=2023
+LASTCHANGE=0
+LASTCHANGE_YEAR=1970
diff --git a/build/util/LASTCHANGE.committime b/build/util/LASTCHANGE.committime
index 8a7eac9b3..c22708346 100644
--- a/build/util/LASTCHANGE.committime
+++ b/build/util/LASTCHANGE.committime
@@ -1 +1 @@
-1677005917 \ No newline at end of file
+0 \ No newline at end of file
diff --git a/build/util/action_remote.py b/build/util/action_remote.py
index 1e9517ddf..ea2e13244 100755
--- a/build/util/action_remote.py
+++ b/build/util/action_remote.py
@@ -14,6 +14,10 @@ import subprocess
import sys
from enum import Enum
+_THIS_DIR = os.path.realpath(os.path.dirname(__file__))
+_SRC_DIR = os.path.dirname(os.path.dirname(_THIS_DIR))
+_MOJOM_DIR = os.path.join(_SRC_DIR, 'mojo', 'public', 'tools', 'mojom')
+
class CustomProcessor(Enum):
mojom_parser = 'mojom_parser'
@@ -22,16 +26,20 @@ class CustomProcessor(Enum):
return self.value
-def _process_build_metadata_json(bm_file, exec_root, working_dir, output_root,
- re_outputs, processed_inputs):
+def _process_build_metadata_json(bm_file, input_roots, output_root, re_outputs,
+ processed_inputs):
"""Recursively find mojom_parser inputs from a build_metadata file."""
+ # Import Mojo-specific dep here so non-Mojo remote actions don't need it.
+ if _MOJOM_DIR not in sys.path:
+ sys.path.insert(0, _MOJOM_DIR)
+ from mojom_parser import RebaseAbsolutePath
+
if bm_file in processed_inputs:
return
processed_inputs.add(bm_file)
bm_dir = os.path.dirname(bm_file)
- wd_rel = os.path.relpath(working_dir, exec_root)
with open(bm_file) as f:
bm = json.load(f)
@@ -41,8 +49,9 @@ def _process_build_metadata_json(bm_file, exec_root, working_dir, output_root,
src = os.path.normpath(os.path.join(bm_dir, s))
if src not in processed_inputs and os.path.exists(src):
processed_inputs.add(src)
- src_module = os.path.normpath(
- os.path.join(output_root, os.path.join(wd_rel, src + "-module")))
+ src_module = os.path.join(
+ output_root,
+ RebaseAbsolutePath(os.path.abspath(src), input_roots) + "-module")
if src_module in re_outputs:
continue
if src_module not in processed_inputs and os.path.exists(src_module):
@@ -51,8 +60,8 @@ def _process_build_metadata_json(bm_file, exec_root, working_dir, output_root,
# Recurse into build_metadata deps.
for d in bm["deps"]:
dep = os.path.normpath(os.path.join(bm_dir, d))
- _process_build_metadata_json(dep, exec_root, working_dir, output_root,
- re_outputs, processed_inputs)
+ _process_build_metadata_json(dep, input_roots, output_root, re_outputs,
+ processed_inputs)
def _get_mojom_parser_inputs(exec_root, output_files, extra_args):
@@ -67,12 +76,17 @@ def _get_mojom_parser_inputs(exec_root, output_files, extra_args):
argparser = argparse.ArgumentParser()
argparser.add_argument('--check-imports', dest='check_imports', required=True)
argparser.add_argument('--output-root', dest='output_root', required=True)
+ argparser.add_argument('--input-root',
+ default=[],
+ action='append',
+ dest='input_root_paths')
mojom_parser_args, _ = argparser.parse_known_args(args=extra_args)
+ input_roots = list(map(os.path.abspath, mojom_parser_args.input_root_paths))
+ output_root = os.path.abspath(mojom_parser_args.output_root)
processed_inputs = set()
- _process_build_metadata_json(mojom_parser_args.check_imports, exec_root,
- os.getcwd(), mojom_parser_args.output_root,
- output_files, processed_inputs)
+ _process_build_metadata_json(mojom_parser_args.check_imports, input_roots,
+ output_root, output_files, processed_inputs)
# Rebase paths onto rewrapper exec root.
return map(lambda dep: os.path.normpath(os.path.relpath(dep, exec_root)),
diff --git a/build/util/android_chrome_version.py b/build/util/android_chrome_version.py
index 910e304ba..876f48546 100755
--- a/build/util/android_chrome_version.py
+++ b/build/util/android_chrome_version.py
@@ -55,6 +55,7 @@ _PACKAGE_NAMES = {
'MONOCHROME': 20,
'TRICHROME': 30,
'TRICHROME_BETA': 40,
+ 'TRICHROME_AUTO': 50,
'WEBVIEW_STABLE': 0,
'WEBVIEW_BETA': 10,
'WEBVIEW_DEV': 20,
@@ -101,14 +102,18 @@ _APKS = {
('TRICHROME_32', 'TRICHROME', '32'),
('TRICHROME_32_64', 'TRICHROME', '32_64'),
('TRICHROME_64_32', 'TRICHROME', '64_32'),
+ ('TRICHROME_64_32_HIGH', 'TRICHROME', '64_32_high'),
('TRICHROME_64', 'TRICHROME', '64'),
- ('TRICHROME_64_HIGH', 'TRICHROME', '64_high'),
+ ('TRICHROME_64_HIGH', 'TRICHROME', '64_32_high'), # Deprecated.
+ ('TRICHROME_AUTO_64_32', 'TRICHROME_AUTO', '64_32'),
('TRICHROME_BETA', 'TRICHROME_BETA', '32_64'),
('TRICHROME_32_BETA', 'TRICHROME_BETA', '32'),
('TRICHROME_32_64_BETA', 'TRICHROME_BETA', '32_64'),
('TRICHROME_64_32_BETA', 'TRICHROME_BETA', '64_32'),
+ ('TRICHROME_64_32_HIGH_BETA', 'TRICHROME_BETA', '64_32_high'),
('TRICHROME_64_BETA', 'TRICHROME_BETA', '64'),
- ('TRICHROME_64_HIGH_BETA', 'TRICHROME_BETA', '64_high'),
+ # Deprecated
+ ('TRICHROME_64_HIGH_BETA', 'TRICHROME_BETA', '64_32_high'),
('WEBVIEW_STABLE', 'WEBVIEW_STABLE', '32_64'),
('WEBVIEW_BETA', 'WEBVIEW_BETA', '32_64'),
('WEBVIEW_DEV', 'WEBVIEW_DEV', '32_64'),
@@ -176,7 +181,7 @@ _ABIS_TO_DIGIT_MASK = {
'32_64': 3,
'64_32': 4,
'64': 5,
- '64_high': 9,
+ '64_32_high': 9,
},
'intel': {
'32': 1,
@@ -291,7 +296,7 @@ def GenerateVersionCodes(version_values, arch, is_next_build):
version_codes = {}
for apk, package, abis in _APKS[bitness]:
- if abis == '64_high' and arch != 'arm64':
+ if abis == '64_32_high' and arch != 'arm64':
continue
abi_part = _ABIS_TO_DIGIT_MASK[mfg][abis]
package_part = _PACKAGE_NAMES[package]
diff --git a/build/util/android_chrome_version_test.py b/build/util/android_chrome_version_test.py
index 496b8cfbe..f1f750530 100644
--- a/build/util/android_chrome_version_test.py
+++ b/build/util/android_chrome_version_test.py
@@ -169,9 +169,11 @@ class _VersionTest(unittest.TestCase):
arch_trichrome_32_version_code = output['TRICHROME_32_VERSION_CODE']
arch_trichrome_32_64_version_code = output['TRICHROME_32_64_VERSION_CODE']
arch_trichrome_64_32_version_code = output['TRICHROME_64_32_VERSION_CODE']
- arch_trichrome_64_version_code = output['TRICHROME_64_VERSION_CODE']
- arch_trichrome_64_high_version_code = output[
+ arch_trichrome_64_32_high_version_code = output[
'TRICHROME_64_HIGH_VERSION_CODE']
+ arch_trichrome_64_version_code = output['TRICHROME_64_VERSION_CODE']
+ arch_trichrome_auto_64_32_version_code = output[
+ 'TRICHROME_AUTO_64_32_VERSION_CODE']
self.assertEqual(arch_monochrome_32_version_code, '484400020')
self.assertEqual(arch_monochrome_32_64_version_code, '484400023')
@@ -182,8 +184,9 @@ class _VersionTest(unittest.TestCase):
self.assertEqual(arch_trichrome_32_64_version_code, '484400033')
self.assertEqual(arch_trichrome_version_code, '484400033')
self.assertEqual(arch_trichrome_64_32_version_code, '484400034')
+ self.assertEqual(arch_trichrome_64_32_high_version_code, '484400039')
self.assertEqual(arch_trichrome_64_version_code, '484400035')
- self.assertEqual(arch_trichrome_64_high_version_code, '484400039')
+ self.assertEqual(arch_trichrome_auto_64_32_version_code, '484400054')
def testGenerateVersionCodesAndroidArchX64(self):
"""Assert it handles different architectures correctly.
@@ -219,6 +222,8 @@ class _VersionTest(unittest.TestCase):
arch_trichrome_version_code = output['TRICHROME_VERSION_CODE']
arch_trichrome_64_32_version_code = output['TRICHROME_64_32_VERSION_CODE']
arch_trichrome_64_version_code = output['TRICHROME_64_VERSION_CODE']
+ arch_trichrome_auto_64_32_version_code = output[
+ 'TRICHROME_AUTO_64_32_VERSION_CODE']
self.assertEqual(arch_monochrome_32_version_code, '484400021')
self.assertEqual(arch_monochrome_32_64_version_code, '484400026')
@@ -230,6 +235,7 @@ class _VersionTest(unittest.TestCase):
self.assertEqual(arch_trichrome_version_code, '484400036')
self.assertEqual(arch_trichrome_64_32_version_code, '484400037')
self.assertEqual(arch_trichrome_64_version_code, '484400038')
+ self.assertEqual(arch_trichrome_auto_64_32_version_code, '484400057')
def testGenerateVersionCodesAndroidArchOrderArm(self):
"""Assert it handles different architectures correctly.
@@ -421,14 +427,24 @@ class _VersionCodeTest(unittest.TestCase):
self.assertEqual(abi, 'arm_64_32')
self.assertEqual(is_next_build, False)
- def testArm_64BuildTranslate(self):
- """Test for a build with Trichrome and arm_64_high."""
+ def testArm_Auto_64_32Translate(self):
+ """Test for an auto build with Trichrome and arm_64_32."""
+ build, patch, package, abi, is_next_build = TranslateVersionCode(
+ '499900054')
+ self.assertEqual(build, 4999)
+ self.assertEqual(patch, 0)
+ self.assertEqual(package, 'TRICHROME_AUTO')
+ self.assertEqual(abi, 'arm_64_32')
+ self.assertEqual(is_next_build, False)
+
+ def testArm_64_32HighTranslate(self):
+ """Test for a build with Trichrome and arm_64_32_high."""
build, patch, package, abi, is_next_build = TranslateVersionCode(
'534613739')
self.assertEqual(build, 5346)
self.assertEqual(patch, 137)
self.assertEqual(package, 'TRICHROME')
- self.assertEqual(abi, 'arm_64_high')
+ self.assertEqual(abi, 'arm_64_32_high')
self.assertEqual(is_next_build, False)
def testX86_64Translate(self):
@@ -461,6 +477,16 @@ class _VersionCodeTest(unittest.TestCase):
self.assertEqual(abi, 'x86_64_32')
self.assertEqual(is_next_build, False)
+ def testX86_Auto_64_32Translate(self):
+ """Test for an auto build with x86_64_32."""
+ build, patch, package, abi, is_next_build = TranslateVersionCode(
+ '499900057')
+ self.assertEqual(build, 4999)
+ self.assertEqual(patch, 0)
+ self.assertEqual(package, 'TRICHROME_AUTO')
+ self.assertEqual(abi, 'x86_64_32')
+ self.assertEqual(is_next_build, False)
+
def testWebviewTranslate(self):
"""Test for a build with Webview."""
build, patch, package, abi, is_next_build = TranslateVersionCode(
diff --git a/build/util/generate_wrapper.gni b/build/util/generate_wrapper.gni
index 92badac7f..e2ceccc9e 100644
--- a/build/util/generate_wrapper.gni
+++ b/build/util/generate_wrapper.gni
@@ -41,43 +41,28 @@
# wrapper_script = "$root_build_dir/bin/run_sample_build_product"
# }
template("generate_wrapper") {
- _generator_script = "//build/util/generate_wrapper.py"
- if (defined(invoker.generator_script)) {
- _generator_script = invoker.generator_script
- }
- _executable_to_wrap = invoker.executable
- _wrapper_script = invoker.wrapper_script
- if (is_win) {
- _wrapper_script += ".bat"
- }
- if (defined(invoker.executable_args)) {
- _wrapped_arguments = invoker.executable_args
- } else {
- _wrapped_arguments = []
- }
-
action(target_name) {
- forward_variables_from(invoker,
- TESTONLY_AND_VISIBILITY + [
- "assert_no_deps",
- "data",
- "data_deps",
- "deps",
- "public_deps",
- "sources",
- ])
- script = _generator_script
- if (!defined(data)) {
- data = []
+ if (defined(invoker.generator_script)) {
+ script = invoker.generator_script
+ } else {
+ script = "//build/util/generate_wrapper.py"
}
- data += [
+ _wrapper_script = invoker.wrapper_script
+ if (is_win) {
+ _wrapper_script += ".bat"
+ }
+
+ data = [
_wrapper_script,
"//.vpython3",
]
+ if (defined(invoker.data)) {
+ data += invoker.data
+ }
outputs = [ _wrapper_script ]
_rebased_executable_to_wrap =
- rebase_path(_executable_to_wrap, root_build_dir)
+ rebase_path(invoker.executable, root_build_dir)
_rebased_wrapper_script = rebase_path(_wrapper_script, root_build_dir)
if (is_win) {
_script_language = "batch"
@@ -95,11 +80,19 @@ template("generate_wrapper") {
_script_language,
]
- args += [ "--" ]
- args += _wrapped_arguments
-
- if (defined(invoker.write_runtime_deps)) {
- write_runtime_deps = invoker.write_runtime_deps
+ if (defined(invoker.executable_args)) {
+ args += [ "--" ] + invoker.executable_args
}
+
+ forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
+ forward_variables_from(invoker,
+ "*",
+ TESTONLY_AND_VISIBILITY + [
+ "data",
+ "executable",
+ "executable_args",
+ "generator_script",
+ "wrapper_script",
+ ])
}
}
diff --git a/build/util/java_action.py b/build/util/java_action.py
index a19e06d8a..6382dc23b 100755
--- a/build/util/java_action.py
+++ b/build/util/java_action.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright 2015 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/build/util/lastchange.py b/build/util/lastchange.py
index 2caf94506..98a6360b4 100755
--- a/build/util/lastchange.py
+++ b/build/util/lastchange.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright 2012 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -6,7 +6,6 @@
"""
lastchange.py -- Chromium revision fetching utility.
"""
-from __future__ import print_function
import argparse
import collections
diff --git a/build/util/lib/common/perf_tests_results_helper.py b/build/util/lib/common/perf_tests_results_helper.py
index a5327796b..8246e206c 100644
--- a/build/util/lib/common/perf_tests_results_helper.py
+++ b/build/util/lib/common/perf_tests_results_helper.py
@@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-from __future__ import print_function
import re
import sys
diff --git a/build/util/lib/common/unittest_util_test.py b/build/util/lib/common/unittest_util_test.py
index 472982bf3..e775e1a5e 100755
--- a/build/util/lib/common/unittest_util_test.py
+++ b/build/util/lib/common/unittest_util_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright 2015 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/build/util/lib/results/DIR_METADATA b/build/util/lib/results/DIR_METADATA
new file mode 100644
index 000000000..aea61c0bf
--- /dev/null
+++ b/build/util/lib/results/DIR_METADATA
@@ -0,0 +1,11 @@
+# Metadata information for this directory.
+#
+# For more information on DIR_METADATA files, see:
+# https://source.chromium.org/chromium/infra/infra/+/main:go/src/infra/tools/dirmd/README.md
+#
+# For the schema of this file, see Metadata message:
+# https://source.chromium.org/chromium/infra/infra/+/main:go/src/infra/tools/dirmd/proto/dir_metadata.proto
+
+monorail {
+ component: "Infra>Client>Chrome"
+}
diff --git a/build/util/lib/results/result_sink.py b/build/util/lib/results/result_sink.py
index 003fa39b9..3996b65d8 100644
--- a/build/util/lib/results/result_sink.py
+++ b/build/util/lib/results/result_sink.py
@@ -77,6 +77,7 @@ class ResultSinkClient(object):
duration,
test_log,
test_file,
+ variant=None,
artifacts=None,
failure_reason=None,
html_artifact=None):
@@ -91,6 +92,9 @@ class ResultSinkClient(object):
duration: An int representing time in ms.
test_log: A string representing the test's output.
test_file: A string representing the file location of the test.
+ variant: An optional dict of variant key value pairs as the
+ additional variant sent from test runners, which can override
+ or add to the variants passed to `rdb stream` command.
artifacts: An optional dict of artifacts to attach to the test.
failure_reason: An optional string with the reason why the test failed.
Should be None if the test did not fail.
@@ -128,6 +132,9 @@ class ResultSinkClient(object):
}
}
+ if variant:
+ tr['variant'] = {'def': variant}
+
artifacts = artifacts or {}
tr['summaryHtml'] = html_artifact if html_artifact else ''
if test_log:
diff --git a/build/util/lib/results/result_sink_test.py b/build/util/lib/results/result_sink_test.py
index c6dd8209b..7d6567777 100755
--- a/build/util/lib/results/result_sink_test.py
+++ b/build/util/lib/results/result_sink_test.py
@@ -115,6 +115,24 @@ class ClientTest(unittest.TestCase):
'some-test')
self.assertIsNotNone(data['testResults'][0]['summaryHtml'])
+ @mock.patch('requests.Session.post')
+ def testPostWithVariant(self, mock_post):
+ self.client.Post('some-test',
+ result_types.PASS,
+ 0,
+ 'some-test-log',
+ None,
+ variant={
+ 'key1': 'value1',
+ 'key2': 'value2'
+ })
+ data = json.loads(mock_post.call_args[1]['data'])
+ self.assertEqual(data['testResults'][0]['variant'],
+ {'def': {
+ 'key1': 'value1',
+ 'key2': 'value2'
+ }})
+
if __name__ == '__main__':
unittest.main()
diff --git a/build/util/version.py b/build/util/version.py
index bf7a59eab..9bf51cd35 100755
--- a/build/util/version.py
+++ b/build/util/version.py
@@ -7,7 +7,6 @@
version.py -- Chromium version string substitution utility.
"""
-from __future__ import print_function
import argparse
import os