Absolute path of output in rule

742 views
Skip to first unread message

Andrew Allen

unread,
May 4, 2016, 2:05:38 AM5/4/16
to bazel-discuss
I'm working on a build rule wrapping a compiler I have very little control over. Unfortunately the compiler expects absolute paths for the files that come in as arguments. Is it possible to get the absolute path of a file or output in a skylark build rule?

I made efforts with combinations of basename, dirname, path, root, short_path but thus far no luck. It looks like the root object has the information I want but only in the relative path form. I also looked into the ctx object that get's passed into the impl but there doesn't seem to be anything in there either.

Is this something that I can get from skylark land via another avenue?  

/** ~Andrew Z Allen */

Austin Schuh

unread,
May 4, 2016, 2:11:03 AM5/4/16
to Andrew Allen, bazel-discuss
Is your compiler a C/C++ compiler?  Are you going to use it with a CROSSTOOL file?

Consider wrapping the compiler with a shell script, and expanding the paths that way.  We modify environment variables that way when we define custom compilers with CROSSTOOL files.

Austin

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CAAVj6hx1GCCZ7_mM3V4iy_EYGH4nw3Ap%3DgAtgciLDm9CDks1Qg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages