aboutsummaryrefslogtreecommitdiff
path: root/ui/BUILD.gn
diff options
context:
space:
mode:
Diffstat (limited to 'ui/BUILD.gn')
-rw-r--r--ui/BUILD.gn198
1 files changed, 54 insertions, 144 deletions
diff --git a/ui/BUILD.gn b/ui/BUILD.gn
index d7d67a8a8..00cb78875 100644
--- a/ui/BUILD.gn
+++ b/ui/BUILD.gn
@@ -13,6 +13,7 @@
# limitations under the License.
import("../gn/perfetto.gni")
+import("../gn/perfetto_check_build_deps.gni")
import("../gn/wasm.gni")
import("../protos/perfetto/trace_processor/proto_files.gni")
@@ -85,9 +86,7 @@ template("node_bin") {
"outputs",
"depfile",
])
- deps = [
- ":node_modules",
- ]
+ deps = [ ":node_modules" ]
if (defined(invoker.deps)) {
deps += invoker.deps
}
@@ -116,9 +115,7 @@ template("sorcery") {
assert(defined(invoker.input))
assert(defined(invoker.output))
forward_variables_from(invoker, [ "deps" ])
- inputs = [
- invoker.input,
- ]
+ inputs = [ invoker.input ]
outputs = [
invoker.output,
invoker.output + ".map",
@@ -172,49 +169,37 @@ template("bundle") {
# included by the .html files.
bundle("frontend_bundle") {
- deps = [
- ":transpile_all_ts",
- ]
+ deps = [ ":transpile_all_ts" ]
input = "$target_out_dir/frontend/index.js"
output = "$target_out_dir/frontend_bundle.js"
}
bundle("chrome_extension_bundle") {
- deps = [
- ":transpile_all_ts",
- ]
+ deps = [ ":transpile_all_ts" ]
input = "$target_out_dir/chrome_extension/index.js"
output = "$target_out_dir/chrome_extension_bundle.js"
}
bundle("controller_bundle") {
- deps = [
- ":transpile_all_ts",
- ]
+ deps = [ ":transpile_all_ts" ]
input = "$target_out_dir/controller/index.js"
output = "$target_out_dir/controller_bundle.js"
}
bundle("engine_bundle") {
- deps = [
- ":transpile_all_ts",
- ]
+ deps = [ ":transpile_all_ts" ]
input = "$target_out_dir/engine/index.js"
output = "$target_out_dir/engine_bundle.js"
}
bundle("service_worker_bundle") {
- deps = [
- ":transpile_service_worker_ts",
- ]
+ deps = [ ":transpile_service_worker_ts" ]
input = "$target_out_dir/service_worker/service_worker.js"
output = "$target_out_dir/service_worker.js"
}
bundle("query_bundle") {
- deps = [
- ":transpile_all_ts",
- ]
+ deps = [ ":transpile_all_ts" ]
input = "$target_out_dir/query/index.js"
output = "$target_out_dir/query_bundle.js"
}
@@ -228,13 +213,14 @@ node_bin("protos_to_js") {
inputs += [ "../protos/perfetto/trace_processor/$proto.proto" ]
}
inputs += [
+ "../protos/perfetto/common/trace_stats.proto",
+ "../protos/perfetto/common/tracing_service_capabilities.proto",
"../protos/perfetto/config/perfetto_config.proto",
"../protos/perfetto/ipc/consumer_port.proto",
"../protos/perfetto/ipc/wire_protocol.proto",
+ "../protos/perfetto/metrics/metrics.proto",
]
- outputs = [
- "$ui_gen_dir/protos.js",
- ]
+ outputs = [ "$ui_gen_dir/protos.js" ]
node_cmd = "pbjs"
args = [
"-t",
@@ -251,15 +237,9 @@ node_bin("protos_to_js") {
# Protobuf.js requires to first generate .js files from the .proto and then
# create .ts definitions for them.
node_bin("protos_to_ts") {
- deps = [
- ":protos_to_js",
- ]
- inputs = [
- "$ui_gen_dir/protos.js",
- ]
- outputs = [
- "$ui_gen_dir/protos.d.ts",
- ]
+ deps = [ ":protos_to_js" ]
+ inputs = [ "$ui_gen_dir/protos.js" ]
+ outputs = [ "$ui_gen_dir/protos.d.ts" ]
node_cmd = "pbts"
args = [
"-p",
@@ -281,9 +261,7 @@ node_bin("transpile_all_ts") {
":protos_to_ts",
":wasm_gen",
]
- inputs = [
- "tsconfig.json",
- ]
+ inputs = [ "tsconfig.json" ]
outputs = [
"$target_out_dir/frontend/index.js",
"$target_out_dir/engine/index.js",
@@ -323,9 +301,7 @@ node_bin("transpile_service_worker_ts") {
"tsconfig.json",
"src/service_worker/service_worker.ts",
]
- outputs = [
- "$target_out_dir/service_worker/service_worker.js",
- ]
+ outputs = [ "$target_out_dir/service_worker/service_worker.js" ]
node_cmd = "tsc"
args = [
@@ -353,13 +329,9 @@ scss_srcs = [
# Build css.
node_bin("scss") {
- deps = [
- ":dist_symlink",
- ]
+ deps = [ ":dist_symlink" ]
inputs = [ scss_root ] + scss_srcs
- outputs = [
- "$ui_dir/perfetto.css",
- ]
+ outputs = [ "$ui_dir/perfetto.css" ]
node_cmd = "node-sass"
args = [
@@ -373,12 +345,8 @@ node_bin("scss") {
# | Copy rules: create the final output directory. |
# +----------------------------------------------------------------------------+
copy("index_dist") {
- sources = [
- "index.html",
- ]
- outputs = [
- "$ui_dir/index.html",
- ]
+ sources = [ "index.html" ]
+ outputs = [ "$ui_dir/index.html" ]
}
copy("typefaces_dist") {
@@ -391,25 +359,19 @@ copy("typefaces_dist") {
"../buildtools/typefaces/RobotoMono-Regular.woff2",
]
- outputs = [
- "$ui_dir/assets/{{source_file_part}}",
- ]
+ outputs = [ "$ui_dir/assets/{{source_file_part}}" ]
}
copy("query_dist") {
- sources = [
- "query.html",
- ]
- outputs = [
- "$ui_dir/query.html",
- ]
+ sources = [ "query.html" ]
+ outputs = [ "$ui_dir/query.html" ]
}
copy("assets_dist") {
sources = [
- "src/assets/heap_profiler.png",
+ "src/assets/brand.png",
+ "src/assets/favicon.png",
"src/assets/logo-3d.png",
- "src/assets/logo.png",
"src/assets/rec_atrace.png",
"src/assets/rec_battery_counters.png",
"src/assets/rec_board_voltage.png",
@@ -419,75 +381,60 @@ copy("assets_dist") {
"src/assets/rec_cpu_voltage.png",
"src/assets/rec_cpu_wakeup.png",
"src/assets/rec_ftrace.png",
+ "src/assets/rec_java_heap_dump.png",
"src/assets/rec_lmk.png",
"src/assets/rec_logcat.png",
"src/assets/rec_long_trace.png",
"src/assets/rec_mem_hifreq.png",
"src/assets/rec_meminfo.png",
+ "src/assets/rec_native_heap_profiler.png",
"src/assets/rec_one_shot.png",
"src/assets/rec_ps_stats.png",
"src/assets/rec_ring_buf.png",
"src/assets/rec_vmstat.png",
] + [ scss_root ] + scss_srcs
- outputs = [
- "$ui_dir/assets/{{source_file_part}}",
- ]
+ outputs = [ "$ui_dir/assets/{{source_file_part}}" ]
}
copy("chrome_extension_assets_dist") {
sources = [
"src/assets/logo-128.png",
- "src/assets/logo.png",
"src/chrome_extension/manifest.json",
]
- outputs = [
- "$chrome_extension_dir/{{source_file_part}}",
- ]
+ outputs = [ "$chrome_extension_dir/{{source_file_part}}" ]
}
sorcery("frontend_bundle_dist") {
- deps = [
- ":frontend_bundle",
- ]
+ deps = [ ":frontend_bundle" ]
input = "$target_out_dir/frontend_bundle.js"
output = "$ui_dir/frontend_bundle.js"
}
sorcery("chrome_extension_bundle_dist") {
- deps = [
- ":chrome_extension_bundle",
- ]
+ deps = [ ":chrome_extension_bundle" ]
input = "$target_out_dir/chrome_extension_bundle.js"
output = "$chrome_extension_dir/chrome_extension_bundle.js"
}
sorcery("controller_bundle_dist") {
- deps = [
- ":controller_bundle",
- ]
+ deps = [ ":controller_bundle" ]
input = "$target_out_dir/controller_bundle.js"
output = "$ui_dir/controller_bundle.js"
}
sorcery("engine_bundle_dist") {
- deps = [
- ":engine_bundle",
- ]
+ deps = [ ":engine_bundle" ]
input = "$target_out_dir/engine_bundle.js"
output = "$ui_dir/engine_bundle.js"
}
sorcery("service_worker_bundle_dist") {
- deps = [
- ":service_worker_bundle",
- ]
+ deps = [ ":service_worker_bundle" ]
input = "$target_out_dir/service_worker.js"
output = "$ui_dir/service_worker.js"
}
sorcery("query_bundle_dist") {
- deps = [
- ":query_bundle",
- ]
+ deps = [ ":query_bundle" ]
input = "$target_out_dir/query_bundle.js"
output = "$ui_dir/query_bundle.js"
}
@@ -501,9 +448,7 @@ copy("wasm_dist") {
"$root_build_dir/wasm/trace_processor.wasm",
"$root_build_dir/wasm/trace_to_text.wasm",
]
- outputs = [
- "$ui_dir/{{source_file_part}}",
- ]
+ outputs = [ "$ui_dir/{{source_file_part}}" ]
}
copy("wasm_gen") {
@@ -537,9 +482,7 @@ copy("wasm_gen") {
"$root_build_dir/wasm/trace_to_text.wasm.map",
]
}
- outputs = [
- "$ui_gen_dir/{{source_file_part}}",
- ]
+ outputs = [ "$ui_gen_dir/{{source_file_part}}" ]
}
# Copy over the vulcanized legacy trace viewer.
@@ -548,35 +491,22 @@ copy("catapult_dist") {
"../buildtools/catapult_trace_viewer/catapult_trace_viewer.html",
"../buildtools/catapult_trace_viewer/catapult_trace_viewer.js",
]
- outputs = [
- "$ui_dir/assets/{{source_file_part}}",
- ]
+ outputs = [ "$ui_dir/assets/{{source_file_part}}" ]
}
# +----------------------------------------------------------------------------+
# | Node JS: Creates a symlink in the out directory to node_modules. |
# +----------------------------------------------------------------------------+
-action("check_node_exists") {
- script = "../gn/standalone/check_buildtool_exists.py"
- args = [
- nodejs_bin,
- "--touch",
- rebase_path("$target_out_dir/node_exists", ""),
- ]
- inputs = []
- outputs = [
- "$target_out_dir/node_exists",
- ]
+perfetto_check_build_deps("check_ui_deps") {
+ args = [ "--ui" ]
+ inputs = [ "package-lock.json" ]
}
# Creates a symlink from out/xxx/ui/node_modules -> ../../../ui/node_modules.
# This allows to run rollup and other node tools from the out/xxx directory.
action("node_modules_symlink") {
- deps = [
- ":check_node_exists",
- ]
-
+ deps = [ ":check_ui_deps" ]
script = "../gn/standalone/build_tool_wrapper.py"
stamp_file = "$target_out_dir/.$target_name.stamp"
args = [
@@ -587,15 +517,11 @@ action("node_modules_symlink") {
rebase_path("node_modules", target_out_dir),
rebase_path("$target_out_dir/node_modules", root_build_dir),
]
- outputs = [
- stamp_file,
- ]
+ outputs = [ stamp_file ]
}
group("node_modules") {
- deps = [
- ":node_modules_symlink",
- ]
+ deps = [ ":node_modules_symlink" ]
}
# Creates a symlink from //ui/dist -> ../../out/xxx/ui. Used only for
@@ -613,12 +539,8 @@ action("dist_symlink") {
rebase_path(target_out_dir, "."),
rebase_path("dist", root_build_dir),
]
- inputs = [
- "$root_build_dir",
- ]
- outputs = [
- stamp_file,
- ]
+ inputs = [ "$root_build_dir" ]
+ outputs = [ stamp_file ]
}
group("test_scripts") {
@@ -629,21 +551,13 @@ group("test_scripts") {
}
copy("copy_unittests_script") {
- sources = [
- "config/ui_unittests_template",
- ]
- outputs = [
- "$root_build_dir/ui_unittests",
- ]
+ sources = [ "config/ui_unittests_template" ]
+ outputs = [ "$root_build_dir/ui_unittests" ]
}
copy("copy_tests_script") {
- sources = [
- "config/ui_tests_template",
- ]
- outputs = [
- "$root_build_dir/ui_tests",
- ]
+ sources = [ "config/ui_tests_template" ]
+ outputs = [ "$root_build_dir/ui_tests" ]
}
# This target generates an map containing all the UI subresources and their
@@ -659,14 +573,10 @@ action("gen_dist_file_map") {
dist_files += [ rebase_path(dist_file, root_build_dir) ]
}
}
- deps = [
- ":dist",
- ]
+ deps = [ ":dist" ]
script = "../gn/standalone/write_ui_dist_file_map.py"
inputs = []
- outputs = [
- out_file_path,
- ]
+ outputs = [ out_file_path ]
args = [
"--out",
rebase_path(out_file_path, root_build_dir),