# Copyright (C) 2023 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")

assert(enable_perfetto_winscope)

source_set("full") {
  sources = [
    "android_input_event_parser.cc",
    "android_input_event_parser.h",
    "protolog_message_decoder.cc",
    "protolog_message_decoder.h",
    "protolog_parser.cc",
    "protolog_parser.h",
    "shell_transitions_parser.cc",
    "shell_transitions_parser.h",
    "shell_transitions_tracker.cc",
    "shell_transitions_tracker.h",
    "surfaceflinger_layers_extractor.cc",
    "surfaceflinger_layers_extractor.h",
    "surfaceflinger_layers_parser.cc",
    "surfaceflinger_layers_parser.h",
    "surfaceflinger_layers_rect_computation.cc",
    "surfaceflinger_layers_rect_computation.h",
    "surfaceflinger_layers_utils.h",
    "surfaceflinger_layers_visibility_computation.cc",
    "surfaceflinger_layers_visibility_computation.h",
    "surfaceflinger_transactions_parser.cc",
    "surfaceflinger_transactions_parser.h",
    "viewcapture_args_parser.cc",
    "viewcapture_args_parser.h",
    "viewcapture_parser.cc",
    "viewcapture_parser.h",
    "winscope_context.h",
    "winscope_geometry.cc",
    "winscope_geometry.h",
    "winscope_module.cc",
    "winscope_module.h",
    "winscope_rect_tracker.cc",
    "winscope_rect_tracker.h",
    "winscope_transform_tracker.cc",
    "winscope_transform_tracker.h",
  ]
  deps = [
    ":gen_cc_winscope_descriptor",
    "../:proto_importer_module",
    "../../../../../gn:default_deps",
    "../../../../../protos/perfetto/trace:zero",
    "../../../../../protos/perfetto/trace/android:winscope_common_zero",
    "../../../../../protos/perfetto/trace/android:winscope_extensions_zero",
    "../../../../../protos/perfetto/trace/android:winscope_regular_zero",
    "../../../../../protos/perfetto/trace/android:zero",
    "../../../../../protos/perfetto/trace/interned_data:zero",
    "../../../../../protos/perfetto/trace/profiling:zero",
    "../../../../protozero",
    "../../../containers",
    "../../../storage",
    "../../../tables",
    "../../../types",
    "../../../util:winscope_proto_mapping",
    "../../common",
    "../../common:parser_types",
    "../../proto:minimal",
    "../../proto:packet_sequence_state_generation_hdr",
  ]
}

perfetto_cc_proto_descriptor("gen_cc_winscope_descriptor") {
  descriptor_name = "winscope.descriptor"
  descriptor_target =
      "../../../../../protos/perfetto/trace/android:winscope_descriptor"
}

perfetto_unittest_source_set("unittests") {
  testonly = true
  deps = [
    ":full",
    "../../../../../gn:default_deps",
    "../../../../../gn:gtest_and_gmock",
    "../../../../../protos/perfetto/trace/android:winscope_common_cpp",
    "../../../../../protos/perfetto/trace/android:winscope_regular_cpp",
    "../../../../../src/protozero",
  ]
  sources = [
    "surfaceflinger_layers_extractor_unittest.cc",
    "surfaceflinger_layers_test_utils.h",
    "surfaceflinger_layers_visibility_computation_unittest.cc",
    "winscope_geometry_test_utils.h",
    "winscope_geometry_unittest.cc",
  ]
}
