From d853230bdca38060ade4107172825c19e8e3c195 Mon Sep 17 00:00:00 2001 From: Gabriel Agamennoni Date: Thu, 31 Oct 2024 01:59:13 -0700 Subject: [PATCH] Add platform_overrides.bcfg Summary: Similarly to `constraint_overrides`, this config value will store a list of all supported target platforms. Reviewed By: mojsarn Differential Revision: D65060011 fbshipit-source-id: 40680012eb069ef1713fd3e51805099384346b38 --- prelude/transitions/constraint_overrides.bzl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/prelude/transitions/constraint_overrides.bzl b/prelude/transitions/constraint_overrides.bzl index 449a89a7b9183..6adadb64f36ae 100644 --- a/prelude/transitions/constraint_overrides.bzl +++ b/prelude/transitions/constraint_overrides.bzl @@ -9,6 +9,10 @@ # hard-coded here. We use a read_config to avoid hard-coding these repo-specific # constraints into the prelude. +def _platform_overrides() -> list[str]: + config = read_root_config("buck2", "platform_overrides", "") + return [override.strip() for override in config.split(",") if override.strip()] + def _constraint_overrides() -> list[str]: overrides = read_root_config("buck2", "constraint_overrides", "") return [override.strip() for override in overrides.split(",") if override.strip()] @@ -17,6 +21,7 @@ def _constraint_passthroughs() -> list[str]: passthroughs = read_root_config("buck2", "constraint_passthroughs", "") return [passthrough.strip() for passthrough in passthroughs.split(",") if passthrough.strip()] +_PLATFORM_OVERRIDES = _platform_overrides() _CONSTRAINT_OVERRIDES = _constraint_overrides() _CONSTRAINT_PASSTHROUGHS = _constraint_passthroughs() @@ -97,7 +102,7 @@ _attributes = { _transition = transition( impl = _impl, attrs = _attributes.keys(), - refs = {override: override for override in _CONSTRAINT_OVERRIDES}, + refs = {override: override for override in _PLATFORM_OVERRIDES + _CONSTRAINT_OVERRIDES}, ) constraint_overrides = struct(