Skip to content

Commit

Permalink
Replaced lint-suppressions.xml.patch with python chromium_src override (
Browse files Browse the repository at this point in the history
#27020)

* Replaced lint-suppressions.xml.patch with python chromium_src override
  • Loading branch information
AlexeyBarabash authored Dec 16, 2024
1 parent 9a78fff commit 04da656
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 12 deletions.
3 changes: 2 additions & 1 deletion build/commands/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
19 changes: 18 additions & 1 deletion chromium_src/build/android/gyp/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# 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)
# pylint: disable=unused-argument
def JavaCmd(original_function, xmx='1G'): #NOSONAR
Expand All @@ -15,3 +15,20 @@ 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 = 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)

return original_root_node
37 changes: 37 additions & 0 deletions chromium_src/chrome/android/expectations/lint-suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2024 The Brave Authors. All rights reserved.
This Source Code Form is subject to the terms of the Mozilla Public
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/.
-->
<lint>
<issue id="ExportedService" severity="ignore" />
<issue id="DuplicateDefinition">
<ignore regexp="chrome/android/java/res/values/brave_colors.xml" />
</issue>
<issue id="StringFormatCount">
<ignore regexp="sponsored_images_bottom_sheet_text" />
<ignore regexp="notification_marketing" />
<ignore regexp="renew_monthly_save" />
<ignore regexp="wallet_swap_fees_notice" />
<ignore regexp="processing_fee" />
</issue>
<issue id="WrongConstant">
<ignore regexp="ContentSettingsType.BRAVE_CONTENT_SETTINGS_TYPES_LIST" />
</issue>
<issue id="UnusedResources">
<ignore regexp="The resource `R.string.playlist_.*` appears to be unused" />
<ignore regexp="The resource `R.string.new_tab_otr.*` appears to be unused" />
<ignore regexp="The resource `R.dimen.md_incognito_ntp.*` appears to be unused" />
<ignore regexp="The resource `R.layout.incognito.*` appears to be unused" />
<ignore regexp="The resource `R.layout.logo_view_layout` appears to be unused" />
<ignore regexp="The resource `R.style.*_BrowserUI_Switch_Incognito` appears to be unused" />
<ignore regexp="The resource `R.style.CardTransparentForDark` appears to be unused" />
<ignore regexp="The resource `R.dimen.toolbar_hairline_height` appears to be unused" />
<ignore
regexp="The resource `R.style.TextAppearance_IncognitoNewTabLearnMoreLinkModern` appears to be unused" />
</issue>
<issue id="UnsafeOptInUsageError">
<ignore regexp='(markerClass = androidx.media3.common.util.UnstableApi.class)' />
</issue>
</lint>
10 changes: 0 additions & 10 deletions patches/chrome-android-expectations-lint-suppressions.xml.patch

This file was deleted.

0 comments on commit 04da656

Please sign in to comment.