Merge "trace_processor: migrate stack profile mapping to new db tables"
diff --git a/BUILD b/BUILD
index 453bfd1..504f825 100644
--- a/BUILD
+++ b/BUILD
@@ -115,7 +115,6 @@
 perfetto_cc_binary(
     name = "client_api_example",
     srcs = [
-        "include/perfetto/tracing.h",
         "test/client_api_example.cc",
         ":include_perfetto_base_base",
         ":include_perfetto_protozero_protozero",
@@ -2413,7 +2412,6 @@
 perfetto_cc_library(
     name = "libperfetto_client_experimental",
     srcs = [
-        "include/perfetto/tracing.h",
         ":src_base_base",
         ":src_base_unix_socket",
         ":src_ipc_ipc",
@@ -2434,6 +2432,7 @@
         ":include_perfetto_tracing_core_core",
         ":include_perfetto_tracing_core_forward_decls",
         ":include_perfetto_tracing_tracing",
+        "include/perfetto/tracing.h",
     ],
     visibility = [
         "//visibility:public",
diff --git a/gn/perfetto_host_executable.gni b/gn/perfetto_host_executable.gni
index ccadc2e..55edc9a 100644
--- a/gn/perfetto_host_executable.gni
+++ b/gn/perfetto_host_executable.gni
@@ -29,10 +29,11 @@
     not_needed(invoker, "*", [ "testonly" ])
     _host_target = ":$target_name($host_toolchain)"
     _testonly = defined(invoker.testonly) && invoker.testonly
-    if (perfetto_build_with_embedder || is_perfetto_build_generator) {
-      # Don't copy anythin in Chromium, just add a dependency to the host
-      # target. V8 and other GN embedder builds. This causes problems on
-      # some bot (see crbug.com/1002599).
+    if ((perfetto_build_with_embedder && !build_with_chromium) ||
+        is_perfetto_build_generator) {
+      # Don't copy anything in V8 and other GN embedder builds, just add a
+      # dependency to the host target. This causes problems on some bots.
+      # (See crbug.com/1002599).
       group(target_name) {
         testonly = _testonly
         deps = [
@@ -46,11 +47,15 @@
           _host_target,
         ]
         _host_out_dir = get_label_info(_host_target, "root_out_dir")
+        _extension = ""
+        if (host_os == "win") {
+          _extension = ".exe"
+        }
         sources = [
-          "$_host_out_dir/$target_name",
+          "$_host_out_dir/$target_name${_extension}",
         ]
         outputs = [
-          "$root_out_dir/$target_name",
+          "$root_out_dir/$target_name${_extension}",
         ]
       }
     }
diff --git a/test/BUILD.gn b/test/BUILD.gn
index f3dc459..3388f02 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -55,7 +55,6 @@
 
 executable("client_api_example") {
   sources = [
-    "../include/perfetto/tracing.h",
     "client_api_example.cc",
   ]
   deps = [
diff --git a/tools/gen_bazel b/tools/gen_bazel
index fa8d058..cad0fea 100755
--- a/tools/gen_bazel
+++ b/tools/gen_bazel
@@ -306,7 +306,13 @@
 
   label = BazelLabel(get_bazel_label_name(gn_target.name), bazel_type)
   label.comment = gn_target.name
-  label.srcs = [x[2:] for x in gn_target.sources]
+
+  raw_srcs = [x[2:] for x in gn_target.sources]
+  if bazel_type == 'perfetto_cc_library':
+    label.srcs = [x for x in raw_srcs if not x.startswith('include')]
+    label.hdrs = [x for x in raw_srcs if x.startswith('include')]
+  else:
+    label.srcs = raw_srcs
 
   if gn_target.name in public_targets:
     label.visibility = ['//visibility:public']