-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Shell macros are broken in recent master, e. g. "$(dirname %s)" #212
Comments
Since we use the "$(macro ...)" syntax for buck macros, you need to use a backslash to send this directly to the shell: "$(macro ...)". Does using "$(dirname ...)" work? |
I'll update the documentation regarding this, which I should of done when we initially pushed this. |
And sorry for the disruption here -- we don't see a lot of this style of sub-shelling internally. |
Also, FYI, shell backticks are safe to use before and after this change (e.g. |
I was trying shell backticks: it was failing with scary error messages. I probably did something wrong. |
Yes, that fixed it. Thanks. Documening this would be nice, though. |
Opps. It actually didn't fix it:
With this resolution
And with this error:
|
OK, shell backticks work. |
Changes to fix the backslash behavior and add documentation have been pushed internally. We'll aim to do an open-source push soon. |
Thanks. We are facing another side effect here. We are still supporting Maven archetypes for plugin skeleton generation. As a part of the generated plugin we generate Buck files. In raw form they are looking something like this:
Note: that all ${foo} are replaced by Maven. After this change Buck rejects all this places with macro error. See this change fo more details [1]. |
https://gist.github.com/andrewjcg/0b9b18a5b036784092e3 got this working for me. |
Err, that gist is dependent on the fixes committed internally (but backticks should work in the meantime). |
I think it interferes also with |
Hmm, it shouldn't be. I tested the |
Sorry, my fault. It was failing because of |
This version fixes a critical bug [1] that prevents us from simplifying bucklets intergration. In this version, Buck only allows defining new rule functions in files included with include_defs, not actually instantiating rules, so we need to reshuffle some rules. After this commit [2] "$(macro ...)" syntax is preserved for buck macros, we need to use a backslash to send commands directly to the shell: "\$(macro ...)". It turns out this doesn't work yet, shell backticks seem to work though [3]. [1] facebook/buck#182 [2] facebook/buck@d6f3252 [3] facebook/buck#212 Change-Id: Ie99757bafc626d4ac2c5a75a2983d91b0c4f6d24
Summary: This adds explicit documentation for the string parameter macros we support in the string parameters of various rules, and references it from the genrule description. In particular, it explains the basic syntax and escaping procedure. Test Plan: ran page locally Fixes #212
@andrewjcg Thanks for quick fix. After upgrading to recent master we were able to eliminate shell back ticks again and switch to escaped macro invocation:
|
This version fixes this bug [1] that allows us to eliminate these ugly shell backticks and switch again to escaped macro like invocations: \$(dirname $OUT) [1] facebook/buck#212 Change-Id: Ie43b3ff6dfc89c4d840f2ff75c64ac0a5c6346b6
Before this commit d6f3252 something like this was valid:
With the resolution:
In fact Gerrit Code Review project is relying on this "feature" in its toolchain.
After the mentioned commit, this Buck sniplet is rejected with:
The text was updated successfully, but these errors were encountered: