Skip to content

Commit 32bb21d

Browse files
committed
Watch patch files
1 parent f31db8b commit 32bb21d

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

crate_universe/extensions.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,13 @@ def _crate_impl(module_ctx):
992992
repo_specific_annotations = {}
993993
for annotation_tag in mod.tags.annotation:
994994
annotation_dict = structs.to_dict(annotation_tag)
995+
996+
# Watch patch files so changes trigger repository re-generation.
997+
# This must be done before patches are stringified downstream.
998+
for patch_label in annotation_dict.get("patches", []):
999+
if patch_label:
1000+
module_ctx.watch(module_ctx.path(patch_label))
1001+
9951002
if "build_script_data_select" in annotation_dict:
9961003
annotation_dict["build_script_data"] = struct(
9971004
common = annotation_dict["build_script_data"],

crate_universe/private/generate_utils.bzl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,14 @@ def compile_config(
289289
if unexpected:
290290
fail("The following annotations use `additive_build_file` which is not supported for {}: {}".format(repository_name, unexpected))
291291

292+
# Watch patch files so changes trigger repository re-generation.
293+
if repository_ctx:
294+
for _name, data in annotations.items():
295+
patches = data.get("patches", None)
296+
if patches:
297+
for patch in patches:
298+
repository_ctx.watch(repository_ctx.path(Label(patch)))
299+
292300
# Deprecated: Apply `generate_target_compatible_with` to `render_config`.
293301
if not generate_target_compatible_with:
294302
# buildifier: disable=print

0 commit comments

Comments
 (0)