Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

genrule() documentation has incorrect example #19

Closed
spearce opened this issue May 10, 2013 · 5 comments
Closed

genrule() documentation has incorrect example #19

spearce opened this issue May 10, 2013 · 5 comments
Assignees

Comments

@spearce
Copy link
Contributor

spearce commented May 10, 2013

The example for genrule() shows:

cmd = 'python $SRC_0 $SRC_1 > $OUT',

which does not work. $SRC_0 seems to be not implemented in BUCK. I suspect you meant:

cmd = 'python $SRCDIR/basic_to_full_manifest.py $SRCDIR/AndroidManifest.xml'

@ghost ghost assigned bolinfest May 10, 2013
@bolinfest
Copy link
Contributor

Actually, I believe it should just be:

cmd = 'python basic_to_full_manifest.py AndroidManifest.xml'

is that not working for you?

@spearce
Copy link
Contributor Author

spearce commented May 10, 2013

Well, this was a reminder to fix the documentation. :-)

And it doesn't work if the name is a genfile().

@bolinfest
Copy link
Contributor

Ah, yes, now I am feeling your pain. I just made it possible to build the Closure Compiler using Buck, and I had to do some hacky things, as well (see /closure/closure-compiler/BUCK):

http://code.google.com/p/plovr/source/detail?r=50a647db8b87f361efcf382491790f0a582ce49f

@spearce
Copy link
Contributor Author

spearce commented May 14, 2013

What about having a macro inside of the cmd string like "$(location //x:y)" to give you the location of a srcs entry named "//x:y". If //x:y is e.g. a java_library() this is the JAR it produces, if its a java_application() again its only the JAR it makes and not the execution command line, if its a genrule() its the out file. Such references in srcs should also automatically be added to the dep list so its not necessary to repeat them in deps.

Buck already seems to do this with ${//x:y} for the name of the tool to execute, but that expansion isn't suitable because it creates things like "java -classpath ..." or "PYTHONPATH= ..." which isn't suitable in all contexts. $(location //x:y) would expand only to the path of the source file.

@bolinfest
Copy link
Contributor

I believe this is fixed now: http://facebook.github.io/buck/rule/genrule.html

Though the section on deps mentions the old curly-brace pattern, but I'll send out a fix for that now.

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

No branches or pull requests

2 participants