* [Plaster] Fixes for Windows.
- When running commands make sure the output is in UTF-8, otherwise on
Windows the output is using cp1252 which then can't be handled by
UTF-8 decoder.
- When updating files (patches after applying plaster, or target source
files) make sure to use LF line endings on Windows. The repo files are
checked out as LF and we shouldn't introduce CRLF line ending during
plaster apply operation.
* [Brockit] Fixes Win toolchain message.
When checking for Windows toolchain changes also check TOOLCHAIN_HASH.
The SDK version doesn't always get updated while the hash can change and
contain a different minor SDK update.
* Review feedback fix.
This change adds support for file paths to be listed when passing
`plaster apply`. This changes `apply` to go over all files, and just
apply specific ones.
This change will allow us to integrate plaster calls in brockit for
files that fail to reapply.
Resolves https://github.com/brave/brave-browser/issues/53512
The script was failing because it was encountering an unexpected
category 'more_cc': [<list_of_emails>] in the presubmit output and
couldn't handle the value data.
Updated the script to only process dictionary categories that contain
'message' key.
This is just to make the URL type more intuitive when used with strings.
This change corrects the url uses in our end.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/a2622a33efbcdc7e4bcf72510775f7f93970fce8
commit a2622a33efbcdc7e4bcf72510775f7f93970fce8
Author: Fred Shih <ffred@chromium.org>
Date: Wed Jan 21 17:07:46 2026 -0800
Add mojo typemap for ts Url
Currently URLs are a object type of {url: string}. This is annoying
because there is a stutter when using it, for example:
myObj.url.url
This change maps the Url object directly to a string. So one can simply
say:
myObj.url <-- string type!
The URL type wasn't used because url as a string is effectively
calcified at this point. It's (probably) too risky to change all the
callsites to url (and probably won't give us that much...).
Change-Id: I481085b8954cbf65bb3a4d115fd39e71b0a8fbcb
Bug: 40615900
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7018797
Commit-Queue: Fred Shih <ffred@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Michael Cui <mlcui@google.com>
Reviewed-by: Roman Arora <romanarora@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1572659}
* Changes check_chromium_src warning into an error.
Changes the warning that catches use of defined symbols in the override,
but not in the original file into an error. All uses of such symbols
should be marked with // CHROMIUM_SRC_INTERNAL_USE comment.
* Removes symbol exclusions section of the config file.
All symbols that don't conform to check_chromium_src rules should be marked with // CHROMIUM_SRC_NOLINT comment.
[CodeHealth] `base::Contains()` to be deleted
The remaining cases of `base::Contains` in the codebase can be just
`std::ranges::contains`.
This change was done mechanically, with the following script
```bash
files_using_header="$(git grep -l base::Contains | tr '\n' ' ')"
sed -i 's/base::Contains/std::ranges::contains/g' \
${files_using_header}
../tools/add_header.py --header '<algorithm>' ${files_using_header}
files_including_header="$(git grep -l base/containers/contains.h | tr '\n' ' ')"
../tools/add_header.py --header '"base/containers/contains.h"' \
--remove ${files_including_header}
git cl format
```
This CL also cherry-picks the contents of https://crrev.com/c/7380987 to
permit the use of certain range operations.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/4e6249c911b515cc237707ba751290c6dbe9970f
commit 4e6249c911b515cc237707ba751290c6dbe9970f
Author: Victor Hugo Vianna Silva <victorvianna@google.com>
Date: Sun Jan 18 11:32:26 2026 -0800
Reland "Delete unused base::Contains()"
This is a reland of commit 15af921783afac76cfc7d5beb04e4816ac0ffac7
Original change's description:
> Delete unused base::Contains()
>
> All callers were migrated.
>
> Fixed: 470391351
> Change-Id: I404da9186a45c2c47669592242fac972ef70dfa3
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7459699
> Auto-Submit: Victor Vianna <victorvianna@google.com>
> Commit-Queue: Francois Pierre Doray <fdoray@chromium.org>
> Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1570540}
Bug: 470391351
Change-Id: I858f7880bf8cb1857085eb44836dee4a0becf7ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7490440
Owners-Override: Matthew Denton <mpdenton@chromium.org>
Commit-Queue: Victor Vianna <victorvianna@google.com>
Reviewed-by: Victor Vianna <victorvianna@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1570926}
Otherwise there is a build error:
Traceback (most recent call last):
File "/mnt/wd2t/projects/brave-browser-3/src/out/android_Release_arm64/../../tools/grit/grit.py", line 17, in <module>
sys.exit(grit.grit_runner.Main(sys.argv[1:]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/wd2t/projects/brave-browser-3/src/tools/grit/grit/grit_runner.py", line 313, in Main
return toolobject.Run(options, args[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/wd2t/projects/brave-browser-3/src/tools/grit/grit/tool/build.py", line 265, in Run
self.res = grd_reader.Parse(opts.input,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/wd2t/projects/brave-browser-3/src/tools/grit/grit/grd_reader.py", line 252, in Parse
handler.root.AssignFirstIds(filename_or_stream, defines)
File "/mnt/wd2t/projects/brave-browser-3/src/tools/grit/grit/node/misc.py", line 657, in AssignFirstIds
raise Exception('Please update %s and add a first id for %s (%s).' %
Exception: Please update ../../out/android_Release_arm64/gen/tools/gritsettings/default_resource_ids and add a first id for chrome/browser/glic/resources/browser_resources.grd (includes).
This squash seems to have been innefective from the beginning, as
`endswith` is not reliable for this check. The new check verifies the
the sentece, and it also adds an expectation for a full-stop at the end,
to avoid a too broader pattern.
It is necessary that the `COMMIT_MSG` script does not interfere with
amend commits as keeping their commit message intact is necessary for
squashes to work as expected.
Overlaying upstream's chromeos IDs range alone doesn't work any more and
pushes IDs above the 2^16-1 range.
This change adds a pre-processing step to upstream's
"default_resource_ids" action in //tools/gritsettings/BUILD.gn. The
pre-processing filters out all items in
tools/gritsettings/resource_ids.spec that have chromeos, ash, or glic in
the path. This reduces the ID range taken by the upstream down to,
currently, under 51,000. With Brave IDs moved to start at 53,000, they
now end under 59,000.
* Update rust tools build process to share intermediate targets.
* Remove unused logic.
* Modernize gn_run_rsp.py.
* Use separate crate target dir for each build_crate target.
* Add release target adjustments to update.py.
* Simplify cargo-audit path.
* Move cargo-audit target back to tools/crates.
Fix patch file path generation with PurePath.as_posix()
On Windows path delimiter is `\` and on other platforms `/`. We should normalize the path.
WIth this patch, two particular errors are fixed
```
[11:25:08] Applying plaster file: c:\Users\sangwoo\brave\src\brave\rewrite\chrome\app\BUILD.gn.toml plaster.py:333
Traceback (most recent call last):
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 429, in <module>
sys.exit(main())
^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 424, in main
args.func(args)
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 404, in <lambda>
apply_parser.set_defaults(func=lambda args: apply())
^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 334, in apply
plaster_file.apply()
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 257, in apply
contents = repository.chromium.read_file(info.source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\repository.py", line 150, in read_file
return self.run_git('show',
^^^^^^^^^^^^^^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\repository.py", line 79, in run_git
return terminal.run_git('-C', self.from_brave(), *cmd, no_trim=no_trim)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\terminal.py", line 183, in run_git
return self.run(cmd).stdout
^^^^^^^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\terminal.py", line 160, in run
raise e
File "c:\Users\sangwoo\brave\src\brave\tools\cr\terminal.py", line 151, in run
result = subprocess.run(cmd,
^^^^^^^^^^^^^^^^^^^
File "C:\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\Lib\subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', '-C', '..', 'show', 'HEAD:chrome\\app\\BUILD.gn']' returned non-zero exit status 128.
```
[11:24:08] Applying plaster file: c:\Users\sangwoo\brave\src\brave\rewrite\chrome\app\BUILD.gn.toml plaster.py:333
Traceback (most recent call last):
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 429, in <module>
sys.exit(main())
^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 424, in main
args.func(args)
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 404, in <lambda>
apply_parser.set_defaults(func=lambda args: apply())
^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 334, in apply
plaster_file.apply()
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 310, in apply
has_changed = info.save_patch_if_changed(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 210, in save_patch_if_changed
return self.patch.save_if_changed(new_content=content, dry_run=dry_run)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\sangwoo\brave\src\brave\tools\cr\plaster.py", line 79, in save_if_changed
self.path.write_text(new_content, encoding='utf-8')
File "C:\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\Lib\pathlib.py", line 1078, in write_text
with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\depot_tools\bootstrap-2@3_11_8_chromium_35_bin\python3\bin\Lib\pathlib.py", line 1044, in open
return io.open(self, mode, buffering, encoding, errors, newline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'patches\\chrome\\app\\BUILD.gn.patch'
```****
```