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

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

# Lists all tools. The root "all" target depends on this.
group("tools") {
  testonly = true
  deps = [
    ":copy_protoc",
    ":idle_alloc",
    "compact_reencode",
    "ftrace_proto_gen",
    "protoprofile",
    "trace_to_text",
    "trace_to_text:trace_to_text_lite",
  ]
  if (is_linux || is_android) {
    deps += [
      "busy_threads",
      "cpu_utilization",
      "dump_ftrace_stats",
      "skippy",
    ]
  }
}

if (is_linux && enable_perfetto_heapprofd) {
  executable("profiling_sample_distribution") {
    sources = [
      "profiling_sample_distribution.cc",
    ]
    deps = [
      "../gn:default_deps",
      "../src/base",
      "../src/profiling/memory:client",
    ]
  }
}

executable("idle_alloc") {
  deps = [
    "../gn:default_deps",
  ]
  sources = [
    "idle_alloc.cc",
  ]
}

# The protoc binary can end up in out/protoc or out/gcc_like_host/protoc
# depending on whether this is a pure-host build vs a host+target (i.e. android)
# build. This rule ensures that in both cases we end up with a host binary in
# out/protoc, so tools can consistently refer to that one location.
protoc_target = "../gn:protoc($host_toolchain)"
if (current_toolchain != host_toolchain) {
  copy("copy_protoc") {
    testonly = true
    deps = [
      protoc_target,
    ]
    host_out_dir = get_label_info(protoc_target, "root_out_dir")
    sources = [
      "$host_out_dir/protoc",
    ]
    outputs = [
      "$root_build_dir/protoc",
    ]
  }
} else {
  # Nothing to do, in this case protoc is already built in the root out dir.
  group("copy_protoc") {
    public_deps = [
      protoc_target,
    ]
  }
}
