# 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_heapprofd) {
  all_targets += [
    "src/profiling/memory:heapprofd",
    "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 += [ "tools" ]
}

if (enable_perfetto_unittests) {
  import("gn/perfetto_unittests.gni")
  test("perfetto_unittests") {
    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",
    "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 proto.
    "protos/perfetto/config:merged_config",
    "protos/perfetto/trace:merged_trace",  # For syntax-checking the proto.

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

    # The diff testing framework depends on these descriptors.
    "protos/perfetto/metrics:descriptor",
    "protos/perfetto/trace:descriptor",
    "protos/perfetto/trace:test_extensions_descriptor",

    # 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) {
    all_targets += [ "src/tracing/consumer_api_deprecated:consumer_api_test" ]
  }
}

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

  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 (is_linux || is_android || is_mac) {
      # TODO(primiano): this is here only for Android's iorapd. At some point
      # we need to migrate iorapd to the Perfetto SDK.
      deps += [ "src/tracing/consumer_api_deprecated" ]
    }
  }
}

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