Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chrisnovakovic opened this issue Jun 13, 2024 · 0 comments
Labels

Comments

@chrisnovakovic
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant