Specifically:
1) Adding a new //tools/typescript/definitions:build_ts ts_library()
target which uses `skipLibCheck=false` and type checks all
definition files once.
2) Making all other ts_library() targets (specifically the ones defined
in build_webui() and webui_ts_library()) to depend on the new
target.
3) Modifying ts_library() to automatically add `skipLibCheck=true`
when
`skipLibCheck` is not specified anywhere in the inheritance chain
AND
no definition files outside of tools/typescript/definitions exist.
4) Also fixed TsLibraryTest.testEnableSourceMaps which was erroneously
passing due to a bug in _read_file() that was always reading from
the same folder, ignoring its input parameter, resulting in
comparing the expected file with itself. The actual file contains
an absolute path embedded in the generated sourcemap and therefore
the comparison needs to be relaxed to work across across machines.
#1 and #2 mitigate any missed type coverage from #3, such that any
TypeScript errors within tools/typescript/definitions/*.d.ts are still
caught during the build.
Essentially this change modifies the build such that some type
checking work that was done by the TS compiler N times (where N=number
of ts_library() targets) is only done once.
Combined with the follow-up related CL this improves TS build times by
~21.5% (43.8s -> 34.4s) on a local Linux build with
`use_remoteexec=false`. This CL alone accounts for the majority of
that improvement (~20% out of 21.5%).
Bug: 397737230
Change-Id: I14bc721e0e2a16ded0d71909d77a8e9b468f3519
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6292793
Auto-Submit: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1425476}