osbase/build: migrate ignore_unused_configuration transition
We will use it for other external builds, so lets move it there
for easier reuse.
Change-Id: Ib15e299068a34f94e47add115d309f659701b36a
Reviewed-on: https://review.monogon.dev/c/monogon/+/4083
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/osbase/build/def.bzl b/osbase/build/def.bzl
index e88614b..f3ef7a9 100644
--- a/osbase/build/def.bzl
+++ b/osbase/build/def.bzl
@@ -40,3 +40,36 @@
"//command_line_option:platforms",
],
)
+
+_new_settings = {
+ # This list should be expanded with any configuration options that end
+ # up reaching this rule with different values across different build
+ # graph paths, but that do not actually influence the kernel build.
+ # Force-setting them to a stable value forces the build configuration
+ # to a stable hash.
+ # See the transition's comment block for more information.
+ "@io_bazel_rules_go//go/config:pure": False,
+ "@io_bazel_rules_go//go/config:static": False,
+
+ # Note: this toolchain is not actually used to perform the build.
+ "//command_line_option:platforms": "//build/platforms:linux_amd64_static",
+}
+
+def _ignore_unused_configuration_impl(_settings, _attr):
+ return _new_settings
+
+# Transition to flip all known-unimportant but varying configuration options to
+# a known, stable value.
+# This is to prevent Bazel from creating extra configurations for possible
+# combinations of options in case the linux_image rule is pulled through build
+# graph fragments that have different options set.
+#
+# Ideally, Bazel would let us mark in a list that we only care about some set
+# of options (or at least let us mark those that we explicitly don't care
+# about, instead of manually setting them to some value). However, this doesn't
+# seem to be possible, thus this transition is a bit of a hack.
+ignore_unused_configuration = transition(
+ implementation = _ignore_unused_configuration_impl,
+ inputs = [],
+ outputs = list(_new_settings.keys()),
+)
diff --git a/third_party/linux/def.bzl b/third_party/linux/def.bzl
index 4c6798c..036743e 100644
--- a/third_party/linux/def.bzl
+++ b/third_party/linux/def.bzl
@@ -24,39 +24,7 @@
"""
load("//build/utils:detect_root.bzl", "detect_root")
-
-_new_settings = {
- # This list should be expanded with any configuration options that end
- # up reaching this rule with different values across different build
- # graph paths, but that do not actually influence the kernel build.
- # Force-setting them to a stable value forces the build configuration
- # to a stable hash.
- # See the transition's comment block for more information.
- "@io_bazel_rules_go//go/config:pure": False,
- "@io_bazel_rules_go//go/config:static": False,
-
- # Note: this toolchain is not actually used to perform the build.
- "//command_line_option:platforms": "//build/platforms:linux_amd64_static",
-}
-
-def _ignore_unused_configuration_impl(_settings, _attr):
- return _new_settings
-
-# Transition to flip all known-unimportant but varying configuration options to
-# a known, stable value.
-# This is to prevent Bazel from creating extra configurations for possible
-# combinations of options in case the linux_image rule is pulled through build
-# graph fragments that have different options set.
-#
-# Ideally, Bazel would let us mark in a list that we only care about some set
-# of options (or at least let us mark those that we explicitly don't care
-# about, instead of manually setting them to some value). However, this doesn't
-# seem to be possible, thus this transition is a bit of a hack.
-ignore_unused_configuration = transition(
- implementation = _ignore_unused_configuration_impl,
- inputs = [],
- outputs = list(_new_settings.keys()),
-)
+load("//osbase/build:def.bzl", "ignore_unused_configuration")
def _linux_image_impl_resources(_os, _ninputs):
"""