mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-11 14:14:36 +08:00
The output of .tsbuildinfo files is non-deterministic (https://github.com/microsoft/TypeScript/issues/37156) which has caused the Chromium Deterministic Builder to break. The issue in the file is that arrays and keys in dictionaries are not sorted. As a workaround to this issue, we had to remove the `.tsbuildinfo` files from the outputs of the `ts_library`. However, this has caused new (albeit expected) issues where the TypeScript compiler breaks for consecutive builds if a Chromium engineer ran `ninja clean`. To make `ninja clean` happy, we need to include the `.tsbuildinfo` in our outputs. This fixes the issue with consecutive builds failing. However, this would then break the deterministic builder again. As a last resort, we now post-process the tsbuildinfo files after the invocation to `tsc` and force all arrays and dictionaries to be sorted. Testing with the TypeScript compiler has shown that this has no effect on its behavior, as it implicitly does a `json.read`. Since json does not have a defined ordering, the TypeScript compiler will not break. I have personally ran several builds and confirmed that both keys and arrays are sorted as intended. Bug: 1054494 Change-Id: I352dfc56bb7e4dde27af87fcbe62a36717329d13 Fixed: 1058578 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2091448 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Reviewed-by: Paul Lewis <aerotwist@chromium.org>