Skip to content

Commit c7fa4c4

Browse files
Tarkan Al-Kazilyfacebook-github-bot
Tarkan Al-Kazily
authored andcommitted
Use buck transclusion to simplify constraint_overrides.bzl
Summary: This simplifies `constraint_overrides.bzl` to only depend on single configs for the input list of allowed `constraint_overrides` and `platform_overrides`. Manually maintained configs are renamed for clarity do distinguish them from the generated configs (and because `$(config)` cannot reference the same config it's modifying). BUCK transclusion: https://buck2.build/docs/concepts/buckconfig/#transclusion-of-values-from-one-key-to-another Reviewed By: scottcao Differential Revision: D68281409 fbshipit-source-id: 448ca988da7319a40ccb146428397c2f338b11cf
1 parent a90344f commit c7fa4c4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

prelude/transitions/constraint_overrides.bzl

+4-8
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
# NOTE: Currently, constraints can't be propagated via rule attrs and so need to be
99
# hard-coded here. We use a read_config to avoid hard-coding these repo-specific
1010
# constraints into the prelude.
11+
# The following configs must be set to use constraint_overrides.bzl:
12+
# - buck2.platforms
13+
# - buck2.constraints
14+
# - buck2.passthrough_constraints
1115

1216
def _platforms() -> list[str]:
1317
platforms = []
1418
config = read_root_config("buck2", "platforms", "")
1519
platforms.extend(
1620
[platform.strip() for platform in config.split(",") if platform.strip()],
1721
)
18-
config = read_root_config("buck2", "generated_platforms", "")
19-
platforms.extend(
20-
[platform.strip() for platform in config.split(",") if platform.strip()],
21-
)
2222
return platforms
2323

2424
def _constraints() -> list[str]:
@@ -27,10 +27,6 @@ def _constraints() -> list[str]:
2727
constraints.extend(
2828
[constraint.strip() for constraint in config.split(",") if constraint.strip()],
2929
)
30-
config = read_root_config("buck2", "generated_constraints", "")
31-
constraints.extend(
32-
[constraint.strip() for constraint in config.split(",") if constraint.strip()],
33-
)
3430
return constraints
3531

3632
_passthrough_constraints_val = read_root_config("buck2", "passthrough_constraints", "")

0 commit comments

Comments
 (0)