# 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_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",
    "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 (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",

    # 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" ]
}

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" ]
  }
}

# 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/core",

      # TODO(eseckler): Create a platform for chrome and hook it up somehow.
      "src/tracing:platform_fake",
    ]
    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 && !is_ios) {
      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",
      ]
    }
  }
  component("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" ]
  }
}
