Skip to content

Commit

Permalink
Simplify helper functions in constraint_overrides.bzl
Browse files Browse the repository at this point in the history
Summary: Make `_platforms()` and `_constraints()` implementation match `_passthrough_constraints_val`.

Reviewed By: gabagam

Differential Revision: D68295735

fbshipit-source-id: a5a2f465855688d739b536288382b8de25498650
  • Loading branch information
Tarkan Al-Kazily authored and facebook-github-bot committed Jan 18, 2025
1 parent 029a126 commit 631be42
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions prelude/transitions/constraint_overrides.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,15 @@
# - buck2.constraints
# - buck2.passthrough_constraints

_platforms_val = read_root_config("buck2", "platforms", "")
_constraints_val = read_root_config("buck2", "constraints", "")
_passthrough_constraints_val = read_root_config("buck2", "passthrough_constraints", "")

def _platforms() -> list[str]:
platforms = []
config = read_root_config("buck2", "platforms", "")
platforms.extend(
[platform.strip() for platform in config.split(",") if platform.strip()],
)
return platforms
return [platform.strip() for platform in _platforms_val.split(",") if platform.strip()]

def _constraints() -> list[str]:
constraints = []
config = read_root_config("buck2", "constraints", "")
constraints.extend(
[constraint.strip() for constraint in config.split(",") if constraint.strip()],
)
return constraints

_passthrough_constraints_val = read_root_config("buck2", "passthrough_constraints", "")
return [constraint.strip() for constraint in _constraints_val.split(",") if constraint.strip()]

def _passthrough_constraints() -> list[str]:
return [constraint.strip() for constraint in _passthrough_constraints_val.split(",") if constraint.strip()]
Expand Down

0 comments on commit 631be42

Please sign in to comment.