[grand_unified_binary] Delete
This is now only used by netstack.
//src/connectivity/network/netstack/stub is retained because:
- `func main` must appear in `package main`.
- `src/connectivity/network/netstack/main.go` refers to unexported items
from `go.fuchsia.dev/fuchsia/src/connectivity/network/netstack`.
- unexported items defined in `main.go` are referenced from other files
in `go.fuchsia.dev/fuchsia/src/connectivity/network/netstack`.
Fixed: 103205
Change-Id: I9056d7ef0fcc6c85d9b9a374bb9d4478c7ca813a
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/693788
Reviewed-by: Bruno Dal Bo <brunodalbo@google.com>
Fuchsia-Auto-Submit: Tamir Duberstein <tamird@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
diff --git a/build/images/shell_commands.py b/build/images/shell_commands.py
index 0039ea8..7ece6e3 100644
--- a/build/images/shell_commands.py
+++ b/build/images/shell_commands.py
@@ -46,11 +46,6 @@
dest = dist["destination"]
if not dest.startswith("bin/"):
continue
- if dest == "bin/grand_unified_binary":
- # This binary may arrive via multiple deps because it's commonly
- # renamed and reused. Ignore it so as not to create conflicting
- # shebang files.
- continue
shebang_file = os.path.join(
args.output_directory, "__untraced_shebangs__", dest)
shebang_files.append(shebang_file)
diff --git a/docs/development/build/build_system/internals/manifest_formats.md b/docs/development/build/build_system/internals/manifest_formats.md
index aceefc8..1c6fd64 100644
--- a/docs/development/build/build_system/internals/manifest_formats.md
+++ b/docs/development/build/build_system/internals/manifest_formats.md
@@ -156,9 +156,9 @@
These entries are used to indicate that a given regular entry should be
installed at an alternative destination location. This is useful for certain
-programs (e.g. `busybox`, `grand_unified_binary`) which will behave differently,
-depending on the program name used to launch them. The `renamed_binary()` GN
-template relies on them. Their schema is:
+programs (e.g. `busybox`) which will behave differently, depending on the
+program name used to launch them. The `renamed_binary()` GN template relies on
+them. Their schema is:
- `destination`: A destination path string (REQUIRED).
diff --git a/src/connectivity/network/netstack/BUILD.gn b/src/connectivity/network/netstack/BUILD.gn
index 9a2b27b..455b3c3 100644
--- a/src/connectivity/network/netstack/BUILD.gn
+++ b/src/connectivity/network/netstack/BUILD.gn
@@ -8,12 +8,14 @@
import("//build/go/go_test.gni")
import("//build/go/toolchain.gni")
import("//build/test.gni")
-import("//src/go/grand_unified_binary/gub.gni")
import("gentool/generated.gni")
import("tracing/go_tracing_include_dirs.gni")
-grand_unified_binary("bin") {
- output_name = "netstack"
+go_binary("bin") {
+ gopackage = "go.fuchsia.dev/fuchsia/src/connectivity/network/netstack/stub"
+ output_name = string_replace(target_name, "bin", "netstack")
+
+ deps = [ "stub" ]
}
fuchsia_component("component") {
diff --git a/src/go/grand_unified_binary/BUILD.gn b/src/go/grand_unified_binary/BUILD.gn
deleted file mode 100644
index 5501a8f..0000000
--- a/src/go/grand_unified_binary/BUILD.gn
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright 2019 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/go/go_binary.gni")
-import("//build/go/go_library.gni")
-
-go_library("lib") {
- deps = [ "//src/connectivity/network/netstack:lib" ]
- sources = [ "gub.go" ]
-}
-
-go_binary("grand_unified_binary") {
- gopackage = "go.fuchsia.dev/fuchsia/src/go/grand_unified_binary"
-
- deps = [ ":lib" ]
-}
diff --git a/src/go/grand_unified_binary/OWNERS b/src/go/grand_unified_binary/OWNERS
deleted file mode 100644
index 5d8eafd..0000000
--- a/src/go/grand_unified_binary/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-include /src/connectivity/network/OWNERS
-include /src/sys/pkg/OWNERS
diff --git a/src/go/grand_unified_binary/gub.gni b/src/go/grand_unified_binary/gub.gni
deleted file mode 100644
index 07f4ffe..0000000
--- a/src/go/grand_unified_binary/gub.gni
+++ /dev/null
@@ -1,49 +0,0 @@
-# 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/renamed_binary.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
-#
-# source_name (optional)
-# The source binary's name.
-# Type: string
-# Default: "grand_unified_binary"
-#
-# testonly
-# visibility
-template("grand_unified_binary") {
- output_name = target_name
- if (defined(invoker.output_name)) {
- output_name = invoker.output_name
- }
- source_name = "grand_unified_binary"
- if (defined(invoker.source_name)) {
- source_name = invoker.source_name
- }
-
- renamed_binary(target_name) {
- forward_variables_from(invoker,
- [
- "testonly",
- "visibility",
- ])
- source_deps = [ "//src/go/grand_unified_binary:$source_name" ]
- source = "$root_out_dir/$source_name"
- dest = "bin/$output_name"
- }
-}
diff --git a/src/go/grand_unified_binary/gub.go b/src/go/grand_unified_binary/gub.go
deleted file mode 100644
index 7054519..0000000
--- a/src/go/grand_unified_binary/gub.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2019 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.
-
-//go:build !build_with_native_toolchain
-// +build !build_with_native_toolchain
-
-// The Fuchsia Go Grand Unified Binary is a binary that contains several other
-// binaries, so done in order to reduce the amount of disk space and shared
-// memory required to run Fuchsia subsystems written in Go. This combination
-// saves >=50% of storage and ram cost on a running system at boot/update time.
-package main
-
-import (
- "log"
- "os"
- "path/filepath"
- "strings"
-
- "go.fuchsia.dev/fuchsia/src/connectivity/network/netstack"
-)
-
-func main() {
- if len(os.Args) < 1 {
- log.Println("grand unified binary: cannot determine binary, no argv 0")
- os.Exit(1)
- }
- name := filepath.Base(os.Args[0])
- name = strings.SplitN(name, ".", 2)[0]
- switch name {
- case "netstack":
- netstack.Main()
- default:
- log.Printf("grand unified binary: unknown inner binary name: %s (%s)", name, os.Args[0])
- os.Exit(1)
- }
-}