Merge "build: Proxy public deps of libperfetto in noop copy for Chrome"
diff --git a/BUILD.gn b/BUILD.gn
index c603a03..7485aee 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -222,16 +222,25 @@
# Rationalize them with eseckler@. For now seems this one is only used from
# chromium and the other one only from the Android tree.
if (build_with_chromium) {
- component("libperfetto") {
- public_configs = [ "gn:public_config" ]
+ # Effectively a no-op copy target, which depends on any targets that generate
+ # headers or files that any dependent target of libperfetto needs. This
+ # indirection allows us to depend on the generation step via libperfetto's
+ # public_deps, but avoid propagating all the public_configs of the individual
+ # proto_library targets - which would bloat the command line arguments with
+ # many superfluous -Igen/third_party/perfetto, and caused windows bots to fail
+ # in the past (due to exceeding cmd line char limits): crbug.com/1043279.
+ # We propgate the include directory via "gn:public_config" instead. Only
+ # "copy" and "action" targets avoid passing on public_configs to their
+ # dependents.
+ # TODO(eseckler): Add an option to proto_library targets to prevent
+ # propagation of configs instead and move these deps back into public_deps of
+ # libperfetto.
+ copy("libperfetto_gen") {
+ # The exact file copied here is irrelevant, we just have to choose an
+ # arbitrary one to make gn happy.
+ sources = [ "OWNERS" ]
+ outputs = [ "${target_gen_dir}/OWNERS" ]
deps = [
- "src/trace_processor:export_json",
- "src/trace_processor:storage_minimal",
- "src/tracing",
- ]
- configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
- public_deps = [
"include/perfetto/ext/trace_processor:export_json",
"include/perfetto/ext/tracing/core",
"include/perfetto/trace_processor:storage",
@@ -243,6 +252,23 @@
"protos/perfetto/trace/track_event:zero",
]
}
+
+ component("libperfetto") {
+ public_configs = [ "gn:public_config" ]
+ deps = [
+ "src/trace_processor:export_json",
+ "src/trace_processor:storage_minimal",
+ "src/tracing",
+ ]
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+ public_deps = [
+ # Public dep so it is run (and all headers generated) before any
+ # dependents are compiled (whose headers might include generated headers).
+ ":libperfetto_gen"
+ ]
+ }
+
component("libtrace_processor") {
public_configs = [ "gn:public_config" ]
deps = [ "src/trace_processor:lib" ]
diff --git a/gn/BUILD.gn b/gn/BUILD.gn
index 7412aa3..a5ae18f 100644
--- a/gn/BUILD.gn
+++ b/gn/BUILD.gn
@@ -139,6 +139,11 @@
# For perfetto_build_flags.h
buildflag_gen_dir_,
+
+ # For generated files (proto libraries etc). We add the include here because
+ # we stop propagation of the configs for individual proto libraries in
+ # the libperfetto target, see comment in //BUILD.gn.
+ "$root_gen_dir/$perfetto_root_path",
]
}