diff options
author | Adin Scannell <ascannell@google.com> | 2020-07-23 18:00:12 -0700 |
---|---|---|
committer | Adin Scannell <ascannell@google.com> | 2020-07-23 18:00:12 -0700 |
commit | ab0262bd94c25bc91d5e0d831b75729c253dfde6 (patch) | |
tree | a4a75c66b92b136ed1e250b4b9641a15808bf123 /tools/go_generics/defs.bzl | |
parent | 14839e027f5310346718aea385cea5e45f017170 (diff) |
Convert go_generics tests to starlark.
For some reason these tests were broken when run via the bazel docker
container. The mechanism used was a bit crazy (self-extracting bundle),
so convert them to use straight-forward starlark rules. This has the
added advantaged that they are now independent tests.
Diffstat (limited to 'tools/go_generics/defs.bzl')
-rw-r--r-- | tools/go_generics/defs.bzl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/go_generics/defs.bzl b/tools/go_generics/defs.bzl index ec047a644..7fe7d7e59 100644 --- a/tools/go_generics/defs.bzl +++ b/tools/go_generics/defs.bzl @@ -100,7 +100,8 @@ def _go_template_instance_impl(ctx): # Build the argument list. args = ["-i=%s" % template.file.path, "-o=%s" % output.path] - args += ["-p=%s" % ctx.attr.package] + if ctx.attr.package: + args += ["-p=%s" % ctx.attr.package] if len(ctx.attr.prefix) > 0: args += ["-prefix=%s" % ctx.attr.prefix] @@ -151,7 +152,7 @@ go_template_instance = rule( "consts": attr.string_dict(), "imports": attr.string_dict(), "anon": attr.bool(mandatory = False, default = False), - "package": attr.string(mandatory = True), + "package": attr.string(mandatory = False), "out": attr.output(mandatory = True), "_tool": attr.label(executable = True, cfg = "host", default = Label("//tools/go_generics")), }, |