mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-03 02:21:05 +08:00
The previous attempt was wrong, as it wasn't correctly rebuilding dependents if a breaking TypeScript API change was made. The root cause for that is the split of `devtools_entrypoint` and `devtools_module`, which we need for bundling. Unfortunately, we also can't introduce granular GN targets for only `.d.ts` files, since TypeScript generates all outputs in 1 go. Therefore, it is not possible to split that up into multiple scripts, which is required if we want to introduce targets with outputs for only `.d.ts`. Instead, we should still reset timestamps for `devtools_module`, but then we always rebuild `devtools_entrypoint`. By doing that, a breaking API change in a `devtools_module` would trigger its corresponding `devtools_entrypoint` to change, which will ensure that all its dependents also change. However, the next layer of `devtools_module` will then detect that it doesn't change, hence introducing the performance improvement. So while we are still doing a bit too much work in theory, in practice this change already removes a whole bunch of unnecessary work. I think that is a step in the right direction and this should result in deterministic builds as well. DISABLE_THIRD_PARTY_CHECK=Update TypeScript infrastructure R=jacktfranklin@chromium.org CC=marijnh@gmail.com Bug: 1237438 Change-Id: Ib8ea10ee8df263f0dddf0918bc1732fd696f1105 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3107130 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
54 lines
1.6 KiB
Plaintext
54 lines
1.6 KiB
Plaintext
# Copyright 2021 The Chromium Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
import("../../../third_party/typescript/typescript.gni")
|
|
import("./copy.gni")
|
|
import("./vars.gni")
|
|
|
|
template("devtools_module") {
|
|
_typescript_target_name = target_name + "-typescript"
|
|
_typescript_target_dep = ":$_typescript_target_name"
|
|
|
|
ts_library(_typescript_target_name) {
|
|
forward_variables_from(invoker,
|
|
[
|
|
"sources",
|
|
"deps",
|
|
])
|
|
|
|
# To make sure that this target can be depended upon by other TypeScript targets,
|
|
# we have to name it the `target_name`. However, we can't name this `ts_library` the
|
|
# `target_name`, as the buildgraph requires the `copy_gen__to_resources` to happen *after*
|
|
# `ts_library` is finished.
|
|
typescript_config_name = invoker.target_name
|
|
|
|
reset_timestamps = true
|
|
|
|
visibility += [ ":*" ]
|
|
}
|
|
_target_outputs = get_target_outputs(_typescript_target_dep)
|
|
_javascript_implementation_files =
|
|
filter_include(_target_outputs + invoker.data, [ "*.js" ])
|
|
|
|
group(target_name) {
|
|
public_deps = [ _typescript_target_dep ] + invoker.public_deps
|
|
|
|
visibility = invoker.visibility + [ ":*" ]
|
|
|
|
data = _javascript_implementation_files +
|
|
filter_include(invoker.data + _target_outputs, [ "*.map" ])
|
|
if (is_debug) {
|
|
metadata = {
|
|
grd_files = _javascript_implementation_files
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
set_defaults("devtools_module") {
|
|
visibility = []
|
|
data = []
|
|
public_deps = []
|
|
}
|