Hash :
961788fd
Author :
Date :
2023-05-05T11:35:38
Capture/Replay: reorganize trace-related gni
Move trace-related code from gni/angle.gni to
src/tests/angle_traces.gni
Rename template angle_trace_library to angle_trace_libs as the idea is
for it to build multiple libs.
Name outside-of-apk lib group ${target_name}__unpacked_libs which is
more consistent with how targets are usually named in gn, and makes the
dependency explicitly tied to template instantiation.
Bug: b/276474703
Change-Id: I316f2a549063b8ebae177f4ffc0d4a8de1942384
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4508387
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Commit-Queue: Roman Lavrov <romanl@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
# Copyright 2023 The ANGLE Project 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("../../gni/angle.gni")
template("angle_trace") {
angle_shared_library(target_name) {
testonly = true
# Similar to capture replay sample, use the file index for sources
sources = invoker.sources
data = invoker.data
defines = [ "ANGLE_REPLAY_IMPLEMENTATION" ]
suppressed_configs += [ "$angle_root:constructor_and_destructor_warnings" ]
deps = [
"$angle_root/util:angle_trace_fixture",
"$angle_root/util:angle_trace_loader",
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
if (is_android) {
libs = [ "log" ]
}
# Disable optimization in the trace perf tests to avoid optimizing huge files.
if (!is_debug && !is_ubsan) {
suppressed_configs += [
"//build/config/compiler:afdo",
"//build/config/compiler:afdo_optimize_size",
"//build/config/compiler:default_optimization",
"//build/config/compiler/pgo:default_pgo_flags",
]
configs += [ "//build/config/compiler:no_optimize" ]
}
include_dirs = [ "." ]
if (defined(invoker.output_name)) {
output_name = invoker.output_name
}
}
}
set_defaults("angle_trace_libs") {
# Uses a short name to work around file path limits on Windows.
short_names = false
}
template("angle_trace_libs") {
_trace_targets = []
_trace_lib_files = []
if (invoker.short_names) {
_trace_counter = 1
}
if (is_android && is_component_build) {
_cr_suffix = ".cr"
} else {
_cr_suffix = ""
}
foreach(_trace_and_version, invoker.trace_list) {
_trace_and_version_arr = []
_trace_and_version_arr = string_split(_trace_and_version)
_trace = _trace_and_version_arr[0]
if (defined(invoker.trace_dir)) {
_trace_dir = invoker.trace_dir
} else {
_trace_dir = _trace
}
_trace_json_path = "$_trace_dir/$_trace.json"
_trace_data = []
_trace_data = read_file(_trace_json_path, "json")
if (invoker.short_names) {
_target = "cr_trace_${_trace_counter}"
_trace_counter += 1
} else {
_target = "${target_name}_$_trace"
}
_gen_target = "gen${target_name}_$_trace"
action(_gen_target) {
script = "//scripts/tracegz.py"
args = [
_trace,
rebase_path(_trace_dir, root_build_dir),
]
outputs = [ "$root_gen_dir/tracegz_$_trace.gz" ]
}
angle_trace(_target) {
sources = rebase_path(_trace_data.TraceFiles, ".", _trace_dir)
data = [
"$_trace_dir/$_trace.json",
"$_trace_dir/$_trace.angledata.gz",
"$root_gen_dir/tracegz_$_trace.gz",
]
deps = [ ":$_gen_target" ]
if (invoker.short_names) {
output_name = _trace
}
}
_trace_targets += [ ":$_target" ]
_trace_lib_files += [ "${root_out_dir}/lib${_target}${_cr_suffix}.so" ]
}
angle_shared_library(target_name) {
testonly = true
data = [ invoker.json_path ]
data_deps = _trace_targets
deps = [ "$angle_root:angle_common" ]
public_deps = [ "$angle_root/util:angle_trace_loader" ]
}
if (restricted_traces_outside_of_apk) {
group("${target_name}__unpacked_libs") {
testonly = true
deps = [
":angle_restricted_traces",
"$angle_root/util:angle_trace_interpreter",
]
# Also need files listed as data to be picked up by isolate
data = _trace_lib_files +
[ "${root_out_dir}/libangle_trace_interpreter${_cr_suffix}.so" ]
}
}
}