diff options
author | Adin Scannell <ascannell@google.com> | 2020-05-07 13:17:33 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-05-07 13:19:01 -0700 |
commit | 1f4087e7cd6c3cc696e6b26446abd6c5214cfd67 (patch) | |
tree | 3223009bdb84ffd357a0fa0b1bb61531119a4e72 | |
parent | 28b5565fdd87155dd5c37fff427884a772f01c72 (diff) |
Fix tags used for determining file sets.
Updates #2569
Updates #2298
PiperOrigin-RevId: 310423629
-rw-r--r-- | tools/bazeldefs/tags.bzl | 62 |
1 files changed, 39 insertions, 23 deletions
diff --git a/tools/bazeldefs/tags.bzl b/tools/bazeldefs/tags.bzl index 558fb53ae..f5d7a7b21 100644 --- a/tools/bazeldefs/tags.bzl +++ b/tools/bazeldefs/tags.bzl @@ -1,40 +1,56 @@ """List of special Go suffixes.""" -go_suffixes = [ +def explode(tagset, suffixes): + """explode combines tagset and suffixes in all ways. + + Args: + tagset: Original suffixes. + suffixes: Suffixes to combine before and after. + + Returns: + The set of possible combinations. + """ + result = [t for t in tagset] + result += [s for s in suffixes] + for t in tagset: + result += [t + s for s in suffixes] + result += [s + t for s in suffixes] + return result + +archs = [ "_386", - "_386_unsafe", "_aarch64", - "_aarch64_unsafe", "_amd64", - "_amd64_unsafe", "_arm", "_arm64", - "_arm64_unsafe", - "_arm_unsafe", - "_impl", - "_impl_unsafe", - "_linux", - "_linux_unsafe", "_mips", "_mips64", - "_mips64_unsafe", "_mips64le", - "_mips64le_unsafe", - "_mips_unsafe", "_mipsle", - "_mipsle_unsafe", - "_opts", - "_opts_unsafe", "_ppc64", - "_ppc64_unsafe", "_ppc64le", - "_ppc64le_unsafe", "_riscv64", - "_riscv64_unsafe", "_s390x", - "_s390x_unsafe", "_sparc64", - "_sparc64_unsafe", - "_wasm", - "_wasm_unsafe", + "_x86", +] + +oses = [ + "_linux", ] + +generic = [ + "_impl", + "_race", + "_norace", + "_unsafe", + "_opts", +] + +# State explosion? Sure. This is approximately: +# len(archs) * (1 + 2 * len(oses) * (1 + 2 * len(generic)) +# +# This evaluates to 495 at the time of writing. So it's a lot of different +# combinations, but not so much that it will cause issues. We can probably add +# quite a few more variants before this becomes a genuine problem. +go_suffixes = explode(explode(archs, oses), generic) |