From 913a9263d21f9a47a138f301e32837aa5815761d Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Thu, 5 Sep 2024 08:16:28 +0200 Subject: [PATCH 1/2] Bazel: stub internal repo parts needed for building rust binaries This is another shot at https://github.com/github/codeql/pull/17382, using a different and more lightweight approach. This allows building the ruby and python (and in the future also rust) packs from within the codeql repository. This will: * skip defining the glibc symbols checking, which only makes sense when building the release from the internal repository * stub out our `universal_binary` rule, which we only need when building the release. --- misc/bazel/rust.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/bazel/rust.bzl b/misc/bazel/rust.bzl index b858f6b0a80c..97afee4ba1c1 100644 --- a/misc/bazel/rust.bzl +++ b/misc/bazel/rust.bzl @@ -8,7 +8,7 @@ def codeql_rust_binary( visibility = None, symbols_test = True, **kwargs): - rust_label_name = name + "_single_arch" + rust_label_name = "single_arch/" + name universal_binary( name = name, dep = ":" + rust_label_name, From 7c80b33a63682c16509b71581310cc2e9d118971 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Thu, 5 Sep 2024 08:26:41 +0200 Subject: [PATCH 2/2] Bazel: add forgotten files --- misc/bazel/semmle_code_stub/buildutils-internal/BUILD.bazel | 0 .../buildutils-internal/glibc_symbols_check.bzl | 4 ++++ misc/bazel/semmle_code_stub/buildutils-internal/lipo.bzl | 5 +++++ 3 files changed, 9 insertions(+) create mode 100644 misc/bazel/semmle_code_stub/buildutils-internal/BUILD.bazel create mode 100644 misc/bazel/semmle_code_stub/buildutils-internal/glibc_symbols_check.bzl create mode 100644 misc/bazel/semmle_code_stub/buildutils-internal/lipo.bzl diff --git a/misc/bazel/semmle_code_stub/buildutils-internal/BUILD.bazel b/misc/bazel/semmle_code_stub/buildutils-internal/BUILD.bazel new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/misc/bazel/semmle_code_stub/buildutils-internal/glibc_symbols_check.bzl b/misc/bazel/semmle_code_stub/buildutils-internal/glibc_symbols_check.bzl new file mode 100644 index 000000000000..a9091008ba8c --- /dev/null +++ b/misc/bazel/semmle_code_stub/buildutils-internal/glibc_symbols_check.bzl @@ -0,0 +1,4 @@ +# This check only makes sense when building from the internal repository + +def glibc_symbols_check(**kwargs): + pass diff --git a/misc/bazel/semmle_code_stub/buildutils-internal/lipo.bzl b/misc/bazel/semmle_code_stub/buildutils-internal/lipo.bzl new file mode 100644 index 000000000000..733e15703dee --- /dev/null +++ b/misc/bazel/semmle_code_stub/buildutils-internal/lipo.bzl @@ -0,0 +1,5 @@ +# we only need to build universal binaries when building releases from the internal repo +# when building from the codeql repo, we can stub this rule with an alias + +def universal_binary(*, name, dep, **kwargs): + native.alias(name = name, actual = dep, **kwargs)