facebook / buck2

Build system, successor to Buck
https://buck2.build/
Apache License 2.0
3.59k stars 224 forks source link

aquery action attrs should be strongly typed #486

Open zjturner opened 1 year ago

zjturner commented 1 year ago

When using aquery from bxl, and trying to get the command line args for a cxx_compile action, it’s a value like [cl.exe, -c, foo.cpp, @argsfile, -o, foo.obj]. Unfortunately, it’s quite literally a string, so to get it as a Starlark list you have to do the very awkward

cmd = cmd.strip(“[]”).split(“,”)
cmd = list(map(lambda x: x.strip(), cmd))

which is sure to break at the worst possible time. Is it possible to make the action_attr binding support more types than just raw strings?

wendy728 commented 1 year ago

Yup, aquery attrs are all strings currently, both in BXL and CLI. I can work on strongly typing (most of) them, but it may be a week or two

zjturner commented 1 year ago

Great! No rush on my end as the above hack works for all of the use cases I've tested so far. Just writing stuff down as soon as I come across them so i don't lose track of them. Thanks :)