Last active
August 17, 2018 17:15
-
-
Save jayconrod/d6c7006199fcc79b39b3534bfcc84f21 to your computer and use it in GitHub Desktop.
Repro for bazelbuild/rules_go#1669
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load("//:def.bzl", "mkdata") | |
mkdata(name = "mkdata") | |
sh_test( | |
name = "mkdata_test", | |
srcs = ["mkdata_test.sh"], | |
args = ["$(location :mkdata)"], | |
data = [":mkdata"], | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _mkdata_impl(ctx): | |
out = ctx.actions.declare_directory(ctx.label.name + ".d") | |
script = "mkdir -p {out}; touch {out}/file; ln -s file {out}/link".format(out = out.path) | |
ctx.actions.run_shell( | |
outputs = [out], | |
command = script, | |
) | |
runfiles = ctx.runfiles(files = [out]) | |
return [DefaultInfo( | |
files = depset([out]), | |
runfiles = runfiles, | |
)] | |
mkdata = rule( | |
_mkdata_impl, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
test_dir="$1" | |
cd "$test_dir" | |
ls -l | cut -f1,9 -d' ' >&2 | |
if [ ! -f file -o -L file ]; then | |
echo "'file' is not a regular file" >&2 | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment