| # Copyright 2017 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("//build/json/validate_json.gni") |
| import("//build/python/python_action.gni") |
| import("//build/sdk/config.gni") |
| |
| # Defines a group of SDK elements. |
| # |
| # Molecules do not have categories. They contain atoms with categories. |
| # |
| # Parameters |
| # deps (optional) |
| # List of GN labels referencing the elements of this group. |
| # These labels must point to "sdk_atom" or "sdk_molecule" targets. |
| # |
| # non_sdk_deps (optional) |
| # List of GN labels which this target needs built. |
| template("sdk_molecule") { |
| assert(defined(invoker.category), "Must define an SDK category") |
| |
| # Allow category to be specified to avoid breaking uses of the template. |
| # TODO(https://fxbug.dev/407083737): Remove all instances and delete this. |
| not_needed(invoker, [ "category" ]) |
| |
| gn_deps = [] |
| |
| if (defined(invoker.deps)) { |
| gn_deps += invoker.deps |
| } |
| |
| if (defined(invoker.non_sdk_deps)) { |
| gn_deps += invoker.non_sdk_deps |
| } |
| |
| group(target_name) { |
| forward_variables_from(invoker, |
| [ |
| "assert_no_deps", |
| "metadata", |
| "testonly", |
| "visibility", |
| ]) |
| |
| public_deps = gn_deps |
| } |
| } |