Skip to content

Commit

Permalink
use use modifiers specific functions to get/set modifiers
Browse files Browse the repository at this point in the history
Summary:
use dedicated functions for modifiers instead of package values
Will land after core changes are landed

Reviewed By: scottcao

Differential Revision: D68898019

fbshipit-source-id: bb671db3b59f68bb8d92971737a1a71f09638e2f
  • Loading branch information
Yury Samkevich authored and facebook-github-bot committed Feb 4, 2025
1 parent 3c463a2 commit bfeb94c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions prelude/cfg/modifier/set_cfg_modifiers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
# of this source tree.

load(":common.bzl", "MODIFIER_METADATA_KEY", "get_tagged_modifiers", "tagged_modifiers_to_json")
load(":common.bzl", "get_tagged_modifiers", "tagged_modifiers_to_json")
load(":types.bzl", "Modifier", "ModifierPackageLocation") # @unused Used in type annotation

def set_cfg_modifiers(
Expand Down Expand Up @@ -38,9 +38,9 @@ def set_cfg_modifiers(
cfg_modifiers = cfg_modifiers or []
extra_cfg_modifiers_per_rule = extra_cfg_modifiers_per_rule or {}

merged_modifier_jsons = read_parent_package_value(MODIFIER_METADATA_KEY)
merged_modifier_jsons = get_parent_modifiers()

# `read_parent_package_value` returns immutable values. `list()` makes it mutable.
# `get_parent_modifiers` returns immutable values. `list()` makes it mutable.
merged_modifier_jsons = list(merged_modifier_jsons) if merged_modifier_jsons else []

tagged_modifiers_list = get_tagged_modifiers(
Expand All @@ -50,10 +50,8 @@ def set_cfg_modifiers(
)
merged_modifier_jsons += [tagged_modifiers_to_json(tagged_modifiers) for tagged_modifiers in tagged_modifiers_list]

write_package_value(
MODIFIER_METADATA_KEY,
set_modifiers(
merged_modifier_jsons,
overwrite = True,
)

def _get_package_path() -> str:
Expand Down

0 comments on commit bfeb94c

Please sign in to comment.