Skip to content

Commit 70416c6

Browse files
authored
Hotfix: bazel sync fails when skipping platforms (#1)
* hotfix: bazel sync fails when skipping platforms * change stub from filegroup to cc_library
1 parent d96010b commit 70416c6

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ package(default_visibility = ["//visibility:public"])
33
exports_files([
44
"pkg_config.bzl",
55
"BUILD.tmpl",
6+
"BUILD.empty.tmpl",
67
])

BUILD.empty.tmpl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# vi: ft=bzl
2+
# Skipped on platform %{platform} by rule configuration
3+
4+
cc_library(
5+
name = "lib",
6+
srcs = [],
7+
hdrs = [],
8+
visibility = ["//visibility:public"],
9+
)
10+
11+
cc_library(
12+
name = "internal_lib",
13+
srcs = [],
14+
visibility = ["//visibility:public"],
15+
)

pkg_config.bzl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ def _pkg_config_impl(ctx):
137137
os_name = _get_current_platform(ctx)
138138
pkg_name = ctx.attr.pkg_name
139139
if os_name in ctx.attr.skip_platforms:
140-
ctx.file("BUILD", "# Skipped on platform {} by rule configuration".format(os_name))
140+
ctx.template("BUILD", Label("//:BUILD.empty.tmpl"), substitutions = {
141+
"%{platform}": os_name,
142+
}, executable = False)
141143
# If we should not build on current platform, then the procedure finishes here.
142144
# We would consider this as successful.
143145
message_string = "Local lib '{}' skipped on platform {} by rule configuration".format(pkg_name, os_name)

0 commit comments

Comments
 (0)