[plaster] Add an example using plaster to generate a patch file (#31132)
Add description Add ignore-eol to align with nodejs updatePatches.js
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
diff --git a/chrome/utility/BUILD.gn b/chrome/utility/BUILD.gn
|
||||
index 88b6b588f581338a8873767e64d08dcf5333240c..9556d02ac2c9babde33d8e7837ce919b148ad459 100644
|
||||
index 88b6b588f581338a8873767e64d08dcf5333240c..3241c78ddc8d2a5bf32190d22cc6593fa73792db 100644
|
||||
--- a/chrome/utility/BUILD.gn
|
||||
+++ b/chrome/utility/BUILD.gn
|
||||
@@ -77,6 +77,8 @@ static_library("utility") {
|
||||
"//ui/base:buildflags",
|
||||
]
|
||||
|
||||
@@ -268,6 +268,7 @@ static_library("utility") {
|
||||
if (enable_on_device_translation) {
|
||||
deps += [ "//components/services/on_device_translation:on_device_translation_service" ]
|
||||
}
|
||||
+ import("//brave/utility/sources.gni") sources += brave_utility_sources deps += brave_utility_deps public_deps += brave_utility_public_deps
|
||||
+
|
||||
if (is_win) {
|
||||
deps += [
|
||||
"//components/services/quarantine",
|
||||
}
|
||||
|
||||
if (!is_android) {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# Copyright (c) 2025 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/.
|
||||
|
||||
[[substitution]]
|
||||
description = 'Add brave/utility sources'
|
||||
re_pattern = '''(static_library\("utility"\) {[\s\S]*?)(^})'''
|
||||
re_flags = ['MULTILINE']
|
||||
replace = '''\1 import("//brave/utility/sources.gni") sources += brave_utility_sources deps += brave_utility_deps public_deps += brave_utility_public_deps\n\2'''
|
||||
@@ -204,6 +204,7 @@ class PatchInfo:
|
||||
'--dst-prefix=b/',
|
||||
'--default-prefix',
|
||||
'--full-index',
|
||||
'--ignore-space-at-eol',
|
||||
self.source,
|
||||
no_trim=True)
|
||||
return self.patch.save_if_changed(new_content=content, dry_run=dry_run)
|
||||
@@ -256,12 +257,16 @@ class PlasterFile:
|
||||
contents = repository.chromium.read_file(info.source)
|
||||
|
||||
for substitution in plaster_file.get('substitution'):
|
||||
description = substitution.get('description')
|
||||
re_pattern = substitution.get('re_pattern')
|
||||
pattern = substitution.get('pattern')
|
||||
replace = substitution.get('replace')
|
||||
expected_count = substitution.get('count', 1)
|
||||
flags = substitution.get('re_flags', [])
|
||||
|
||||
if description is None:
|
||||
raise ValueError(f'No description specified in {info.source}')
|
||||
|
||||
if re_pattern is not None and pattern is not None:
|
||||
raise ValueError(
|
||||
f'Please specify either pattern or re_pattern '
|
||||
|
||||
Reference in New Issue
Block a user