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

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

# This source_set is used both by WASM (for the function-call-based query
# interface) and by the :httpd module for the HTTP interface.
source_set("rpc") {
  sources = [
    "query_result_serializer.cc",
    "rpc.cc",
    "rpc.h",
  ]
  deps = [
    "..:lib",
    "..:metatrace",
    "../../../gn:default_deps",
    "../../../include/perfetto/trace_processor",
    "../../../protos/perfetto/trace_processor:zero",
    "../../base",
    "../../base:version",
    "../../protozero",
    "../../protozero:proto_ring_buffer",
  ]
  public_deps = [
    "../../../include/perfetto/ext/trace_processor/rpc:query_result_serializer",
  ]
}

if (is_perfetto_build_generator || perfetto_build_standalone) {
  # Static library target for RPC code. Needed for BigTrace in Google3.
  # TODO(b/278208757): remove this when we migrate to using rpc_shell.
  static_library("trace_processor_rpc") {
    public_deps = [ ":rpc" ]
  }
}

source_set("stdiod") {
  sources = [
    "stdiod.cc",
    "stdiod.h",
  ]
  deps = [
    ":rpc",
    "..:lib",
    "../../../gn:default_deps",
    "../../base",
  ]
}

perfetto_unittest_source_set("unittests") {
  testonly = true
  sources = [ "query_result_serializer_unittest.cc" ]
  deps = [
    ":rpc",
    "..:lib",
    "../../../gn:default_deps",
    "../../../gn:gtest_and_gmock",
    "../../../protos/perfetto/trace_processor:zero",
    "../../base",
    "../../protozero",
  ]
}

if (enable_perfetto_trace_processor_httpd) {
  source_set("httpd") {
    sources = [
      "httpd.cc",
      "httpd.h",
    ]
    deps = [
      ":rpc",
      "../../../gn:default_deps",
      "../../../include/perfetto/trace_processor",
      "../../../protos/perfetto/trace_processor:zero",
      "../../base",
      "../../base/http",
      "../../protozero",
    ]
  }
}

if (enable_perfetto_ui && is_wasm) {
  source_set("wasm_bridge") {
    sources = [ "wasm_bridge.cc" ]
    deps = [
      ":rpc",
      "../../../gn:default_deps",
      "../../../include/perfetto/trace_processor",
      "../../base",
    ]
  }
}

if (enable_perfetto_benchmarks) {
  source_set("benchmarks") {
    testonly = true
    deps = [
      ":rpc",
      "..:lib",
      "../../../gn:benchmark",
      "../../../gn:default_deps",
      "../../../gn:sqlite",
      "../../base",
    ]
    sources = [ "query_result_serializer_benchmark.cc" ]
  }
}
