This PR introduces the basic tooling to have `include-what-you-use` run
against the brave codebase in maintainance mode. This manual regular
runs that cover more and more of the codebase.
Bug: https://github.com/brave/brave-browser/issues/42212
This PR adds a presubmit check to require authors to provide a reason
for using suppresion tags for the TS compiler, these being:
- `@ts-ignore`: Suppresses the error on the next line.
- `@ts-expect-error`: Suppresses the error, but alerts if not error.
Additionally, and educational warning is being added to make sure that
authors consider the use `@ts-expect-error` when appropriate, as
`@ts-ignore` is more permissive, and can become quietly obsolete.
Resolves https://github.com/brave/brave-browser/issues/54575
Allow the check on Linux and macOS
The JDK may not be available on macOS CI (upstream only checks it out on
Linux/Android). Silently skips when the binary is missing.
This reverts commit b328992aac.
This check fails on MacOS CIs. The failure error is:
Evaluation of CheckJavaStyle failed: [Errno 2] No such file or directory: '/<reducted>/src/third_party/jdk/current/bin/java'.
Upstream's DEPS does not check out third_party/jdk on MacOS based on the
condition:
'src/third_party/jdk/current': {
...
# Needed on Linux for use on chromium_presubmit (for checkstyle).
'condition': '(checkout_android or checkout_linux) and non_git_source',
...
The PR adds formatting check for all files in no-platform builds.
This help to prevernt the situations "formatting rules are changed, but the current files don't fit".
The PR:
* Reengineering eslint.config.js to properly extending the existing plugins and configs.
It also implies disabling a bunch of broken rules.
* Adds running eslint for all brave files in `npm run presubmit -- --all`.
* Also enables eslint check for all *.js files
This moves files that are directly copied over chromium resources to a separate directory where they are checked to make sure that there is a corresponding upstream file. This is the first step in a series of changes to clean up branding.js https://github.com/brave/brave-browser/issues/51969
* Brave Origin theme assets
The optimization used optipng -o7 which is 100% lossless
* Fix PRESUBMIT.py check for brave_origin theme
* Fix PRESUBMIT.py lint
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/8c28f057f084a5c5ed3993df7d620ccadc3bf003
commit 8c28f057f084a5c5ed3993df7d620ccadc3bf003
Author: Tom Anderson <thomasanderson@chromium.org>
Date: Thu Aug 14 11:58:44 2025 -0700
Remove debian.menu from Debian packages
The debian.menu files have been replaced with .desktop files in all
major desktop environments. This CL removes it, and the old XPM icon
resources, which were only used by debian.menu. Finally, fix a bit of
nondeterminism exposed by bug 377894390 by sorting the icon list.
R=thestig
Change-Id: Ia36754d05865e327da0c97b715434a1180ead0c5
Bug: 377894390
Add new Assets.car files on Mac, which contain the same assets from app.icns.
This required a small change to our PRESUBMIT check for upstream theme file
overrides, as it wasn't accounting for channel-specific assets.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/47dc8a5451bf0e73c0c903d53110aeb52bc1865f
commit 47dc8a5451bf0e73c0c903d53110aeb52bc1865f
Author: Avi Drissman <avi@chromium.org>
Date: Tue Jul 8 13:08:17 2025 -0700
Handle .car files in BUILD.gn
1. Copy the .car file into the Resources folder alongside the app.icns
file.
2. Copy the channel .car files into the packaging zip file so that the
packaging scripts can have access to them.
Bug: 425894794
Change-Id: I56f6a701c16ab37c921a4bd1b4ba33718f61072a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6701055
Reviewed-by: Peter Kvitek <kvitekp@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1483954}
This PR runs a mechanical change to do IWYU on all files using the new
abseil functions, while also removing the old header inclusions for
`base::StringPrintf`.
A presubmit `BanRule` is also being added for the `base::` functions.
Resolves https://github.com/brave/brave-browser/issues/48143
This allows cpplint to be run with the default `OFF_BY_DEFAULT_LINT_FILTERS` filter list which fixes a number of false positives in Obj-C files such as `readability/casting`
This PR adds a presubmit check for `nogncheck` uses, to make sure we are
using this lint suppresion label in places where appropriate. In
particular, the need for this check has come up due to the wrong
assumption that `gn` somehow lacked the ability to understand `#ifdef`
conditionals for header inclusions, when in fact, the issue with `gn`
checks in such cases is that there is a buildflag for a certain
exclusion, but the same exclusion has also to be applied in gn files.
Resolves https://github.com/brave/brave-browser/issues/47269
[plaster] Adding presubmit check or 🩹 files
This PR is a follow up on
https://github.com/brave/brave-core/pull/29716.
This PR adds a presubmit check that calls `plaster.py check`, and
validates to make sure that any submitted plaster file is up-to-date
with its patches, and applying correctly to the Chromium tree.
There's still some work to be done regarding deleted plaster files, and
what to do with a present patch file in such a case, but this is being
tracked in a separate ticket.
Resolves https://github.com/brave/brave-browser/issues/45058
* add prettier to format, call format from PRESUBMIT
* make format.js
* update prettier
* Add unformatted dirs to .prettierignore
* Fix linter errors
* cleanup .prettierignore
* Convert format.js to a script
* review fixes
* add some prettier-ignore-*
* Address some review issues
* move commander declaration
* Add --presubmit and --dry-run for format
* Revert "add some prettier-ignore-*"
* Fix eslint, add printWidth exclusion
* Remove printWidth override
* Fix eslint and format warn
* use bracketSameLine
* Review fixes
* use a single git cl format call
* Use spawnSync to avoid log flooding
* More review fixes
* More review updates
* Update build/commands/scripts/format.js
Co-authored-by: Aleksei Khoroshilov <5928869+goodov@users.noreply.github.com>
* Renames some vars
* Use absolute path for format.js
---------
Co-authored-by: Aleksei Khoroshilov <5928869+goodov@users.noreply.github.com>
Source code TODO warnings are being validated based on an upstream
expectation that doesn't match with our own bug tracking in Github. This
PR lifts the upstream check but changes the check to accommodate it to
our needs.
Resolves https://github.com/brave/brave-browser/issues/45054
[CodeHealth] Disallow new `NOTREACHED_IN_MIGRATION` instances
This PR adds a new presubmit check to prevent the introduction of new
occurrences for `NOTREACHED_IN_MIGRATION`. This macro is supposed to be
on its way out, however there are still new occurrances being introduced
in recent times.
* update build script, move core package directory
* Use xcode scheme pre-actions
* Make args file with version & api keys, remove unused configs
* Update dev to nightly naming, cleanup, fix missed test
* Remove brave-core-ios from package, update bootstrap
* dont remove frameworks early
* Move brave-ios npm packages into brave-core, cleanup
* Disable swift-format for now, disable clang-format on ThirdParty dir
* Build frameworks to src/out directory instead of inside brave-ios folder
* Move ios third party deps to brave/third_party/ios_deps directory
* Fix bootstrap copy with new directories, more cleanup
* Add iOS unit tests to `npm run test` command
* Remove swift formatting from presubmit
* Use symlink to output directory, move xcframework creation to npm cmd
* Add license checker special cases for iOS deps
* Presubmit fixes
* Replace `build_in_core` shell script with `scheme_preaction` python
- Adds `brave_ios_marketing_version` config and adds pre-actions for all main schemes
- Re-add Nightly (Dev) scheme
* Cleanup bootstrap, complete dev to nightly rename, remove Local xcconfigs
Plus format/presubmit fixes
* Remove SPM Package.resolved and ignore it
We won't be using the non-Xcode project based build system
* Update presubmit config, Remove macOS wireguard framework prebuild
* Add license info for moved brave-ios npm packages
* Exclude third_party/ios_deps from cpplint
* Add DEPS file to Guardian dep
* Rename brave_version_patch to illustrate its for iOS only
* Use correct GN configuration based on Xcode configuration
* Allow ios bootstrap script to be run from any directory. Update README
* Make fastlane channel builds also release to testers
Also fixes an issue where Xcode injected environment variables were available during GN builds which would cause build failures in Release configurations
* Remove clean git status check from fastlane
* Update fastlane script to always run bootstrap
* Fix bootstrap script copying placeholders to the wrong directory
* Disable xcpretty in fastlane scripts
* Fix debug scheme entitlements now that it shares nightly bundle id
* Update simulator target in fastlane unit test lane
* Disable xcpretty on unit tests and fixup test build
* Add provisioning profiles for nightly builds
* Expand relative directories in bootstrap
* Add explicit provisioning for nightly
* Fix tests & export junit reports
* Update nightly provisioning profile names
* Remove all skipped tests
* Fix failing unit tests
* Add explicit provisioning profiles for beta & release
* Remove app center fastlane plugin and ignore fastlane test_output in git
* Cleanup Xcode project config
* Fix invalid code signing identities on individual targets
* Skip flaky wallet tests, re-add automatic signing for debug builds
* Fix flaky CoreData tests by guaranteeing view context merge
* Update Jenkinsfile
* Move Xcode derived data directory to src/out for CI builds
* Remove 'No Changes' CoreData test
* Fixed missed Xcode derived data directory setting for iPad test build
* Fix iPad test plan
* Separate testflight build & upload into multiple fastlane runs
* Add version string to MaterialComponents during preaction
* Add ability to pass in PUBLIC CI arg into fastlane upload lane
* Cleanup config & presubmit rules
* Add explicit licenses/README.chromium's for third party iOS deps
* Presubmit cleanup/fixes
* Change Xcode preactions to run on xcframeworks instead of GN outputs
This avoids rebuilds that are due to BraveCore.framework and MaterialComponents.framework folders being touched in the out directory when we cleanup chromium assets and fix the MaterialComponents Info.plist
* Improve debugging when `strip_absolute_paths_from_debug_symbols` is true
- The bootstrap script now generates an LLDBInit that is used for Debug schemes. This file contains an lldb target.source-map to allow lldb to resolve breakpoints
- SPM & Xcode now build with the `-debug-prefix-map` swift flag so that all iOS files built out of GN also have relative debug paths
- Replace compilation flags being defined with OTHER_SWIFT_FLAGS to use SWIFT_ACTIVE_COMPILATION_CONDITIONS instead
* Remove SPM reload during preaction and use .env for Package.swift
This removes a race that could happen when reloading the package during the build
* Add Action Extension provisioning profiles and fix its xcode build settings
* Move xcframework creation command into separate file
* Fixup nvm/brew npm PATHs in Xcode pre-action script
* Move iOS bootstrap into gclient runhook, rename current_link
* Bootstrap script improvements based on feedback
* Rebase master/fix bootstrap import
* Bootstrap script improvements based on feedback pt2
* Revert Jenkinsfile change
* Move CheckNoJsInIos and CheckNoDeprecatedCss into permanent ignores
* Rebase master & fix wallet mock asset ratio service
---------
Co-authored-by: Mihai PLESA <mplesa@brave.com>
* Rename import_inline -> brave_chromium_utils.
* Add inline_chromium_src_override helper.
* Remove inline_file_from_src.
* Add typing info into brave_chromium_utils.
* Format and fix sys_path usage.
* Scan all overridable files in check_chromium_src.py.
* Replace another occurence of the hardcoded path in the error message.
* Move get_gn_arg to brave_chromium_utils.
* Update patches after cr121 rebase.