# Copyright (C) 2017 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("gn/perfetto.gni")
import("gn/test.gni")

# +----------------------------------------------------------------------------+
# | "all" targets definition: defines targets reachable by the various configs |
# +----------------------------------------------------------------------------+
# There is a subtletly here related with chromium and other GN embedders.
# When adding a dependency some_dir/:target_name, some_dir/BUILD.gn is
# "discovered". As a side effect any *other* target defined in some_dir/BUILD.gn
# (and its transitive dependencies) becomes implicitly part of the "default"
# target, the one invoked running ninja -C out/xxx without further args.
# Because of this, care must be taken to wrap dependencies to targets in other
# build files with if (enable_xxx) flags. Accidentally including a harmless
# target that happens to be defined in the same BUILD.gn that contains targets
# incompatible with the chromium build will cause build/roll failures.

all_targets = [ "protos/perfetto/trace:perfetto_trace_protos" ]

if (enable_perfetto_platform_services) {
  all_targets += [
    "src/perfetto_cmd:perfetto",
    "src/perfetto_cmd:trigger_perfetto",
    "src/traced/service:traced",
  ]
  if (enable_perfetto_traced_probes) {
    all_targets += [ "src/traced/probes:traced_probes" ]
  }
  if (enable_perfetto_traced_relay) {
    all_targets += [ "src/traced_relay:traced_relay" ]
  }
}

if (enable_perfetto_trace_processor && enable_perfetto_trace_processor_sqlite) {
  all_targets += [ "src/trace_processor:trace_processor_shell" ]
}

if (enable_perfetto_traceconv) {
  all_targets += [ "src/traceconv" ]
  if (is_cross_compiling) {
    # In many cross-compilation scenarios (typically Android) developers expect
    # the host version of traceconv to be available somewhere in out/, so
    # they can convert Android traces on their dev machine. Also
    # tools/gen_android_bp explicitly depends on the host version for the
    # cc_binary_host("traceconv") target in Android.bp.
    # Note that when cross-compiling the host executable will be available in
    # out/xxx/gcc_like_host/traceconv NOT just out/xxx/traceconv.
    all_targets += [ "src/traceconv($host_toolchain)" ]
  }
}

if (enable_perfetto_heapprofd) {
  all_targets += [ "src/profiling/memory:heapprofd" ]

  if (is_linux && !is_android) {
    all_targets += [ "src/profiling/memory:heapprofd_glibc_preload" ]
  }
  if (perfetto_build_with_android) {
    all_targets += [
      "src/profiling/memory:heapprofd_client",
      "src/profiling/memory:heapprofd_client_api",
    ]
  }
}

if (enable_perfetto_traced_perf) {
  all_targets += [ "src/profiling/perf:traced_perf" ]
}

if (perfetto_build_with_android) {
  all_targets += [ "src/android_internal:libperfetto_android_internal" ]
}

if (enable_perfetto_tools) {
  all_targets += [ "src/tools" ]

  # Windows does not have an IPC implementation.
  if (!is_win) {
    all_targets += [ "src/websocket_bridge" ]
  }
}

if (enable_perfetto_unittests) {
  import("gn/perfetto_unittests.gni")
  test("perfetto_unittests") {
    if (is_fuchsia) {
      additional_manifest_fragments =
          [ "//build/config/fuchsia/test/network.shard.test-cml" ]
    }
    deps = perfetto_unittests_targets
  }
  all_targets += [ ":perfetto_unittests" ]
}

if (enable_perfetto_integration_tests) {
  import("gn/perfetto_integrationtests.gni")
  test("perfetto_integrationtests") {
    deps = perfetto_integrationtests_targets
  }
  all_targets += [
    ":perfetto_integrationtests",
    "examples/sdk:sdk_example",
    "test:client_api_example",
    "test/stress_test",
  ]
  if (!is_win && !is_mac) {
    all_targets += [
      "examples/shared_lib:example_shlib_data_source",
      "examples/shared_lib:example_shlib_track_event",
    ]
  }
}

if (enable_perfetto_trace_processor_json) {
  test("trace_processor_minimal_smoke_tests") {
    testonly = true
    deps = [
      "gn:default_deps",
      "src/trace_processor:storage_minimal_smoke_tests",
    ]
  }
  all_targets += [ ":trace_processor_minimal_smoke_tests" ]
}

if (enable_perfetto_benchmarks) {
  import("gn/perfetto_benchmarks.gni")
  executable("perfetto_benchmarks") {
    testonly = true
    deps = perfetto_benchmarks_targets
  }
  all_targets += [ ":perfetto_benchmarks" ]
}

if (enable_perfetto_fuzzers) {
  import("gn/perfetto_fuzzers.gni")
  group("fuzzers") {
    testonly = true
    deps = perfetto_fuzzers_targets
  }
  all_targets += [ ":fuzzers" ]
}

# Less interesting stuff that makes sense only in the standalone build, mainly
# compile-time checks for the CI.
if (perfetto_build_standalone) {
  all_targets += [
    "test/configs",

    # Used to evaluate the Python folder for Bazel script generation.
    "python:trace_processor_py",

    # For syntax-checking the protos.
    "protos/perfetto/trace:merged_trace_lite",

    # For checking all generated xxx.gen.{cc,h} files without waiting for
    # embedders to try to use them and fail.
    "protos/perfetto/config:cpp",
    "protos/perfetto/common:cpp",

    # Used in the when updating the ftrace protos
    "protos/perfetto/trace/ftrace:descriptor",

    # Checks that the "fake" backend implementations build.
    "src/tracing:client_api_no_backends_compile_test",
  ]
  if (is_linux || is_android || is_mac) {
    all_targets += [ "src/tracebox" ]
  }
}

# The CTS code is built (but not ran) also in standalone builds. This is to
# catch refactoring breakages earlier without having to wait for treehugger.
if (is_android && (perfetto_build_standalone || perfetto_build_with_android)) {
  all_targets += [ "test/cts:perfetto_cts_deps" ]
  all_targets += [ "test/vts:perfetto_vts_deps" ]
}

group("all") {
  testonly = true  # allow to build also test targets
  deps = all_targets
}

# This target is used when running ninja without any argument (by default would
# build all reachable targets). This is mainly used to prevent the UI being
# built when running ninja -C out/xxx.
# This has effect only in standalone builds, no effect on chromium builds.
# Chromium's "all" target depends on our "all" target above. However chromium's
# "default" target depends on any target that we cause to be discovered by
# depending on other GN files.
group("default") {
  testonly = true
  deps = [ ":all" ]
}

# +----------------------------------------------------------------------------+
# | Other definitions: root targets that don't belong to any other subdirectory|
# +----------------------------------------------------------------------------+

if (enable_perfetto_ui) {
  group("ui") {
    deps = [ "ui" ]
  }
}

if (enable_perfetto_site) {
  group("site") {
    deps = [ "infra/perfetto.dev:site" ]
  }
}

# In Android builds, we build the code of traced and traced_probes in one shared
# library that exposes one xxx_main() for each. The executables themselves are
# tiny shells that just invoke their own entry point into the library.
# This is done merely for saving binary size, because the three binaries happen
# to share a lot of code.
# When setting monolithic_binaries=true (only supported in standalone builds)
# it builds more conventional executables, where each binary has the full
# implementation and no shared library dependency. This is to make dev cycles
# on Android faster, avoiding all the LD_LIBRARY_PATH boilerplate.
# libperfetto.so is also used for stuff that is exposed to the rest of the
# Android tree.
if (enable_perfetto_platform_services) {
  if (monolithic_binaries) {
    libperfetto_target_type = "static_library"
  } else {
    libperfetto_target_type = "shared_library"
  }

  target(libperfetto_target_type, "libperfetto") {
    if (libperfetto_target_type == "static_library") {
      complete_static_lib = true
    }
    deps = [
      "gn:default_deps",
      "src/traced/service",
    ]
    if (enable_perfetto_traced_probes) {
      deps += [ "src/traced/probes" ]
    }
  }
}

if (!build_with_chromium) {
  # Client library target exposed to the Android tree.
  # Still in experimental stage and not API stable yet.
  # See "libperfetto_client_example" (in Android.bp.extras) for an example
  # on how to use the Perfetto Client API from the android tree.
  static_library("libperfetto_client_experimental") {
    complete_static_lib = true
    public_deps = [
      "gn:default_deps",
      "src/tracing:client_api",
      "src/tracing:platform_impl",
    ]
    sources = [ "include/perfetto/tracing.h" ]
    assert_no_deps = [ "//gn:protobuf_lite" ]
  }
}

# TODO(primiano): there seem to be two "libperfetto" and one
# "libperfetto_client_experimental" targets defined within this BUILD.gn file.
# 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" ]
    deps = [
      "src/trace_processor/importers/memory_tracker:graph_processor",
      "src/tracing:client_api",
      "src/tracing:platform_impl",
      "src/tracing/core",
    ]
    configs -= [ "//build/config/compiler:chromium_code" ]
    configs += [ "//build/config/compiler:no_chromium_code" ]
    public_deps = [
      "include/perfetto/ext/trace_processor/importers/memory_tracker",
      "include/perfetto/ext/tracing/core",
      "include/perfetto/tracing",
      "protos/perfetto/common:zero",
      "protos/perfetto/trace:zero",
      "protos/perfetto/trace/chrome:zero",
      "protos/perfetto/trace/interned_data:zero",
      "protos/perfetto/trace/profiling:zero",
      "protos/perfetto/trace/ps:zero",
      "protos/perfetto/trace/track_event:zero",
    ]
    if (enable_perfetto_ipc) {
      deps += [
        "src/tracing/ipc/producer",
        "src/tracing/ipc/service",
      ]
      public_deps += [ "include/perfetto/ext/tracing/ipc:ipc" ]
    }
    if (!is_nacl) {
      deps += [
        "src/trace_processor:export_json",
        "src/trace_processor:storage_minimal",
      ]
      public_deps += [
        "include/perfetto/ext/trace_processor:export_json",
        "include/perfetto/trace_processor:storage",
      ]
    }
  }

  # In Chromium, we want to ensure that we don't link dynamically against sqlite
  # (as Chromium also uses a more restricted version of sqlite which is actually
  # shipped to the users).
  # static_library helps us to achieve that.
  static_library("libtrace_processor") {
    public_configs = [ "gn:public_config" ]
    deps = [ "src/trace_processor:lib" ]
    configs -= [ "//build/config/compiler:chromium_code" ]
    configs += [ "//build/config/compiler:no_chromium_code" ]
    public_deps = [ "include/perfetto/trace_processor" ]
  }
  component("perfetto_test_support") {
    testonly = true
    public_configs = [ "gn:public_config" ]
    configs -= [ "//build/config/compiler:chromium_code" ]
    configs += [ "//build/config/compiler:no_chromium_code" ]
    public_deps = [ "include/perfetto/test:test_support" ]
    deps = [ "src/tracing/test:test_support" ]
  }
}
