106 Commits
Author SHA1 Message Date
Aleksei Khoroshilov a8905aee73 Bump commander.js to latest version. (#35933)
* Bump commander.js to latest version.

* Update gn command to work with new commander.

* Fix build_config handling in various commands.
2026-04-29 11:22:33 +07:00
Aleksei Khoroshilov 240fb3f915 Migrate config.js to TS in build/commands (#35374)
* Replace imports.

* Migrate config.js to TS.

* Replace build references.

* Adjust TargetOS to infer from a runtime list.

* Apply stricter rules for optional properties.

* Restore options.outputDir to keep the PR without any logic change.
2026-04-15 08:26:13 +01:00
Aleksei Khoroshilov 238d0b8424 Convert logging to ts in build/commands. (#35199)
Make Log functions global in `build/commands`.
2026-04-03 00:26:31 +07:00
Aleksei Khoroshilov 0af2ca5354 Add CI detect module to build/commands. (#34795)
* Add isCI module to `build/commands`.

* Use named exports, rename module to ciDetect.
2026-03-19 16:15:21 +07:00
Aleksei Khoroshilov ecb96b1fef Enable more ts checks in build/commands. (#34341) 2026-03-10 14:11:32 +00:00
Mikhail cdd75b9808 Fix eslint import issues (#34211)
The PR fixes some eslint import/* issues
2026-03-05 14:42:29 +07:00
Aleksei Khoroshilov 1ca2ad1d50 Migrate build/commands to ESM (#34222)
Migrate `build/commands` code to ESM to allow `.js`/`.ts` imports to work correctly in any direction. This allows for gradual migration to `.ts` while keeping `.js` files around.

Few notes on migration:
1. `import.meta.*` cannot be used reliably with Jest. I tried different versions and approaches, eventually came up with a `.cjs` module that still uses `__dirName`, but can be imported into ESM and CommonJS modules without issues. I also considered rewriting Jest tests into built-in Node test runner, but since I was able to make Jest work, this was abandoned.
2. `tsc` accepts both `file.js`/`file.ts` in imports and passes a compiler check without errors, but Node requires an import of a real file (type stripping is based on a file type). This means an incorrect import will pass `test:scripts`, but fail on real execution (see [related discussion](https://github.com/microsoft/TypeScript/issues/61021)). An eslint rule was added to enforce that.
3. local `require()` calls replaced with async/global imports depending on context.
2026-02-28 20:56:13 +07:00
Aleksei Khoroshilov dd63a9da74 Write .sisorc from js and warn if siso_cache_dir is not set. (#33461)
* Write .sisorc from js and warn if siso_cache_dir is not set.

* Remove auto-directory setting.

* Remove try/catch around mkdirSync as it doesn't throw when dir exists.

* Use path.

* Adjust writeFileIfModified to not create empty files.
2026-02-12 17:47:02 +07:00
Aleksei Khoroshilov a540beda55 Update .gclient on sync. (#27640)
* Update .gclient file on sync.

* Rename var to disable .gclient auto-update.

* Improve header comment examples slightly.

* Remove checks for always set existingGclientConfig.

* Treat disable_gclient_config_update flag as exception, not norm.

* Move custom_deps/vars to package.json config.
2026-01-09 18:06:44 +07:00
Aleksei Khoroshilov fbde0b01ac Remove .gclient config path customization. (#32907) 2025-12-19 21:33:58 +07:00
Aleksei Khoroshilov 274f226000 Standardize gclient naming across build commands. (#32886)
Unify gclient variable names in build commands.
2025-12-19 14:11:33 +07:00
Aleksei Khoroshilov 31ac7cd7a3 Improve .gclient config generation logic. (#32869)
* Treat absent target_os/arch params as empty lists.
* Write file atomically.
* Always update it on CI.
* Use json writer logic to omit undefined values.
2025-12-18 15:45:28 +07:00
Gaetano Checinski feaf16f7b5 threads through --no-history flag enabling faster cloning using gclient (#29938) 2025-07-29 11:48:59 +01:00
Mikhail 57bd457b12 Format build dir (#29114)
* Add {} in /build (eslint-curly)
* Prettify build/
* Remove /build from .prettierignore
2025-05-22 18:30:02 +04:00
cdesouza-chromium edfea6d4c0 [canary] Fix 🚀 gclient sync silent Jenkins crash (#28296)
There has been some long investigation to determine why `npm run init`
was hanging when being called from Brockit. Although the proper reason
couldn't be properly ascertained, it is possible to say now that in
certain contexts, Jenkins doesn't like `gclient sync` with the
`--revision` flag.

This PR works around this issue by providing a specific flag to remove
the use of `--revision`, and manually checkout `chromium/src` to the
desired tag. The flag is named `--with_issue_44921`, in order to provide
better context of its use and rationale behind it.

Resolves https://github.com/brave/brave-browser/issues/44921
2025-03-25 10:46:18 +00:00
Mikhail 0177da349d Opt-out telemetry after the sync done (#24700)
* Opt-out after the sync done
* Fix review issues
* Reformat
2024-07-17 13:44:07 +02:00
goodov 553ed06aae Check node and npm versions. (#24458)
* Check node and npm version.

* Parse version parts to integer to handle possible non-digits chars.

* Use package.json "engines" field.

* Fix error style.
2024-07-10 08:29:17 +02:00
goodov 813a7217ff Allow target_os/target_arch to be used in npm run sync (#24525)
* Allow target_os/arch in npm run sync.

* Remove deprecated flag.

* Remove unused flag.

* Add -C flag to mirror --sync_chromium.
2024-07-09 17:04:29 +07:00
goodov 91bb2da05f Harden depot_tools install and support revision enforcement. (#22570)
* Harden depot_tools checkout and support revision enforcement.

* Move depot_tools install process into a separate file.

* Rename ActionGuard.with() -> run().

* Use depot_tools dir value from package.json.

* Format.

* Always checkout FETCH_HEAD after fetching a reference.

* Only allow git revision to be enforced for depot_tools.

* Guard all possibly failing steps.

* Use brave-core-relative depot_tools path in package.json.

* Move bootstrap into a separate function, swap guard and log calls.
2024-04-05 12:56:23 +02:00
goodov ab6119da99 Allow fetching all tags and branch heads to create full git cache. (#22591)
* Allow fetching all tags and branch heads to create full git cache.

* Update variables pass in buildChromiumRelease.
2024-03-14 17:22:03 +01:00
mschfhandAleksey Khoroshilov 96689ef966 Migrate hermetic toolchains (#22254)
* Migrate hermetic toolchains

* Add internal deps endpoint availability check and a warning.

* Format.

---------

Co-authored-by: Aleksey Khoroshilov <akhoroshilov@brave.com>
2024-02-22 23:06:48 +07:00
Mikhail 3a923c5018 Add npm run build_chromium (#21017)
* Add npm run build_chromium

* Per platfrom targets

* Add target_os & target_arch

* Fix android apk path

* Use repack-archive.py

* Use chromeVersion for output

* Change the output filename, add mac support

* Add comments

* Support linux

* Adjust build args

* Fix presubmit

* Fix review comment

* Add isChromium to config.js

* Remove changing outputDir

* Return <build_dir>

* Tune gn args

* Review fixes

* Fix non-mac builds

* Rename the script, add a warning

* Change the comment
2023-11-28 13:11:00 -05:00
Aleksey Khoroshilov 2e335425c1 Call updateChromeVersion() as a part of applyPatches(). 2023-11-13 11:14:56 +07:00
Aleksey Khoroshilov 7bd833df6b Support Mac/Windows cross-compilation on Linux. 2023-08-31 17:07:28 +07:00
Aleksey Khoroshilov 8c6fba1556 Add teamcity progress blocks support. 2023-07-26 16:56:26 +07:00
Aleksey Khoroshilov 1267aa1077 Remove logging.js duplicates. 2023-07-26 16:56:26 +07:00
Aleksey Khoroshilov 6d7ec055d6 Move updateChromeVersion to a separate file. 2023-07-12 16:57:53 +07:00
Aleksey Khoroshilov 075b0c7c45 Update chrome/VERSION during sync using package.json version. 2023-07-12 15:13:15 +07:00
bridiver b1c1343cd0 convert brave rust targets to upstream rust targets 2023-06-29 12:10:14 -07:00
Jay Harris 63be302a09 Fix bad license (http ==> https) 2022-11-09 18:31:39 +13:00
Michael Herrmann 398d85389b Fix Linux Arm64 build (#15451)
* Fix Linux Arm64 build

`npm run init` didn't install all dependencies necessary for it.

* Always run arm64 gclient hooks on Linux

This in particular creates the arm64 sysroot, which we need when
building for that architecture.
2022-10-19 23:26:58 -04:00
Aleksey Khoroshilov d461472578 Enable delete_unused_deps by default on CI. 2022-09-14 15:07:57 +07:00
Aleksey Khoroshilov 9115febf39 Support deleting unused deps (gclient sync -D flag). 2022-09-14 15:07:57 +07:00
Aleksey Khoroshilov 1316ffa292 Separate src and src/brave gclient sync steps. 2022-09-14 15:07:57 +07:00
Aleksey Khoroshilov 7fb15e6023 Refactor maybeInstallDepotTools(). 2022-09-14 15:07:56 +07:00
Aleksey Khoroshilov 9747fe4ca1 Refactor buildDefaultGClientConfig(). 2022-09-14 15:07:56 +07:00
Aleksey Khoroshilov 26d360c0ca Move sync-related functions from util.js to sync.js. 2022-09-14 15:07:56 +07:00
Brian Johnson beb67681d9 Revert "Improve npm run sync logic to support v8 patching." 2022-08-22 12:29:22 -07:00
Aleksey Khoroshilov 6eb4b6d3b7 Review improvements. 2022-08-18 13:14:53 +07:00
Aleksey Khoroshilov 35fc3c0170 Improve npm run sync logic. 2022-08-18 13:14:52 +07:00
Pete MillerandMihai PLESA 506d399e11 sync script - never ask gclient to sync brave-core (#11543)
* sync script - never ask gclient to sync brave-core

The inconsistency between the developer or CI using git or gclient being used was causing issues, especially if GIT_CACHE was set

* Sync: No need to reset remote repo url since git cache won't be used for brave-core dir anymore

Co-authored-by: Mihai PLESA <mihai.plesa@gmail.com>
2022-03-31 17:04:11 -05:00
Mikhail efe11c1b8b Create ninjalog.cfg on sync (#12045) 2022-02-02 22:32:39 +07:00
bridiver 8cac90f020 specifying brave core ref is deprecated 2022-01-27 20:40:39 +00:00
bridiver c180396a31 don't try to update depot tools, it handles that by itself 2022-01-27 20:40:39 +00:00
bridiver 14796a25c9 remove deprecated options 2022-01-27 20:40:39 +00:00
bridiver 8b5f3f671a add nohooks options for sync 2022-01-27 20:40:39 +00:00
Brian Johnson 007dd9f0e4 Revert "Config cleanup" 2022-01-27 12:49:25 -07:00
bridiver e546ed8d6b specifying brave core ref is deprecated 2022-01-26 15:21:46 -07:00
bridiver 169e8a8450 don't try to update depot tools, it handles that by itself 2022-01-26 15:21:46 -07:00
bridiver 8d5aa8031b remove deprecated options 2022-01-26 15:21:46 -07:00