blob: 9dc123b87701aeafcdc1acc949dd5aaf774a63b7 [file] [log] [blame]
# Copyright 2020 The Fuchsia 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("//zircon/public/gn/subtarget_aliases.gni")
# This tells fidl_library() to invoke fidl_json_rspfile().
fidl_support_templates = [
{
import = "//zircon/public/gn/fidl/json.gni"
target = "fidl_json_rspfile"
fidlc = "json"
},
]
# This tells fidl_library() how to ask fidlc to generate JSON output.
fidl_support_fidlc = [
{
name = "json"
files = [
{
switch = "--json"
path = "fidl.json"
},
]
},
]
# Provide FIDL JSON IR for fidl_library(). **Do not use directly!**
#
# This is never used directly, but only indirectly by fidl_library().
# See there for details.
#
# This produces a group with the metadata schema required by
# fidl_library_json_rspfile() to identify the JSON IR file.
template("fidl_json_rspfile") {
group("$target_name.json") {
forward_variables_from(invoker,
[
"visibility",
"testonly",
])
# Depend on the fidlc generation step and describe what it produces.
deps = invoker.fidlc_deps
metadata = {
# NOTE: the fidl_json metadata key is used by both the ZN and GN build
# which implement fidl_library() very differently.
fidl_json = rebase_path(invoker.fidlc_outputs, root_build_dir)
}
}
# Things can depend on "fidl/foo:json" rather than "fidl/foo:foo.json".
subtarget_aliases(target_name) {
forward_variables_from(invoker,
[
"visibility",
"testonly",
])
outputs = [ "json" ]
}
not_needed(invoker, "*")
}