Files
react-native-devtools-frontend/scripts/build/ninja/devtools_module.gni
T
Tim van der Lippe b391dcebc9 Add files generated in gen/front_end to runtime_deps
The previous attempt of this fix was in https://crrev.com/c/2687497
That CL was reverted, as it inadvertently added more files to the
runtime_deps then was intended. Most notably, it erroneously included
`tsconfig.json`, `tsbuildinfo` and `d.ts` files.

Instead, we should manually filter out only those files that we are
interested in. In this case, these are the `js` and `js.map` files.
Once these are added to the runtime_deps, the layout tests can access
them, as they are pushed to the bots.

I have verified that the following command shows the expected output:

gn desc out/Default front_end/platform:bundle runtime_deps

R=jacktfranklin@chromium.org

Bug: 1174013
Change-Id: I6bc25665f06b5968bbd9748696a5723edac84ddc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2697201
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-02-16 15:53:01 +00:00

72 lines
2.3 KiB
Plaintext

# Copyright 2020 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("../../../all_devtools_modules.gni")
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"
_devtools_module_deps = [ _typescript_target_dep ]
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
}
if (is_debug) {
_copy_target_name = target_name + "-copy"
_devtools_module_deps += [ ":$_copy_target_name" ]
copy_gen_to_resources(_copy_target_name) {
sources = filter_include(get_target_outputs(_typescript_target_dep),
[
"*.js",
"*.map",
])
public_deps = [ _typescript_target_dep ]
visibility = invoker.visibility + [ ":*" ]
}
_target_outputs = get_target_outputs(":" + _copy_target_name + "-copy")
_filtered_target_outputs =
filter_exclude(
filter_exclude(_target_outputs, generated_typescript_modules),
[ "*.map" ])
assert(
_filtered_target_outputs == [],
"$_filtered_target_outputs are not listed in all_typescript_module_sources")
}
group(target_name) {
public_deps = _devtools_module_deps
visibility = invoker.visibility + [ ":*" ]
data = filter_include(get_target_outputs(_typescript_target_dep),
[
"*.js",
"*.map",
])
}
}
set_defaults("devtools_module") {
visibility = []
}