# 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("//build_overrides/build.gni")
import("../../gn/fuzzer.gni")
import("../../gn/perfetto.gni")
import("../../gn/test.gni")

# Full version of the client API. Supports both the in-process backend and the
# system backend (on posix systems and if enabled by the enable_perfetto_ipc).
# The backends are designed to be dead-code-eliminated via linker's gc-section
# when not use. See comments in Tracing::Initialize() in tracing.h.
group("client_api") {
  public_deps = [
    ":client_api_without_backends",
    ":in_process_backend",
    "../../gn:default_deps",
    "../../include/perfetto/tracing",
    "../../include/perfetto/tracing/core",
  ]
  if (enable_perfetto_ipc) {
    public_deps += [ ":system_backend" ]
  } else {
    public_deps += [ ":system_backend_fake" ]
  }
}

# This target checks that the client API builds without backends. This is to
# check that no references to the backends are leaked from the implementation
# internals. In turn, this allows to dead-code-eliminate unused backends when
# using linker's gc-sections (or similar mechanism).
if (perfetto_build_standalone) {
  shared_library("client_api_no_backends_compile_test") {
    deps = [
      ":client_api_without_backends",
      ":platform_fake",
      "../../gn:default_deps",
    ]
  }
}

# Separate target because the embedder might not want this.
source_set("platform_impl") {
  deps = [
    "../../gn:default_deps",
    "../../include/perfetto/tracing",
    "../base",
  ]
  sources = [
    "platform_posix.cc",
    "platform_windows.cc",
  ]
}

# Fake platform that allows buiding the client lib on all OSes. You can only use
# those parts of the client lib that do not use the platform.
source_set("platform_fake") {
  deps = [
    "../../gn:default_deps",
    "../../include/perfetto/tracing",
  ]
  sources = [ "platform_fake.cc" ]
}

# Code that both public headers and other non-public sources (e.g.
# src/tracing/core) need to depend on. It cannot be in the root :tracing target
# otherwise there would be a cyclic dependency because public itself needs to
# depend on tracing.
source_set("common") {
  deps = [
    "../../gn:default_deps",
    "../../include/perfetto/tracing",
  ]
  sources = [ "trace_writer_base.cc" ]
}

# Base target for the client API. On its own doesn't provide any backend other
# than the unsupported one.
source_set("client_api_without_backends") {
  deps = [
    "../../include/perfetto/tracing/core",
    "../../protos/perfetto/common:zero",
    "../../protos/perfetto/config:cpp",
    "../../protos/perfetto/config/interceptors:zero",
    "../../protos/perfetto/config/track_event:cpp",
    "../base",
    "core",
  ]
  public_deps = [
    "../../gn:default_deps",
    "../../include/perfetto/tracing",
  ]
  sources = [
    "console_interceptor.cc",
    "data_source.cc",
    "debug_annotation.cc",
    "event_context.cc",
    "interceptor.cc",
    "internal/checked_scope.cc",
    "internal/interceptor_trace_writer.cc",
    "internal/tracing_backend_fake.cc",
    "internal/tracing_muxer_fake.cc",
    "internal/tracing_muxer_fake.h",
    "internal/tracing_muxer_impl.cc",
    "internal/tracing_muxer_impl.h",
    "internal/track_event_internal.cc",
    "internal/track_event_interned_fields.cc",
    "platform.cc",
    "traced_value.cc",
    "tracing.cc",
    "tracing_policy.cc",
    "track.cc",
    "track_event_category_registry.cc",
    "track_event_legacy.cc",
    "track_event_state_tracker.cc",
    "virtual_destructors.cc",
  ]
  assert_no_deps = [ "core:service" ]
  if (enable_perfetto_ipc) {
    assert_no_deps += [
      "../ipc:common",
      "ipc/common",
    ]
  }
}

perfetto_unittest_source_set("unittests") {
  testonly = true
  deps = [
    "../../gn:default_deps",
    "../../gn:gtest_and_gmock",
    "../../protos/perfetto/trace:lite",
    "../../protos/perfetto/trace/track_event:lite",
    "../base",
    "../base:test_support",
    "test:test_support",
  ]

  sources = []

  # TODO(primiano): remove the build_with_chromium conditional once the root
  # //BUILD.gn:libperfetto (in chromium) stops adding tracing:platform_fake.
  # The problem is the following: in chrome builds we end up with duplicate
  # symbol definitions in the test because both platforms (impl and fake) are
  # present: impl added here and fake coming from chromium's base (full path:
  # perfetto_unittests -> //(chromium)base:test_support -> //(chromium)base
  # -> libperfetto -> platform_fake.
  if (!build_with_chromium) {
    deps += [
      ":client_api_without_backends",
      ":platform_impl",
    ]

    sources += [
      "internal/interceptor_trace_writer_unittest.cc",
      "traced_proto_unittest.cc",
      "traced_value_unittest.cc",
    ]
  }
}

# System backend: connects to an external "traced" instance via a UNIX socket.
# Requires the IPC layer and is supported only on posix systems.
if (enable_perfetto_ipc) {
  source_set("system_backend") {
    public_deps = [ "../../include/perfetto/tracing" ]
    deps = [
      ":client_api_without_backends",
      "../../gn:default_deps",
      "../../include/perfetto/tracing/core",
      "../base",
      "ipc:common",
      "ipc/consumer",
      "ipc/producer",
      "ipc/service",
    ]
    sources = [ "internal/system_tracing_backend.cc" ]
  }
} else {
  source_set("system_backend_fake") {
    public_deps = [ "../../include/perfetto/tracing" ]
    deps = [
      "../../gn:default_deps",
      "../base",
    ]
    sources = [ "internal/system_tracing_backend_fake.cc" ]
  }
}

# In-process backend: starts the tracing service in-process on a dedicated
# thread. It depends only on having a valid "platform" target. It has a larger
# binary size cost because links in all the service code.
source_set("in_process_backend") {
  public_deps = [ "../../include/perfetto/tracing" ]
  deps = [
    ":client_api_without_backends",
    "../../gn:default_deps",
    "../../include/perfetto/tracing/core",
    "../base",
    "core:service",
  ]
  sources = [ "internal/in_process_tracing_backend.cc" ]
}

if (enable_perfetto_benchmarks) {
  source_set("benchmarks") {
    testonly = true
    deps = [
      ":platform_impl",
      "../..:libperfetto_client_experimental",
      "../../gn:benchmark",
      "../../gn:default_deps",
    ]
    sources = [ "api_benchmark.cc" ]
  }
}
