Skip to content

Commit

Permalink
Go: introduce universal binaries on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
redsun82 committed Apr 25, 2024
1 parent 393f6b7 commit 34b41de
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 13 deletions.
3 changes: 2 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ local_path_override(

# see https://registry.bazel.build/ for a list of available packages

bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "apple_support", version = "1.15.1")
bazel_dep(name = "platforms", version = "0.0.9")
bazel_dep(name = "rules_go", version = "0.47.0")
bazel_dep(name = "rules_pkg", version = "0.10.1")
bazel_dep(name = "rules_nodejs", version = "6.0.3")
Expand Down
Empty file added go/BUILD.bazel
Empty file.
1 change: 1 addition & 0 deletions go/extractor/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("@rules_go//go:def.bzl", "go_library")

# gazelle:prefix github.com/github/codeql-go/extractor
# gazelle:map_kind go_binary codeql_go_binary //go:rules.bzl

go_library(
name = "extractor",
Expand Down
5 changes: 3 additions & 2 deletions go/extractor/cli/go-autobuilder/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions go/extractor/cli/go-bootstrap/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions go/extractor/cli/go-build-runner/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions go/extractor/cli/go-extractor/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions go/extractor/cli/go-gen-dbscheme/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions go/extractor/cli/go-tokenizer/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions go/rules.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
load("@rules_go//go:def.bzl", "go_binary")
load("@apple_support//rules:universal_binary.bzl", "universal_binary")

def codeql_go_binary(*, name, visibility = None, **kwargs):
internal_name = "internal/%s" % name
universal_name = "universal/%s" % name
go_binary(
name = internal_name,
**kwargs
)
universal_binary(
name = universal_name,
target_compatible_with = ["@platforms//os:macos"],
binary = internal_name,
)
native.alias(
actual = select({
"@platforms//os:macos": universal_name,
"//conditions:default": internal_name,
}),
name = name,
visibility = visibility,
)

0 comments on commit 34b41de

Please sign in to comment.