# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/buildflag_header.gni")
import("//chrome/process_version_rc_template.gni")
import("//testing/test.gni")

buildflag_header("buildflags") {
  header = "buildflags.h"

  # Disable DEX on Windows Official Builds.
  _enable_dex = !(is_win && is_official_build)
  _enable_win = true

  # Disable ZTF (Zucchini Text Format) on official builds it is for testing only.
  _enable_ztf = !is_official_build
  flags = [
    "ENABLE_DEX=$_enable_dex",
    "ENABLE_WIN=$_enable_win",
    "ENABLE_ZTF=$_enable_ztf",
  ]
}

static_library("zucchini_lib") {
  sources = [
    "abs32_utils.cc",
    "abs32_utils.h",
    "address_translator.cc",
    "address_translator.h",
    "algorithm.h",
    "binary_data_histogram.cc",
    "binary_data_histogram.h",
    "buffer_sink.cc",
    "buffer_sink.h",
    "buffer_source.cc",
    "buffer_source.h",
    "buffer_view.h",
    "crc32.cc",
    "crc32.h",
    "disassembler.cc",
    "disassembler.h",
    "disassembler_dex.cc",
    "disassembler_dex.h",
    "disassembler_no_op.cc",
    "disassembler_no_op.h",
    "disassembler_win32.cc",
    "disassembler_win32.h",
    "disassembler_ztf.cc",
    "disassembler_ztf.h",
    "element_detection.cc",
    "element_detection.h",
    "encoded_view.cc",
    "encoded_view.h",
    "ensemble_matcher.cc",
    "ensemble_matcher.h",
    "equivalence_map.cc",
    "equivalence_map.h",
    "heuristic_ensemble_matcher.cc",
    "heuristic_ensemble_matcher.h",
    "image_index.cc",
    "image_index.h",
    "image_utils.h",
    "imposed_ensemble_matcher.cc",
    "imposed_ensemble_matcher.h",
    "io_utils.cc",
    "io_utils.h",
    "patch_reader.cc",
    "patch_reader.h",
    "patch_utils.h",
    "patch_writer.cc",
    "patch_writer.h",
    "reference_bytes_mixer.cc",
    "reference_bytes_mixer.h",
    "reference_set.cc",
    "reference_set.h",
    "rel32_finder.cc",
    "rel32_finder.h",
    "rel32_utils.cc",
    "rel32_utils.h",
    "reloc_utils.cc",
    "reloc_utils.h",
    "suffix_array.h",
    "target_pool.cc",
    "target_pool.h",
    "targets_affinity.cc",
    "targets_affinity.h",
    "type_dex.h",
    "type_win_pe.h",
    "typed_value.h",
    "zucchini.h",
    "zucchini_apply.cc",
    "zucchini_apply.h",
    "zucchini_gen.cc",
    "zucchini_gen.h",
    "zucchini_tools.cc",
    "zucchini_tools.h",
  ]

  deps = [
    ":buildflags",
    "//base",
  ]
}

static_library("zucchini_io") {
  sources = [
    "mapped_file.cc",
    "mapped_file.h",
    "zucchini_integration.cc",
    "zucchini_integration.h",
  ]

  deps = [
    ":zucchini_lib",
    "//base",
  ]
}

executable("zucchini") {
  sources = [
    "main_utils.cc",
    "main_utils.h",
    "zucchini_commands.cc",
    "zucchini_commands.h",
    "zucchini_main.cc",
  ]

  deps = [
    ":zucchini_io",
    ":zucchini_lib",
    "//base",
    "//build/config:exe_and_shlib_deps",
  ]

  if (is_win) {
    deps += [ ":zucchini_exe_version" ]
  }
}

if (is_win) {
  process_version_rc_template("zucchini_exe_version") {
    template_file = "zucchini_exe_version.rc.version"
    output = "$target_gen_dir/zucchini_exe_version.rc"
  }
}

test("zucchini_unittests") {
  sources = [
    "abs32_utils_unittest.cc",
    "address_translator_unittest.cc",
    "algorithm_unittest.cc",
    "binary_data_histogram_unittest.cc",
    "buffer_sink_unittest.cc",
    "buffer_source_unittest.cc",
    "buffer_view_unittest.cc",
    "crc32_unittest.cc",
    "disassembler_dex_unittest.cc",
    "disassembler_ztf_unittest.cc",
    "element_detection_unittest.cc",
    "encoded_view_unittest.cc",
    "equivalence_map_unittest.cc",
    "image_index_unittest.cc",
    "image_utils_unittest.cc",
    "imposed_ensemble_matcher_unittest.cc",
    "io_utils_unittest.cc",
    "mapped_file_unittest.cc",
    "patch_read_write_unittest.cc",
    "patch_utils_unittest.cc",
    "reference_set_unittest.cc",
    "rel32_finder_unittest.cc",
    "rel32_utils_unittest.cc",
    "reloc_utils_unittest.cc",
    "suffix_array_unittest.cc",
    "target_pool_unittest.cc",
    "targets_affinity_unittest.cc",
    "test_disassembler.cc",
    "test_disassembler.h",
    "test_reference_reader.cc",
    "test_reference_reader.h",
    "test_utils.cc",
    "test_utils.h",
    "typed_value_unittest.cc",
    "zucchini_apply_unittest.cc",
    "zucchini_gen_unittest.cc",
  ]

  deps = [
    ":zucchini_io",
    ":zucchini_lib",
    "//base",
    "//base/test:run_all_unittests",
    "//base/test:test_support",
    "//testing/gtest",
  ]
}

test("zucchini_integration_test") {
  sources = [
    "integration_test.cc",
  ]

  deps = [
    ":zucchini_lib",
    "//base",
    "//base/test:run_all_unittests",
    "//base/test:test_support",
    "//testing/gtest",
  ]
}

# Group to build and depend on all the Zucchini related fuzzers.
group("zucchini_fuzzers") {
  testonly = true
  deps = [
    "//components/zucchini/fuzzers:zucchini_disassembler_win32_fuzzer",
    "//components/zucchini/fuzzers:zucchini_patch_fuzzer",
  ]

  # Ensure protoc is available.
  # Disabled on Windows due to crbug/844826.
  if (current_toolchain == host_toolchain && !is_win) {
    deps += [
      "//components/zucchini/fuzzers:zucchini_raw_apply_fuzzer",
      "//components/zucchini/fuzzers:zucchini_raw_gen_fuzzer",
    ]
  }
}
