# 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_elf = true
  _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_ELF=$_enable_elf",
    "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",
    "arm_utils.cc",
    "arm_utils.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_elf.cc",
    "disassembler_elf.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_elf.cc",
    "reloc_elf.h",
    "reloc_win32.cc",
    "reloc_win32.h",
    "suffix_array.h",
    "target_pool.cc",
    "target_pool.h",
    "targets_affinity.cc",
    "targets_affinity.h",
    "type_dex.h",
    "type_elf.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",
  ]

  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",
    "arm_utils_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_elf_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_elf_unittest.cc",
    "reloc_win32_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",
  ]

  data = [ "testdata" ]
}

# Group to build and depend on all the Zucchini related fuzzers.
group("zucchini_fuzzers") {
  testonly = true
  deps = [
    "//components/zucchini/fuzzers:zucchini_disassembler_dex_fuzzer",
    "//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_apply_fuzzer",
      "//components/zucchini/fuzzers:zucchini_imposed_ensemble_matcher_fuzzer",
      "//components/zucchini/fuzzers:zucchini_raw_gen_fuzzer",
      "//components/zucchini/fuzzers:zucchini_ztf_gen_fuzzer",
    ]
  }
}
