|  | # 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("//build/dist/resource.gni") | 
|  |  | 
|  | # Defines a renamed binary based on grand_unified_binary. | 
|  | # | 
|  | # GUB is a single binary that merges together multiple Go programs. | 
|  | # The entry point to the combined program can identify which sub-program the | 
|  | # caller intends to run based on the filename of the invocation (`argv[0]`). | 
|  | # | 
|  | # This template offers dependents a renamed grand_unified_binary binary. | 
|  | # | 
|  | # Parameters | 
|  | # | 
|  | #   output_name (optional) | 
|  | #     The renamed binary's name. | 
|  | #     Type: string | 
|  | #     Default: target_name | 
|  | # | 
|  | #   testonly | 
|  | #   visibility | 
|  | template("grand_unified_binary") { | 
|  | output_name = target_name | 
|  | if (defined(invoker.output_name)) { | 
|  | output_name = invoker.output_name | 
|  | } | 
|  |  | 
|  | resource(target_name) { | 
|  | forward_variables_from(invoker, | 
|  | [ | 
|  | "testonly", | 
|  | "visibility", | 
|  | ]) | 
|  | data_deps = [ "//src/go/grand_unified_binary" ] | 
|  | sources = [ "$root_out_dir/grand_unified_binary" ] | 
|  | outputs = [ "bin/$output_name" ] | 
|  | } | 
|  | } |