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

# Prevent that this file is accidentally included in embedder builds.
assert(enable_perfetto_trace_processor)

# The library which eases processing of Perfetto traces by exposing reading
# friendly APIs.
if (enable_perfetto_trace_processor_sqlite) {
  static_library("trace_processor") {
    complete_static_lib = true
    public_deps = [ ":lib" ]
  }
}

if (enable_perfetto_ui) {
  wasm_lib("trace_processor_wasm") {
    name = "trace_processor"
    deps = [
      ":lib",
      "../../gn:default_deps",
      "../base",
      "rpc:wasm_bridge",
    ]
  }
}

source_set("metatrace") {
  sources = [
    "tp_metatrace.cc",
    "tp_metatrace.h",
  ]
  deps = [
    "../../gn:default_deps",
    "../../include/perfetto/ext/base",
    "../../include/perfetto/trace_processor",
    "../../protos/perfetto/trace_processor:zero",
  ]
}

# In Bazel builds the ":demangle" target (below) should be a static_library so
# it gets mapped to an actual target (rather than being squashed as a filegroup)
# and can be replaced in Google internal builds via perfetto_cfg.bzl.
# Unfortunately, however, static_library targets seem to break Wasm builds on
# Mac. For this reason we just make it a source_set for all other build types.
if (is_perfetto_build_generator) {
  _demangle_target_type = "static_library"
} else {
  _demangle_target_type = "source_set"
}

target(_demangle_target_type, "demangle") {
  sources = [ "demangle.cc" ]
  deps = [
    "../../gn:default_deps",
    "../../include/perfetto/base",
    "../../include/perfetto/ext/base",
  ]
  public_deps = [ "../../include/perfetto/ext/trace_processor:demangle" ]
  if (enable_perfetto_llvm_demangle) {
    deps += [ "../../gn:llvm_demangle" ]
  }
}

source_set("ftrace_descriptors") {
  sources = [
    "importers/ftrace/ftrace_descriptors.cc",
    "importers/ftrace/ftrace_descriptors.h",
  ]
  deps = [
    "../../gn:default_deps",
    "../../include/perfetto/ext/base:base",
    "../protozero",
  ]
}

source_set("storage_minimal") {
  sources = [
    "forwarding_trace_parser.cc",
    "forwarding_trace_parser.h",
    "importers/default_modules.cc",
    "importers/default_modules.h",
    "importers/ftrace/ftrace_module.cc",
    "importers/ftrace/ftrace_module.h",
    "importers/fuchsia/fuchsia_trace_utils.h",
    "importers/json/json_utils.cc",
    "importers/json/json_utils.h",
    "importers/proto/android_camera_event_module.cc",
    "importers/proto/android_camera_event_module.h",
    "importers/proto/chrome_system_probes_module.cc",
    "importers/proto/chrome_system_probes_module.h",
    "importers/proto/chrome_system_probes_parser.cc",
    "importers/proto/chrome_system_probes_parser.h",
    "importers/proto/memory_tracker_snapshot_module.cc",
    "importers/proto/memory_tracker_snapshot_module.h",
    "importers/proto/memory_tracker_snapshot_parser.cc",
    "importers/proto/memory_tracker_snapshot_parser.h",
    "importers/proto/metadata_module.cc",
    "importers/proto/metadata_module.h",
    "importers/proto/metadata_tracker.cc",
    "importers/proto/metadata_tracker.h",
    "importers/proto/perf_sample_tracker.cc",
    "importers/proto/perf_sample_tracker.h",
    "importers/proto/profile_module.cc",
    "importers/proto/profile_module.h",
    "importers/proto/profile_packet_utils.cc",
    "importers/proto/profile_packet_utils.h",
    "importers/proto/proto_incremental_state.h",
    "importers/proto/proto_trace_parser.cc",
    "importers/proto/proto_trace_parser.h",
    "importers/proto/proto_trace_reader.cc",
    "importers/proto/proto_trace_reader.h",
    "importers/proto/proto_trace_tokenizer.cc",
    "importers/proto/proto_trace_tokenizer.h",
    "importers/proto/track_event_module.cc",
    "importers/proto/track_event_module.h",
    "importers/proto/track_event_parser.cc",
    "importers/proto/track_event_parser.h",
    "importers/proto/track_event_tokenizer.cc",
    "importers/proto/track_event_tokenizer.h",
    "importers/proto/track_event_tracker.cc",
    "importers/proto/track_event_tracker.h",
    "importers/proto/translation_table_module.cc",
    "importers/proto/translation_table_module.h",
    "importers/syscalls/syscall_tracker.h",
    "trace_blob.cc",
    "trace_processor_context.cc",
    "trace_processor_storage.cc",
    "trace_processor_storage_impl.cc",
    "trace_processor_storage_impl.h",
    "virtual_destructors.cc",
  ]
  deps = [
    "../../gn:default_deps",
    "../base",
    "../protozero",
    "containers",
    "importers:gen_cc_chrome_track_event_descriptor",
    "importers:gen_cc_track_event_descriptor",
    "importers/common",
    "importers/common:parser_types",
    "importers/fuchsia:fuchsia_record",
    "importers/memory_tracker:graph_processor",
    "importers/proto:minimal",
    "importers/systrace:systrace_line",
    "sorter",
    "storage",
    "tables",
    "types",
    "util",
    "util:descriptors",
    "util:gzip",
    "util:proto_to_args_parser",
    "util:stack_traces_util",
    "views",
  ]
  public_deps = [
    "../../include/perfetto/trace_processor:storage",
    "../../protos/perfetto/common:zero",
    "../../protos/perfetto/config:zero",
    "../../protos/perfetto/trace:zero",
    "../../protos/perfetto/trace/android:zero",
    "../../protos/perfetto/trace/chrome:zero",
    "../../protos/perfetto/trace/ftrace:zero",
    "../../protos/perfetto/trace/interned_data:zero",
    "../../protos/perfetto/trace/perfetto:zero",
    "../../protos/perfetto/trace/power:zero",
    "../../protos/perfetto/trace/profiling:zero",
    "../../protos/perfetto/trace/ps:zero",
    "../../protos/perfetto/trace/sys_stats:zero",
    "../../protos/perfetto/trace/system_info:zero",
    "../../protos/perfetto/trace/track_event:zero",
    "../../protos/perfetto/trace/translation:zero",
    "../../src/kernel_utils:syscall_table",
  ]

  # json_utils optionally depends on jsoncpp.
  if (enable_perfetto_trace_processor_json) {
    deps += [ "../../gn:jsoncpp" ]
  }
}

source_set("export_json") {
  sources = [
    "export_json.cc",
    "export_json.h",
  ]
  deps = [
    ":storage_minimal",
    "../../gn:default_deps",
    "../base",
    "storage",
    "types",
  ]
  public_deps = [ "../../include/perfetto/ext/trace_processor:export_json" ]
  if (enable_perfetto_trace_processor_json) {
    deps += [ "../../gn:jsoncpp" ]
  }
}

if (enable_perfetto_trace_processor_sqlite) {
  source_set("lib") {
    sources = [
      "iterator_impl.cc",
      "iterator_impl.h",
      "read_trace.cc",
      "read_trace_internal.cc",
      "read_trace_internal.h",
      "trace_processor.cc",
      "trace_processor_impl.cc",
      "trace_processor_impl.h",
    ]

    deps = [
      ":metatrace",
      "../../gn:default_deps",
      "../../protos/perfetto/trace/ftrace:zero",
      "../base",
      "../protozero",
      "db",
      "dynamic",
      "importers:importers_full",
      "importers/android_bugreport",
      "importers/common",
      "importers/ninja",
      "metrics",
      "sqlite",
      "sqlite/functions",
      "stdlib:gen_amalgamated_stdlib",
      "storage",
      "tables",
      "types",
      "util",
      "util:gzip",
      "util:protozero_to_text",
      "util:stdlib",
      "views",
    ]
    public_deps = [
      "../../gn:sqlite",  # iterator_impl.h includes sqlite3.h.
      "../../include/perfetto/trace_processor",
    ]
    if (enable_perfetto_trace_processor_json) {
      deps += [ "../../gn:jsoncpp" ]
    }
  }

  executable("trace_processor_shell") {
    deps = [
      ":lib",
      "../../gn:default_deps",
      "../../gn:protobuf_full",
      "../../protos/perfetto/trace_processor:zero",
      "../../src/profiling:deobfuscator",
      "../../src/profiling/symbolizer",
      "../../src/profiling/symbolizer:symbolize_database",
      "../base",
      "../base:version",
      "metrics",
      "util",
      "util:stdlib",
    ]
    if (enable_perfetto_trace_processor_linenoise) {
      deps += [ "../../gn:linenoise" ]
    }
    if (enable_perfetto_trace_processor_httpd) {
      deps += [ "rpc:httpd" ]
    }
    sources = [
      "trace_processor_shell.cc",
      "util/proto_to_json.cc",
      "util/proto_to_json.h",
    ]
    if (perfetto_build_standalone && !is_perfetto_build_generator) {
      data_deps = [
        # The diff testing framework depends on these descriptors.
        "../../protos/perfetto/metrics:descriptor",
        "../../protos/perfetto/trace:descriptor",
        "../../protos/perfetto/trace:test_extensions_descriptor",
      ]
    }
  }
}  # if (enable_perfetto_trace_processor_sqlite)

perfetto_unittest_source_set("unittests") {
  testonly = true
  sources = [
    "forwarding_trace_parser_unittest.cc",
    "importers/ftrace/binder_tracker_unittest.cc",
    "importers/ftrace/sched_event_tracker_unittest.cc",
    "importers/ftrace/thread_state_tracker_unittest.cc",
    "importers/fuchsia/fuchsia_parser_unittest.cc",
    "importers/fuchsia/fuchsia_trace_utils_unittest.cc",
    "importers/memory_tracker/graph_processor_unittest.cc",
    "importers/memory_tracker/graph_unittest.cc",
    "importers/memory_tracker/raw_process_memory_node_unittest.cc",
    "importers/proto/async_track_set_tracker_unittest.cc",
    "importers/proto/perf_sample_tracker_unittest.cc",
    "importers/proto/proto_trace_parser_unittest.cc",
    "importers/syscalls/syscall_tracker_unittest.cc",
    "importers/systrace/systrace_parser_unittest.cc",
    "ref_counted_unittest.cc",
  ]
  deps = [
    ":gen_cc_test_messages_descriptor",
    "../../gn:default_deps",
    "../../gn:gtest_and_gmock",
    "../../protos/perfetto/common:cpp",
    "../../protos/perfetto/common:zero",
    "../../protos/perfetto/trace:cpp",
    "../../protos/perfetto/trace:minimal_zero",
    "../../protos/perfetto/trace:zero",
    "../../protos/perfetto/trace/android:zero",
    "../../protos/perfetto/trace/chrome:zero",
    "../../protos/perfetto/trace/ftrace:zero",
    "../../protos/perfetto/trace/gpu:zero",
    "../../protos/perfetto/trace/interned_data:zero",
    "../../protos/perfetto/trace/profiling:cpp",
    "../../protos/perfetto/trace/ps:zero",
    "../../protos/perfetto/trace/sys_stats:zero",
    "../../protos/perfetto/trace/track_event:zero",
    "../base",
    "../protozero",
    "../protozero:testing_messages_zero",
    "containers",
    "containers:unittests",
    "db:unittests",
    "dynamic",
    "importers:importers_full",
    "importers/android_bugreport:unittests",
    "importers/common",
    "importers/common:parser_types",
    "importers/common:unittests",
    "importers/memory_tracker:graph_processor",
    "importers/proto:minimal",
    "importers/proto:unittests",
    "rpc:unittests",
    "sorter",
    "sorter:unittests",
    "sqlite/functions:unittests",
    "storage",
    "tables:unittests",
    "types",
    "types:unittests",
    "util:descriptors",
    "util:unittests",
    "views",
    "views:unittests",
  ]

  if (enable_perfetto_trace_processor_sqlite) {
    deps += [
      ":lib",
      "../../gn:sqlite",
      "dynamic:unittests",
      "sqlite:unittests",
    ]
  }

  if (enable_perfetto_trace_processor_json) {
    sources += [
      "importers/json/json_trace_tokenizer_unittest.cc",
      "importers/json/json_utils_unittest.cc",
    ]
    deps += [ "../../gn:jsoncpp" ]

    if (!is_win) {
      # export_json_unittest.cc uses base::TempFile, which is not supported on
      # windows.
      sources += [ "export_json_unittest.cc" ]
      deps += [
        ":export_json",
        "../../include/perfetto/ext/trace_processor:export_json",
      ]
    }
  }
}

perfetto_cc_proto_descriptor("gen_cc_test_messages_descriptor") {
  descriptor_name = "test_messages.descriptor"
  descriptor_target = "../protozero:test_messages_descriptor"
}

source_set("integrationtests") {
  testonly = true
  sources = []
  deps = []
  if (enable_perfetto_trace_processor_sqlite) {
    sources += [
      "read_trace_integrationtest.cc",
      "trace_database_integrationtest.cc",
    ]
    deps += [
      ":lib",
      "../../gn:default_deps",
      "../../gn:gtest_and_gmock",
      "../../protos/perfetto/common:zero",
      "../../protos/perfetto/trace:zero",
      "../../protos/perfetto/trace_processor:zero",
      "../base",
      "../base:test_support",
      "sqlite",
    ]
    if (enable_perfetto_trace_processor_json) {
      deps += [ "../../gn:jsoncpp" ]
    }
  }
}

if (enable_perfetto_trace_processor_json) {
  source_set("storage_minimal_smoke_tests") {
    testonly = true
    sources = [ "storage_minimal_smoke_test.cc" ]
    deps = [
      ":export_json",
      ":storage_minimal",
      "../../gn:default_deps",
      "../../gn:gtest_and_gmock",
      "../../gn:gtest_main",
      "../../gn:jsoncpp",
      "../base:test_support",
    ]
  }
}

perfetto_fuzzer_test("trace_processor_fuzzer") {
  testonly = true
  sources = [ "trace_parsing_fuzzer.cc" ]
  deps = [
    "../../gn:default_deps",
    "../base",
    "importers:importers_full",
  ]
}
