Skip to content

Commit 7bb781b

Browse files
tomgrEdSchouten
authored andcommitted
Workaround rules_js issue
Following Ed's suggestion: the previous CI failures show that rules_js is incorrectly building the tools for the target platform, instead of the host. Given this is just a stylesheet, we can workaround this by manually transitioning to the host platform.
1 parent bad37ae commit 7bb781b

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ bazel_dep(name = "googleapis", version = "0.0.0-20250604-de157ca3")
99
bazel_dep(name = "jsonnet_go", version = "0.21.0")
1010
bazel_dep(name = "opentelemetry-proto", version = "1.7.0")
1111
bazel_dep(name = "toolchains_protoc", version = "0.4.3") # must come BEFORE protobuf so the toolchain registration wins
12+
bazel_dep(name = "platforms", version = "1.0.0")
1213
bazel_dep(name = "protobuf", version = "31.1")
1314
bazel_dep(name = "rules_go", version = "0.55.1")
1415
bazel_dep(name = "rules_jsonnet", version = "0.7.2")

MODULE.bazel.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/otel/BUILD.bazel

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
12
load("@aspect_rules_js//js:defs.bzl", "js_run_binary")
23
load("@com_github_buildbarn_bb_storage_npm//:purgecss/package_json.bzl", purgecss_bin = "bin")
34
load("@rules_go//go:def.bzl", "go_library", "go_test")
@@ -11,9 +12,10 @@ go_library(
1112
"maximum_rate_sampler.go",
1213
"w3c_trace_context.go",
1314
],
15+
# keep
1416
embedsrcs = [
1517
"active_spans.html",
16-
"stylesheet.css",
18+
":stylesheet",
1719
],
1820
importpath = "github.com/buildbarn/bb-storage/pkg/otel",
1921
visibility = ["//visibility:public"],
@@ -43,7 +45,8 @@ go_test(
4345
"maximum_rate_sampler_test.go",
4446
"w3c_trace_context_test.go",
4547
],
46-
embedsrcs = ["stylesheet.css"],
48+
# keep
49+
embedsrcs = [":stylesheet"],
4750
deps = [
4851
":otel",
4952
"//internal/mock",
@@ -68,7 +71,7 @@ purgecss_bin.purgecss_binary(
6871
# Create a copy of Bootstrap that only contains the style attributes
6972
# used by the HTML template.
7073
js_run_binary(
71-
name = "stylesheet",
74+
name = "stylesheet_platform",
7275
srcs = [
7376
"active_spans.html",
7477
"@com_github_twbs_bootstrap//:css/bootstrap.min.css",
@@ -85,7 +88,15 @@ js_run_binary(
8588
"../../../$(location stylesheet.css)",
8689
],
8790
copy_srcs_to_bin = False,
91+
tags = ["manual"],
8892
tool = ":purgecss",
89-
# https://github.com/aspect-build/rules_js/issues/2121
90-
use_execroot_entry_point = False,
93+
)
94+
95+
# Work around https://github.com/aspect-build/rules_js/issues/2121 by always
96+
# building the stylesheet for the host platform, even if we are cross
97+
# compiling.
98+
platform_transition_filegroup(
99+
name = "stylesheet",
100+
srcs = [":stylesheet_platform"],
101+
target_platform = "@platforms//host",
91102
)

0 commit comments

Comments
 (0)