Files
Etienne Perot 9ca09375e4 Add tool to generate a Go library that executes an embedded compressed binary.
This creates a `go_template` that can generate a `go_library` rule which
extracts a compressed binary to a temporary location, then executes it.

This is useful to implement `runsc` subcommands without requiring that these
subcommands' dependencies are linked into the main `runsc` binary.

PiperOrigin-RevId: 557270682
2023-08-15 15:32:43 -07:00

28 lines
830 B
Python

load("//tools:defs.bzl", "go_binary", "go_test")
package(
default_applicable_licenses = ["//:license"],
licenses = ["notice"],
)
# helloworld_bundler is a Go program that imports helloworld/helloworld.go and
# calls its functions. Therefore, it should print "Hello, gVisor!\n" to stdout,
# as helloworld/helloworld_bundlee.go does.
go_binary(
name = "helloworld_bundler",
srcs = ["helloworld_bundler.go"],
deps = [
"//tools/embeddedbinary/test/helloworld",
"@org_golang_x_sys//unix:go_default_library",
],
)
# helloworld_test is a test that executes helloworld_bundler as a subprocess.
# It verifies that its output is "Hello, gVisor!\n".
go_test(
name = "helloworld_test",
srcs = ["helloworld_test.go"],
data = [":helloworld_bundler"],
deps = ["//pkg/test/testutil"],
)