Commit 5fc8c0f
committed
Allowing to apply patches with build.sh
Currently the way the build script works, especially when compiling with Playwright support is that it tries to ensure that the Git worktree is clean, i.e., has no uncommitted changes. This aims to prevent that by accident one ends up in a situation where substantial changes have been made and the build script happily applies the Playwright patches. Reverting them requires a bit of understanding of the underlying build, so we try to safeguard against this.
However, this is at times a bit annoying. One could always set an environment variable to skip the check, but there are situation where that is cumbersome. Consider for example, you'd want to remove the `ChromeOnly` attribute from the [DOMParser.parseFromSafeString()](https://github.com/SAP/project-foxhound/blob/main/dom/webidl/DOMParser.webidl#L30). This is an easy change, but if your memory is as bad as mine remembering in which folder to locate the change when redoing it after an update is annoying. This can be worked around with Git stash trickery, but I feel like we can offer a nicer way to do this. This PR aims to implement the nicer approach.
The core idea is, that you can provide the build script with a sequence of patch files, which are applied before and reverted after a successful build. This ensures your working tree is clean, and allows you to apply changes rather easily.
The workflow now becomes as follows:
1. Remove the troublesome attribute and save the webidl file.
2. `git diff >> ../patches/expose_safe_parse_to_webpages.patch`
3. `FOXHOUND_PATCHES="$(pwd)/../expose_safe_parse_to_webpages.patch" bash build.sh -ap`
Several patches can be passed to `$FOXHOUND_PATCHES` separated by semicolons.
The script tries to ensure that all provided patches exist and errors out if that is not the case or they fail to apply, so it aims to make this as bulletproof as possible.1 parent f093725 commit 5fc8c0f
1 file changed
+61
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
67 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
68 | 110 | | |
69 | 111 | | |
70 | 112 | | |
| |||
213 | 255 | | |
214 | 256 | | |
215 | 257 | | |
216 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
217 | 261 | | |
218 | 262 | | |
219 | 263 | | |
| |||
231 | 275 | | |
232 | 276 | | |
233 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
234 | 282 | | |
235 | 283 | | |
236 | 284 | | |
237 | 285 | | |
238 | 286 | | |
239 | 287 | | |
240 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
241 | 293 | | |
242 | 294 | | |
243 | 295 | | |
| |||
246 | 298 | | |
247 | 299 | | |
248 | 300 | | |
249 | | - | |
| 301 | + | |
250 | 302 | | |
251 | 303 | | |
252 | 304 | | |
| |||
262 | 314 | | |
263 | 315 | | |
264 | 316 | | |
| 317 | + | |
265 | 318 | | |
266 | 319 | | |
267 | 320 | | |
268 | 321 | | |
269 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
270 | 326 | | |
271 | 327 | | |
272 | 328 | | |
273 | 329 | | |
274 | 330 | | |
275 | 331 | | |
276 | 332 | | |
277 | | - | |
| 333 | + | |
278 | 334 | | |
279 | 335 | | |
280 | 336 | | |
| |||
299 | 355 | | |
300 | 356 | | |
301 | 357 | | |
| 358 | + | |
| 359 | + | |
302 | 360 | | |
303 | 361 | | |
304 | 362 | | |
| |||
0 commit comments