sh_binary file extension

96 views
Skip to first unread message

Paul Johnston

unread,
Aug 31, 2016, 3:55:07 PM8/31/16
to bazel-discuss
I recently used an sh_binary target in a build_file for a script that did not have an *.sh file extension.  

sh_binary(
     name = "foo",
     srcs = ["bin/foo"],
)

"srcs attribute of sh_binary rule @bar_baz//:foo: '@bar_baz//:bin/foo' does not produce any sh_binary srcs files (expected .sh or .bash)."

This failure occurred 0.3.0 but succeeds in 0.3.1 and HEAD.  

Is there a workaround for pre-0.3.1 bazel?

bsta...@fitbit.com

unread,
Aug 31, 2016, 3:57:04 PM8/31/16
to bazel-discuss
It's expecting the source file to be named bin/foo.sh, and bazel will produce bin/foo as the output of building that target.

Paul Johnston

unread,
Aug 31, 2016, 4:05:17 PM8/31/16
to bazel-discuss, bsta...@fitbit.com
Any workaround?  The file is in an external workspace, so I either have to write a new repository_rule to symlink foo.sh to foo, or do something else.

Benjamin Staffin

unread,
Aug 31, 2016, 4:12:54 PM8/31/16
to bazel-discuss, bsta...@fitbit.com
Maybe you could use a genrule to rename the file?  Or, if you don't specifically need foo to be a sh_binary target, perhaps you could make a filegroup that just has that one file in it, or put it in exports_files()?

Austin Schuh

unread,
Sep 5, 2016, 9:06:14 AM9/5/16
to Benjamin Staffin, bazel-discuss, bsta...@fitbit.com
A filegroup should do the job.  We do that for compiler wrapper scripts.

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/c99d6acc-4bd5-4cb6-8a41-d5fc8c31504e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages