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

Add support for argsfile inputs to BXL #762

Open
cbarrete opened this issue Sep 3, 2024 · 2 comments
Open

Add support for argsfile inputs to BXL #762

cbarrete opened this issue Sep 3, 2024 · 2 comments

Comments

@cbarrete
Copy link
Contributor

cbarrete commented Sep 3, 2024

The buck2 CLI supports passing build targets via files, which is important when the list might be larger than the maximum CLI args length.
Given that BXL supports taking target patterns as inputs, it would be very convenient if it could support argfiles as well, given that there is (to my knowledge) no way to implement them by hand.

Would this be a welcome change? If so, could someone give me some pointers as to how to go about it?

I'm also open to any suggestions for how to solve my problem (passing a large amount of build targets to a BXL script) some other way.

@cbarrete cbarrete changed the title Add support for argsfile to BXL Add support for argsfile inputs to BXL Sep 3, 2024
@Nero5023
Copy link
Contributor

Nero5023 commented Sep 3, 2024

Actually bxl can accept argsfile.
You can do like this

buck2 bxl @path/to/argsfile

path/to/argsfile:

run.bxl:main
--
--foo
arg0
--bar
arg1
--targets
t0
t1
t2
t3

passing a large amount of build targets to a BXL script

I am not sure your use cases here. But I would recommend do a query to get all the targets you want. Or you can define a rule that have a attribute that can hold the list of target and define a target for this rule to holds all targets you want. In bxl, get the targets from the attributes of that targets.

@cbarrete
Copy link
Contributor Author

cbarrete commented Sep 4, 2024

Ah of course, I was thinking about having an argsfile specifically for the targets, but I can work with that as well.

My use case is passing all targets that are affected by a commit (as determined by btd) to a script that will lint those files.

I'll leave this open as I think that this is would be useful regardless of this workaround, but feel free to close it if you disagree.

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

No branches or pull requests

2 participants