|
|
|
|
|
by freedomben
853 days ago
|
|
Unrelated but about Brave and interesting to me: I recently found myself having a large upstream project that I need to maintain some custom patches for, and there's a need for deeper customizations and I worry that my rudimentary system of applying .patch files will turn into an unmaintainable nightmare of merge conflicts after every rebase. I was thinking about possible solutions, and it occurred to me that Brave being Chromium-based must have this same challenge but an order of magnitude more difficult, so I looked for their code to see how they solved this issue. It's pretty interesting! They do basically the same thing for core Chromium, applying a (big) set of patches[1]. Incidentally, I'd be interested to hear any ideas/approaches to this problem. I'm guessing if there was something clearly better, Brave would be doing it, but it seems like there should be a better way even if I can't think of one. [1] https://github.com/brave/brave-core/tree/master/patches |
|
What you'll notice more often is a folder we have called `chromium_src`. This directory mirrors the directory structure for Chromium under `src` and the build system will look for matches. If there's a file with the same name under `chromium_src`, it'll prefer that one. That file then does what it needs to differently and then includes the original file.
This approach helps keep things much more lightweight - but it has challenges too. If code fails to apply (file that `chromium_src` is matching gets renamed, etc) it can be hard to detect. This is where you'd want to have a test to catch that.
Another person shared - but here's a link to our patching documentation: https://github.com/brave/brave-browser/wiki/Patching-Chromiu...
You'll notice the actual patching itself is introduced with the caveat: