Skip to content

Commit

Permalink
Add platform_overrides.bcfg
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Gabriel Agamennoni authored and facebook-github-bot committed Oct 31, 2024
1 parent 4b5abd7 commit d853230
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion prelude/transitions/constraint_overrides.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
Expand All @@ -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()

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit d853230

Please sign in to comment.