# Copyright 2019 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.

import("../scripts/dawn_overrides_with_defaults.gni")
import("generator_lib.gni")

# Template to help invoking Dawn code generators based on generator_lib
#
#   dawn_generator("my_target_gen") {
#     # The script and generator specific arguments
#     script = [ "my_awesome_generator.py" ]
#     args = [
#       "--be-awesome",
#       "yes"
#     ]
#
#     # The list of expected outputs, generation fails if there's a mismatch
#     outputs = [
#       "MyAwesomeTarget.cpp",
#       "MyAwesomeTarget.h",
#     ]
#   }
#
# Using the generated files is done like so:
#
#   shared_library("my_target") {
#     deps = [ ":my_target_gen "]
#     sources = get_target_outputs(":my_target_gen")
#   }
#
template("dawn_generator") {
  generator_lib_action(target_name) {
    forward_variables_from(invoker, "*", [ "script" ])
    script = get_path_info(invoker.script, "abspath")

    # Set arguments required to find the python libraries for the generator
    generator_lib_dir = get_path_info("${dawn_root}/generator", "abspath")
    jinja2_path = dawn_jinja2_dir

    # Force Dawn's autogenerated file structure to mirror exactly the source
    # tree but start at ${dawn_gen_root} instead of ${dawn_root}
    custom_gen_dir = dawn_gen_root
  }
}

# Helper generator for calling the generator from dawn.json
#
#   dawn_json_generator("my_target_gen") {
#     # Which generator target to output
#     target = "my_target"
#
#     # Also supports `outputs` and `custom_gen_dir` like dawn_generator.
#   }
template("dawn_json_generator") {
  dawn_generator(target_name) {
    script = "${dawn_root}/generator/dawn_json_generator.py"

    # The base arguments for the generator: from this dawn.json, generate this
    # target using templates in this directory.
    args = [
      "--dawn-json",
      rebase_path("${dawn_root}/src/dawn/dawn.json", root_build_dir),
      "--wire-json",
      rebase_path("${dawn_root}/src/dawn/dawn_wire.json", root_build_dir),
      "--kotlin-json",
      rebase_path("${dawn_root}/src/dawn/dawn_kotlin.json", root_build_dir),
      "--targets",
      invoker.target,
    ]

    forward_variables_from(invoker, "*", [ "target" ])
  }
}
