Skip to content

Commit 5b5dfc6

Browse files
committed
Update cc_common.link API hack
Closes #589.
1 parent 77378e9 commit 5b5dfc6

File tree

11 files changed

+48
-30
lines changed

11 files changed

+48
-30
lines changed

BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ filegroup(
3434
":BUILD.bazel",
3535
":MODULE.bazel",
3636
":WORKSPACE",
37+
"//tools:all_files",
3738
"//zig:all_files",
3839
],
3940
visibility = ["//visibility:public"],

MODULE.bazel

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,3 @@ use_repo(
8989
# rules_bazel_integration_test/tools/update_deleted_packages.sh when invoked
9090
# through the rules_multirun target //util:update.
9191
bazel_dep(name = "cgrindel_bazel_starlib", version = "0.29.3", dev_dependency = True)
92-
93-
# Hack to get around a cc_common.link(main_output) private API limitation.
94-
# See https://github.com/bazelbuild/bazel/pull/23838
95-
cc_common_link = use_repo_rule("//zig/private/bzlmod:cc_common_link.bzl", "cc_common_link")
96-
97-
cc_common_link(name = "build_bazel_rules_android")

tools/BUILD.bazel

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Execute `bazel run //util:update_filegroups` to update this target.
2+
filegroup(
3+
name = "all_files",
4+
srcs = [
5+
":BUILD.bazel",
6+
"//tools/build_defs:all_files",
7+
],
8+
visibility = ["//:__pkg__"],
9+
)

tools/build_defs/BUILD.bazel

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Execute `bazel run //util:update_filegroups` to update this target.
2+
filegroup(
3+
name = "all_files",
4+
srcs = [
5+
":BUILD.bazel",
6+
"//tools/build_defs/android:all_files",
7+
],
8+
visibility = ["//tools:__pkg__"],
9+
)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
2+
3+
bzl_library(
4+
name = "cc_common_link",
5+
srcs = ["cc_common_link.bzl"],
6+
visibility = ["//zig:__subpackages__"],
7+
deps = ["@bazel_skylib//lib:paths"],
8+
)
9+
10+
# Execute `bazel run //util:update_filegroups` to update this target.
11+
filegroup(
12+
name = "all_files",
13+
srcs = [
14+
":BUILD.bazel",
15+
":cc_common_link.bzl",
16+
],
17+
visibility = ["//tools/build_defs:__pkg__"],
18+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""A module that exposes private APIs of cc_common.link.
2+
3+
See https://github.com/bazelbuild/bazel/pull/23838#issuecomment-3756393397.
4+
"""
5+
6+
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
7+
8+
def cc_common_link(*args, **kwargs):
9+
return cc_common.link(*args, **kwargs)

zig/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ bzl_library(
6666
visibility = ["//visibility:public"],
6767
deps = [
6868
"//zig/private:platforms",
69-
"//zig/private/bzlmod:cc_common_link",
7069
"//zig/private/bzlmod:zig",
7170
"//zig/private/common:semver",
7271
"//zig/private/repo:toolchains_repo",

zig/private/bzlmod/BUILD.bazel

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,11 @@ bzl_library(
1111
],
1212
)
1313

14-
bzl_library(
15-
name = "cc_common_link",
16-
srcs = ["cc_common_link.bzl"],
17-
visibility = ["//zig:__subpackages__"],
18-
)
19-
2014
# Execute `bazel run //util:update_filegroups` to update this target.
2115
filegroup(
2216
name = "all_files",
2317
srcs = [
2418
":BUILD.bazel",
25-
":cc_common_link.bzl",
2619
":zig.bzl",
2720
],
2821
visibility = ["//zig/private:__pkg__"],

zig/private/bzlmod/cc_common_link.bzl

Lines changed: 0 additions & 14 deletions
This file was deleted.

zig/private/common/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ bzl_library(
3333
":zig_cache",
3434
":zig_lib_dir",
3535
":zig_target_triple",
36+
"//tools/build_defs/android:cc_common_link",
3637
"//zig:bazel_tools",
3738
"//zig/private/providers:zig_module_info",
3839
"//zig/private/providers:zig_settings_info",
3940
"//zig/private/providers:zig_target_info",
40-
"@build_bazel_rules_android//:cc_common_link.bzl",
4141
"@rules_cc//cc:find_cc_toolchain_bzl",
4242
"@rules_cc//cc/common",
4343
],

0 commit comments

Comments
 (0)