From c97e61fe4bc7b032278349b07aeeb025ee2b0f89 Mon Sep 17 00:00:00 2001 From: AlexeyBarabash Date: Sat, 14 Dec 2024 00:22:46 +0200 Subject: [PATCH 1/2] Replaced lint-suppressions.xml.patch with python chromium_src override --- android/expectations/lint-suppressions.xml | 37 +++++++++++++++++++ chromium_src/build/android/gyp/lint.py | 19 +++++++++- ...d-expectations-lint-suppressions.xml.patch | 10 ----- 3 files changed, 55 insertions(+), 11 deletions(-) create mode 100644 android/expectations/lint-suppressions.xml delete mode 100644 patches/chrome-android-expectations-lint-suppressions.xml.patch diff --git a/android/expectations/lint-suppressions.xml b/android/expectations/lint-suppressions.xml new file mode 100644 index 000000000000..be11e4f63a68 --- /dev/null +++ b/android/expectations/lint-suppressions.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/chromium_src/build/android/gyp/lint.py b/chromium_src/build/android/gyp/lint.py index b83e3f82f54e..cd904b6468cc 100644 --- a/chromium_src/build/android/gyp/lint.py +++ b/chromium_src/build/android/gyp/lint.py @@ -5,7 +5,6 @@ import override_utils - @override_utils.override_function(build_utils) # pylint: disable=unused-argument def JavaCmd(original_function, xmx='1G'): #NOSONAR @@ -15,3 +14,21 @@ def JavaCmd(original_function, xmx='1G'): #NOSONAR # for Android incremental builds return original_function('4G') + + +@override_utils.override_function(globals()) +def _GenerateConfigXmlTree(original_function, orig_config_path, + backported_methods): + # Expand upstream's lint-suppressions.xml with python chromium_src override + original_root_node = original_function(orig_config_path, + backported_methods) + + if orig_config_path: + brave_config_path = os.path.join(os.pardir, os.pardir, 'brave', + 'android', 'expectations', + 'lint-suppressions.xml') + brave_root_node = ElementTree.parse(brave_config_path).getroot() + for item in brave_root_node.findall('issue'): + original_root_node.append(item) + + return original_root_node diff --git a/patches/chrome-android-expectations-lint-suppressions.xml.patch b/patches/chrome-android-expectations-lint-suppressions.xml.patch deleted file mode 100644 index c4d3f7cb8b02..000000000000 --- a/patches/chrome-android-expectations-lint-suppressions.xml.patch +++ /dev/null @@ -1,10 +0,0 @@ -diff --git a/chrome/android/expectations/lint-suppressions.xml b/chrome/android/expectations/lint-suppressions.xml -index 814a84c9b838db7bbd52873344f366ed2f9a73e5..513b3889a4c9ae85af74515b74896909b6b2ab91 100644 ---- a/chrome/android/expectations/lint-suppressions.xml -+++ b/chrome/android/expectations/lint-suppressions.xml -@@ -302,4 +302,5 @@ https://chromium.googlesource.com/chromium/src/+/main/build/android/docs/lint.md - - - -+ - From c9ba6986f5cfad17820b9393dfe7997f47d77a16 Mon Sep 17 00:00:00 2001 From: AlexeyBarabash Date: Mon, 16 Dec 2024 13:36:27 +0200 Subject: [PATCH 2/2] Support rebuilds via touchOverriddenFiles, codereview notice --- build/commands/lib/util.js | 3 ++- chromium_src/build/android/gyp/lint.py | 6 +++--- .../chrome/android}/expectations/lint-suppressions.xml | 0 3 files changed, 5 insertions(+), 4 deletions(-) rename {android => chromium_src/chrome/android}/expectations/lint-suppressions.xml (100%) diff --git a/build/commands/lib/util.js b/build/commands/lib/util.js index 37c0f6854796..96e0049f2407 100644 --- a/build/commands/lib/util.js +++ b/build/commands/lib/util.js @@ -524,7 +524,8 @@ const util = { // Return true when original file of |file| should be touched. const applyFileFilter = (file) => { // Only include overridable files. - const supportedExts = ['.cc', '.css', '.h', '.html', '.icon', '.json', '.mm', '.mojom', '.pdl', '.py', '.ts']; + const supportedExts = ['.cc', '.css', '.h', '.html', '.icon', '.json', + '.mm', '.mojom', '.pdl', '.py', '.ts', '.xml']; return supportedExts.includes(path.extname(file)) } diff --git a/chromium_src/build/android/gyp/lint.py b/chromium_src/build/android/gyp/lint.py index cd904b6468cc..9ddc143a17ca 100644 --- a/chromium_src/build/android/gyp/lint.py +++ b/chromium_src/build/android/gyp/lint.py @@ -3,6 +3,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at https://mozilla.org/MPL/2.0/. +import brave_chromium_utils import override_utils @override_utils.override_function(build_utils) @@ -24,9 +25,8 @@ def _GenerateConfigXmlTree(original_function, orig_config_path, backported_methods) if orig_config_path: - brave_config_path = os.path.join(os.pardir, os.pardir, 'brave', - 'android', 'expectations', - 'lint-suppressions.xml') + brave_config_path = brave_chromium_utils.get_chromium_src_override( + orig_config_path) brave_root_node = ElementTree.parse(brave_config_path).getroot() for item in brave_root_node.findall('issue'): original_root_node.append(item) diff --git a/android/expectations/lint-suppressions.xml b/chromium_src/chrome/android/expectations/lint-suppressions.xml similarity index 100% rename from android/expectations/lint-suppressions.xml rename to chromium_src/chrome/android/expectations/lint-suppressions.xml