please icon indicating copy to clipboard operation
please copied to clipboard

`get_entry_points` doesn't account for entry points added by post-build functions

Open chrisnovakovic opened this issue 1 year ago • 1 comments

add_entry_point allows entry points to be added to targets in post-build functions, however these entry points aren't returned by get_entry_points. MWE, based on the test in test/get_entry_points/BUILD:

def add_second_entry_point(name:str, output:list):
    add_entry_point(name, "second", "b")

two = genrule(
    name = "two",
    outs = {
        "a": ["a"],
        "b": ["b"],
    },
    cmd = "for i in $OUTS; do echo x > $i; done",
    entry_points = {
        "first": "a",
    },
    post_build = add_second_entry_point,
)

def assert_dict(l1, l2):
    if l1 != l2:
        fail(f"{l1} != {l2}")

assert_dict(
    {"first": "a", "second": "b"},
    get_entry_points(two),
)
Build stopped after 50ms. 1 target failed:
    //test/get_entry_points:all
test/get_entry_points/BUILD:37:9: error: {"first": a, "second": b} != {"first": a}
    if l1 != l2:
        fail(f"{l1} != {l2}")
        ^


Traceback:
test/get_entry_points/BUILD:37:9:           fail(f"{l1} != {l2}")
test/get_entry_points/BUILD:36:5:       if l1 != l2:
test/get_entry_points/BUILD:49:1:   assert_dict(

I guess this is because the get_entry_points call is evaluated before :two is built.

chrisnovakovic avatar Jun 13 '24 15:06 chrisnovakovic

This issue has been automatically marked as stale because it has not had any recent activity in the past 90 days. It will be closed if no further activity occurs. If you require additional support, please reply to this message. Thank you for your contributions.

stale[bot] avatar Apr 26 '25 00:04 stale[bot]