# Copyright (C) 2018 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/perfetto_cc_proto_descriptor.gni")
import("../../gn/proto_library.gni")
import("../../gn/test.gni")

# The command line client for Perfetto. Allows to configure / start / stop
# tracing, acting as a Consumer.
executable("perfetto") {
  deps = [
    ":perfetto_cmd",
    "../../gn:default_deps",
  ]
  sources = [ "main.cc" ]
}

# Tool to finalize long running traces.
# This connects to traced as a producer and sends the triggers passed on the
# commandline. This is a subset of what the perfetto binary can do but we
# need a separate binary for programs that cannot (for good reason) use the
# additional functionality (for example starting traces via consumer socket)
# due to selinux rules.
executable("trigger_perfetto") {
  deps = [
    ":trigger_perfetto_cmd",
    "../../gn:default_deps",
  ]
  sources = [ "trigger_perfetto_main.cc" ]
}

# Contains all the implementation but not the main() entry point. This target
# is shared both by the executable and tests.
source_set("perfetto_cmd") {
  public_deps = [
    ":protos_cpp",
    "../../include/perfetto/ext/traced",
  ]
  deps = [
    ":gen_cc_config_descriptor",
    ":trigger_producer",
    "../../gn:default_deps",
    "../../protos/perfetto/common:cpp",
    "../../protos/perfetto/config:cpp",
    "../../protos/perfetto/config/ftrace:cpp",
    "../android_stats",
    "../base",
    "../protozero",
    "../tracing/ipc/consumer",
  ]
  if (enable_perfetto_zlib) {
    deps += [ "../../gn:zlib" ]
  }
  sources = [
    "config.cc",
    "config.h",
    "packet_writer.cc",
    "packet_writer.h",
    "pbtxt_to_pb.cc",
    "pbtxt_to_pb.h",
    "perfetto_cmd.cc",
    "perfetto_cmd.h",
    "rate_limiter.cc",
    "rate_limiter.h",
  ]
  if (is_android) {
    deps += [ "../android_internal:lazy_library_loader" ]
    sources += [ "perfetto_cmd_android.cc" ]
  }
}

perfetto_cc_proto_descriptor("gen_cc_config_descriptor") {
  descriptor_name = "perfetto_config.descriptor"
  descriptor_target = "../../protos/perfetto/config:merged_config_descriptor"
}

source_set("trigger_perfetto_cmd") {
  public_deps = [
    ":protos_cpp",
    "../../include/perfetto/ext/traced",
  ]
  deps = [
    ":trigger_producer",
    "../../gn:default_deps",
    "../android_stats",
    "../base",
    "../tracing/ipc/producer",
  ]
  sources = [ "trigger_perfetto.cc" ]
}

source_set("trigger_producer") {
  sources = [
    "trigger_producer.cc",
    "trigger_producer.h",
  ]
  deps = [
    "../../gn:default_deps",
    "../base",
    "../tracing/ipc/producer",
  ]
}

perfetto_proto_library("protos_@TYPE@") {
  proto_generators = [
    "cpp",
    "source_set",
  ]
  sources = [ "perfetto_cmd_state.proto" ]
  proto_path = perfetto_root_path
}

perfetto_unittest_source_set("unittests") {
  testonly = true
  public_deps = []
  deps = [
    ":perfetto_cmd",
    "../../gn:default_deps",
    "../../gn:gtest_and_gmock",
    "../../include/perfetto/base",
    "../../include/perfetto/ext/base",
    "../../protos/perfetto/config:cpp",
    "../../protos/perfetto/config/ftrace:cpp",
    "../../protos/perfetto/trace:cpp",
    "../tracing/core",
  ]
  if (enable_perfetto_zlib) {
    deps += [ "../../gn:zlib" ]
  }
  sources = [
    "config_unittest.cc",
    "packet_writer_unittest.cc",
    "pbtxt_to_pb_unittest.cc",
    "rate_limiter_unittest.cc",
  ]
}
