[bazel] Allow 'sbase_binaries' to be used by Bazel build rules This allows Bazel build rules to get the same list of sbase binaries as is used by GN. Bug: 505830390 Change-Id: I1548d74863e2011edb168b4ecc5a7610de5ff5b2 Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/sbase/+/1586928 Commit-Queue: Aaron Wood <aaronwood@google.com> Fuchsia-Auto-Submit: Aaron Wood <aaronwood@google.com> Reviewed-by: David Fang <fangism@google.com>
diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..49ade85 --- /dev/null +++ b/BUILD.bazel
@@ -0,0 +1,4 @@ +# Copyright 2026 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. +
diff --git a/binaries.bzl b/binaries.bzl new file mode 100644 index 0000000..f4494e5 --- /dev/null +++ b/binaries.bzl
@@ -0,0 +1,107 @@ +# Copyright 2026 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. + +# The following binaries are disabled: +# "chgrp", +# "chmod", +# "chown", +# "chroot", +# "cron", +# "flock", +# "getconf", +# "kill", +# "ln", +# "logger", +# "logname", +# "mkfifo", +# "nice", +# "nohup", +# "renice", +# "setsid", +# "time", +# "uname", +# "whoami", + +# The following binaries are disabled as they are shadowed by +# shell built-ins +# "echo", +# "false", +# "mv", +# "printf", +# "pwd", +# "test", +# "true", + + +sbase_binaries = [ + "basename", + "cal", + "cat", + "cksum", + "cmp", + "cols", + "comm", + "cp", + "cut", + "date", + "dirname", + "du", + "ed", + "env", + "expand", + "expr", + "find", + "fold", + "grep", + "head", + "hostname", + "join", + "link", + "ls", + "md5sum", + "mkdir", + "mktemp", + "nl", + "od", + "paste", + "pathchk", + "printenv", + "readlink", + "rev", + "rm", + "rmdir", + "sed", + "seq", + "sha1sum", + "sha224sum", + "sha256sum", + "sha384sum", + "sha512-224sum", + "sha512-256sum", + "sha512sum", + "sleep", + "sort", + "split", + "sponge", + "strings", + "sync", + "tail", + "tar", + "tee", + "tftp", + "touch", + "tr", + "tsort", + "tty", + "unexpand", + "uniq", + "unlink", + "uudecode", + "uuencode", + "wc", + "which", + "xargs", + "xinstall", + "yes", +]
diff --git a/binaries.gni b/binaries.gni index 1a0115c..8d9922b 100644 --- a/binaries.gni +++ b/binaries.gni
@@ -2,106 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# The following binaries are disabled: -# "chgrp", -# "chmod", -# "chown", -# "chroot", -# "cron", -# "flock", -# "getconf", -# "kill", -# "ln", -# "logger", -# "logname", -# "mkfifo", -# "nice", -# "nohup", -# "renice", -# "setsid", -# "time", -# "uname", -# "whoami", - -# The following binaries are disabled as they are shadowed by -# shell built-ins -# "echo", -# "false", -# "mv", -# "printf", -# "pwd", -# "test", -# "true", - - -sbase_binaries = [ - "basename", - "cal", - "cat", - "cksum", - "cmp", - "cols", - "comm", - "cp", - "cut", - "date", - "dirname", - "du", - "ed", - "env", - "expand", - "expr", - "find", - "fold", - "grep", - "head", - "hostname", - "join", - "link", - "ls", - "md5sum", - "mkdir", - "mktemp", - "nl", - "od", - "paste", - "pathchk", - "printenv", - "readlink", - "rev", - "rm", - "rmdir", - "sed", - "seq", - "sha1sum", - "sha224sum", - "sha256sum", - "sha384sum", - "sha512-224sum", - "sha512-256sum", - "sha512sum", - "sleep", - "sort", - "split", - "sponge", - "strings", - "sync", - "tail", - "tar", - "tee", - "tftp", - "touch", - "tr", - "tsort", - "tty", - "unexpand", - "uniq", - "unlink", - "uudecode", - "uuencode", - "wc", - "which", - "xargs", - "xinstall", - "yes", -] +# import 'sbase_binaries' from a file that we can share with Bazel. +# +# Yes, this works. Because the Bazel file in question is using a syntax that also parses as GN, we +# can do this. +import("binaries.bzl") \ No newline at end of file