summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorKevin Krakauer <krakauer@google.com>2020-02-06 17:07:04 -0800
committerKevin Krakauer <krakauer@google.com>2020-02-06 17:07:04 -0800
commitd98287f5eb40a9c91668b7511824c05d542e0599 (patch)
treef8430747db6e1c02fe0eb45a7dad0899d06bd072 /tools
parentbf0ea204e9415a181c63ee10078cca753df14f7e (diff)
parent16561e461e82f8d846ef1f3ada990270ef39ccc6 (diff)
Merge branch 'master' into tcp-matchers-submit
Diffstat (limited to 'tools')
-rw-r--r--tools/build/tags.bzl4
-rw-r--r--tools/defs.bzl17
-rw-r--r--tools/images/defs.bzl5
-rw-r--r--tools/installers/BUILD7
-rwxr-xr-xtools/installers/head.sh2
5 files changed, 31 insertions, 4 deletions
diff --git a/tools/build/tags.bzl b/tools/build/tags.bzl
index e99c87f81..a6db44e47 100644
--- a/tools/build/tags.bzl
+++ b/tools/build/tags.bzl
@@ -33,4 +33,8 @@ go_suffixes = [
"_wasm_unsafe",
"_linux",
"_linux_unsafe",
+ "_opts",
+ "_opts_unsafe",
+ "_impl",
+ "_impl_unsafe",
]
diff --git a/tools/defs.bzl b/tools/defs.bzl
index 5d5fa134a..c03b557ae 100644
--- a/tools/defs.bzl
+++ b/tools/defs.bzl
@@ -73,6 +73,16 @@ def calculate_sets(srcs):
result[target].append(file)
return result
+def go_imports(name, src, out):
+ """Simplify a single Go source file by eliminating unused imports."""
+ native.genrule(
+ name = name,
+ srcs = [src],
+ outs = [out],
+ tools = ["@org_golang_x_tools//cmd/goimports:goimports"],
+ cmd = ("$(location @org_golang_x_tools//cmd/goimports:goimports) $(SRCS) > $@"),
+ )
+
def go_library(name, srcs, deps = [], imports = [], stateify = True, marshal = False, **kwargs):
"""Wraps the standard go_library and does stateification and marshalling.
@@ -107,10 +117,15 @@ def go_library(name, srcs, deps = [], imports = [], stateify = True, marshal = F
state_sets = calculate_sets(srcs)
for (suffix, srcs) in state_sets.items():
go_stateify(
- name = name + suffix + "_state_autogen",
+ name = name + suffix + "_state_autogen_with_imports",
srcs = srcs,
imports = imports,
package = name,
+ out = name + suffix + "_state_autogen_with_imports.go",
+ )
+ go_imports(
+ name = name + suffix + "_state_autogen",
+ src = name + suffix + "_state_autogen_with_imports.go",
out = name + suffix + "_state_autogen.go",
)
all_srcs = all_srcs + [
diff --git a/tools/images/defs.bzl b/tools/images/defs.bzl
index 32235813a..de365d153 100644
--- a/tools/images/defs.bzl
+++ b/tools/images/defs.bzl
@@ -57,7 +57,10 @@ def _vm_image_impl(ctx):
command = argv,
input_manifests = runfiles_manifests,
)
- return [DefaultInfo(files = depset([ctx.outputs.out]))]
+ return [DefaultInfo(
+ files = depset([ctx.outputs.out]),
+ runfiles = ctx.runfiles(files = [ctx.outputs.out]),
+ )]
_vm_image = rule(
attrs = {
diff --git a/tools/installers/BUILD b/tools/installers/BUILD
index 01bc4de8c..d78a265ca 100644
--- a/tools/installers/BUILD
+++ b/tools/installers/BUILD
@@ -5,10 +5,15 @@ package(
licenses = ["notice"],
)
+filegroup(
+ name = "runsc",
+ srcs = ["//runsc"],
+)
+
sh_binary(
name = "head",
srcs = ["head.sh"],
- data = ["//runsc"],
+ data = [":runsc"],
)
sh_binary(
diff --git a/tools/installers/head.sh b/tools/installers/head.sh
index 4435cb27a..9de8f138c 100755
--- a/tools/installers/head.sh
+++ b/tools/installers/head.sh
@@ -15,7 +15,7 @@
# limitations under the License.
# Install our runtime.
-third_party/gvisor/runsc/runsc install
+$(dirname $0)/runsc install
# Restart docker.
service docker restart || true