These patches had their target path updated. These files used to be under `third_party/`. Chromium change: https://chromium.googlesource.com/devtools/devtools-frontend/+/e20bdacd076c94ada0411697d8c2c36c8af86dc6 commit e20bdacd076c94ada0411697d8c2c36c8af86dc6 Author: Simon Zünd <szuend@chromium.org> Date: Tue Aug 27 09:35:53 2024 +0200 [deps] Move ts_library out of third_party ts_library.py and typescript.gni do not contain any third party code. They had the Chromium license headers from the beginning. The only "third-party"ness they have, is that they use the "typescript" npm package. R=alexrudenko@chromium.org Fixed: 362397305
25 lines
1.7 KiB
Markdown
25 lines
1.7 KiB
Markdown
# DevTools Frontend Patching
|
|
|
|
## Adding a New File
|
|
|
|
1. Add your file in `//brave/third_party/devtools-frontend/src/front_end/{path to your file}`
|
|
2. Create (if it doesn't exist) `sources.gni` with `//brave/third_party/devtools-frontend/src/front_end/{path to your file}`
|
|
3. Create a patch in the corresponding `BUILD.gn` in `//third_party/devtools-frontend/src`
|
|
4. Add a reference to the compiled file in `//brave/third_party/devtools-frontend/src/config/gni/sources.gni`
|
|
|
|
### How It Works
|
|
|
|
When `chromium_src/third_party/devtools-frontend/src/scripts/build/typescript/ts_library.py` detects a file starting with `//brave`, it copies this file to the corresponding upstream directory. When the compilation of the corresponding target is done, `ts_library.py` removes the copied file to preserve the upstream sources in their original state.
|
|
|
|
## Patching an Existing File
|
|
|
|
1. Create a patch file in `//brave/chromium_src/third_party/devtools-frontend/src/front_end/{path to the file you want to patch}.ts`
|
|
2. Apply the patch after `SomeClass` declaration in the original file:
|
|
```javascript
|
|
import { PatchSomeClass } from './SomeFile.patch.js'; (SomeClass as any) = PatchSomeClass(SomeClass);
|
|
```
|
|
|
|
### How It Works
|
|
|
|
When `chromium_src/third_party/devtools-frontend/src/scripts/build/typescript/ts_library.py` detects a `chromium_src` counterpart, it copies the file to the corresponding upstream directory (replacing `.ts` with `.patch.ts`). You don't need to add this file in `sources.gni` or `BUILD.gn`. Instead, you should import the `{filename}.patch.js` file (See step #2 above). `chromium_src/third_party/devtools-frontend/src/scripts/build/generate_devtools_grd.py` will automatically add the `.patch.js` file into the resource bundle.
|