# Copyright 2023 The Dawn & Tint Authors
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
#    list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
#    this list of conditions and the following disclaimer in the documentation
#    and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
#    contributors may be used to endorse or promote products derived from
#    this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

################################################################################
# File generated by 'tools/src/cmd/gen' using the template:
#   tools/src/cmd/gen/build/BUILD.gn.tmpl
#
# To regenerate run: './tools/run gen'
#
#                       Do not modify this file directly
################################################################################

import("../../../../scripts/tint_overrides_with_defaults.gni")

import("${tint_src_dir}/tint.gni")

if (tint_build_unittests || tint_build_benchmarks) {
  import("//testing/test.gni")
}
if (tint_build_unittests) {
  test("test_cmd") {
    testonly = true
    output_name = "tint_unittests"
    sources = [ "main_test.cc" ]
    deps = [
      "${tint_src_dir}:gmock_and_gtest",
      "${tint_src_dir}/api",
      "${tint_src_dir}/api/common:unittests",
      "${tint_src_dir}/lang/core:unittests",
      "${tint_src_dir}/lang/core/constant:unittests",
      "${tint_src_dir}/lang/core/intrinsic:unittests",
      "${tint_src_dir}/lang/core/ir:unittests",
      "${tint_src_dir}/lang/core/ir/transform:unittests",
      "${tint_src_dir}/lang/core/ir/transform/common:unittests",
      "${tint_src_dir}/lang/core/type:unittests",
      "${tint_src_dir}/lang/hlsl/writer/common:unittests",
      "${tint_src_dir}/lang/msl/ir:unittests",
      "${tint_src_dir}/lang/msl/type:unittests",
      "${tint_src_dir}/lang/spirv/ir:unittests",
      "${tint_src_dir}/lang/spirv/reader/lower:unittests",
      "${tint_src_dir}/lang/spirv/type:unittests",
      "${tint_src_dir}/lang/wgsl:unittests",
      "${tint_src_dir}/lang/wgsl/ast:unittests",
      "${tint_src_dir}/lang/wgsl/common:unittests",
      "${tint_src_dir}/lang/wgsl/helpers:unittests",
      "${tint_src_dir}/lang/wgsl/intrinsic:unittests",
      "${tint_src_dir}/lang/wgsl/program:unittests",
      "${tint_src_dir}/lang/wgsl/reader/lower:unittests",
      "${tint_src_dir}/lang/wgsl/resolver:unittests",
      "${tint_src_dir}/lang/wgsl/sem:unittests",
      "${tint_src_dir}/lang/wgsl/writer/ir_to_program:unittests",
      "${tint_src_dir}/lang/wgsl/writer/raise:unittests",
      "${tint_src_dir}/utils/bytes:unittests",
      "${tint_src_dir}/utils/cli:unittests",
      "${tint_src_dir}/utils/command:unittests",
      "${tint_src_dir}/utils/containers:unittests",
      "${tint_src_dir}/utils/diagnostic:unittests",
      "${tint_src_dir}/utils/file:unittests",
      "${tint_src_dir}/utils/ice:unittests",
      "${tint_src_dir}/utils/macros:unittests",
      "${tint_src_dir}/utils/math:unittests",
      "${tint_src_dir}/utils/memory:unittests",
      "${tint_src_dir}/utils/reflection:unittests",
      "${tint_src_dir}/utils/result:unittests",
      "${tint_src_dir}/utils/rtti:unittests",
      "${tint_src_dir}/utils/strconv:unittests",
      "${tint_src_dir}/utils/symbol:unittests",
      "${tint_src_dir}/utils/text:unittests",
      "${tint_src_dir}/utils/traits:unittests",
    ]

    if (tint_build_glsl_writer) {
      deps += [
        "${tint_src_dir}/lang/glsl/writer/ast_printer:unittests",
        "${tint_src_dir}/lang/glsl/writer/common:unittests",
        "${tint_src_dir}/lang/glsl/writer/printer:unittests",
      ]
    }

    if (tint_build_glsl_writer && tint_build_wgsl_reader &&
        tint_build_wgsl_writer) {
      deps += [ "${tint_src_dir}/lang/glsl/writer/ast_raise:unittests" ]
    }

    if (tint_build_hlsl_writer) {
      deps += [
        "${tint_src_dir}/lang/hlsl/writer:unittests",
        "${tint_src_dir}/lang/hlsl/writer/ast_printer:unittests",
      ]
    }

    if (tint_build_hlsl_writer && tint_build_wgsl_reader &&
        tint_build_wgsl_writer) {
      deps += [ "${tint_src_dir}/lang/hlsl/writer/ast_raise:unittests" ]
    }

    if (tint_build_ir_binary) {
      deps += [ "${tint_src_dir}/lang/core/ir/binary:unittests" ]
    }

    if (tint_build_msl_writer) {
      deps += [
        "${tint_src_dir}/lang/msl/writer:unittests",
        "${tint_src_dir}/lang/msl/writer/ast_printer:unittests",
        "${tint_src_dir}/lang/msl/writer/common:unittests",
        "${tint_src_dir}/lang/msl/writer/raise:unittests",
      ]
    }

    if (tint_build_msl_writer && tint_build_wgsl_reader &&
        tint_build_wgsl_writer) {
      deps += [ "${tint_src_dir}/lang/msl/writer/ast_raise:unittests" ]
    }

    if (tint_build_spv_reader) {
      deps += [
        "${tint_src_dir}/lang/spirv/reader:unittests",
        "${tint_src_dir}/lang/spirv/reader/common:unittests",
        "${tint_src_dir}/lang/spirv/reader/parser:unittests",
      ]
    }

    if (tint_build_spv_reader && tint_build_wgsl_reader &&
        tint_build_wgsl_writer) {
      deps += [ "${tint_src_dir}/lang/spirv/reader/ast_lower:unittests" ]
    }

    if (tint_build_spv_reader && tint_build_wgsl_writer) {
      deps += [ "${tint_src_dir}/lang/spirv/reader/ast_parser:unittests" ]
    }

    if (tint_build_spv_reader || tint_build_spv_writer) {
      deps += [ "${tint_src_dir}/lang/spirv/validate:unittests" ]
    }

    if (tint_build_spv_writer) {
      deps += [
        "${tint_src_dir}/lang/spirv/writer:unittests",
        "${tint_src_dir}/lang/spirv/writer/ast_printer:unittests",
        "${tint_src_dir}/lang/spirv/writer/common:unittests",
        "${tint_src_dir}/lang/spirv/writer/raise:unittests",
      ]
    }

    if (tint_build_spv_writer && tint_build_wgsl_reader &&
        tint_build_wgsl_writer) {
      deps += [ "${tint_src_dir}/lang/spirv/writer/ast_raise:unittests" ]
    }

    if (tint_build_tintd && tint_build_wgsl_reader) {
      deps += [ "${tint_src_dir}/lang/wgsl/ls:unittests" ]
    }

    if (tint_build_wgsl_reader) {
      deps += [
        "${tint_src_dir}/lang/wgsl/inspector:unittests",
        "${tint_src_dir}/lang/wgsl/reader:unittests",
        "${tint_src_dir}/lang/wgsl/reader/parser:unittests",
        "${tint_src_dir}/lang/wgsl/reader/program_to_ir:unittests",
      ]
    }

    if (tint_build_wgsl_reader && tint_build_wgsl_writer) {
      deps += [ "${tint_src_dir}/lang/wgsl/ast/transform:unittests" ]
    }

    if (tint_build_wgsl_writer) {
      deps += [
        "${tint_src_dir}/lang/wgsl/writer:unittests",
        "${tint_src_dir}/lang/wgsl/writer/ast_printer:unittests",
      ]
    }
    configs += [ "${tint_src_dir}:tint_unittests_config" ]

    if (build_with_chromium) {
      configs -= [ "//build/config/compiler:chromium_code" ]
      configs += [ "//build/config/compiler:no_chromium_code" ]
    }
  }
}
