fix(write_source_files): fix nested directories (#65)
This commit is contained in:
parent
35b8fd3425
commit
0f30bf96b7
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
bazel run //lib/tests/write_source_files:write_subdir
|
||||
[ -e lib/tests/write_source_files/subdir_test/a/b/c/test.txt ]
|
||||
|
||||
bazel run //lib/tests/write_source_files:write_subdir
|
||||
[ -e lib/tests/write_source_files/subdir_test/a/b/c/test.txt ]
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
bazel run //lib/tests/write_source_files:write_symlinks
|
||||
|
||||
# Ensure exists
|
||||
[ -e lib/tests/write_source_files/symlink_test/a/test.txt ]
|
||||
[ -e lib/tests/write_source_files/symlink_test/b/test.txt ]
|
||||
|
||||
# Exit if any symlinks
|
||||
if [ -L lib/tests/write_source_files/symlink_test/a/test.txt ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -L lib/tests/write_source_files/symlink_test/b/test.txt ]; then
|
||||
exit 1
|
||||
fi
|
|
@ -164,11 +164,12 @@ echo "Copying $in to $out in $PWD"
|
|||
|
||||
if [[ -f "$in" ]]; then
|
||||
cp -f "$in" "$out"
|
||||
chmod 664 "$out"
|
||||
chmod ug+w "$out"
|
||||
else
|
||||
rm -Rf "$out"/*
|
||||
mkdir -p "$out"
|
||||
cp -fR "$in"/* "$out"
|
||||
chmod 664 "$out"/*
|
||||
cp -fRL "$in"/* "$out"
|
||||
chmod -R ug+w "$out"/*
|
||||
fi
|
||||
""".format(in_path = in_path, out_path = out_path))
|
||||
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
dist.js
|
||||
dist.js
|
||||
subdir_test
|
||||
symlink_test
|
|
@ -127,8 +127,49 @@ genrule(
|
|||
)
|
||||
|
||||
# ibazel run //lib/tests/write_source_files:write_dist
|
||||
# See e2e/write_source_files_gitignored
|
||||
write_source_files(
|
||||
name = "write_dist",
|
||||
diff_test = False,
|
||||
files = {"dist.js": ":dist"},
|
||||
)
|
||||
|
||||
# Generate a readonly file in nested readonly directories
|
||||
genrule(
|
||||
name = "subdir",
|
||||
outs = ["subdir_test"],
|
||||
cmd = ";".join([
|
||||
"mkdir -p $@/a/b/c",
|
||||
"echo 'test' > $@/a/b/c/test.txt",
|
||||
"chmod -R -w $@/*"
|
||||
]),
|
||||
)
|
||||
|
||||
# Write nested subdirectories to source
|
||||
# See e2e/write_source_files_subdir_multiple_runs
|
||||
write_source_files(
|
||||
name = "write_subdir",
|
||||
diff_test = False,
|
||||
files = {"subdir_test": ":subdir"},
|
||||
)
|
||||
|
||||
|
||||
# Generate some directories including symlinks
|
||||
genrule(
|
||||
name = "symlinks",
|
||||
outs = ["symlink_test"],
|
||||
cmd = ";".join([
|
||||
"mkdir -p $@/a $@/b",
|
||||
"echo 'test' > $@/a/test.txt",
|
||||
"pushd $@/b",
|
||||
"ln -s ../a/test.txt",
|
||||
]),
|
||||
)
|
||||
|
||||
# Write symlinks to source
|
||||
# See e2e/write_source_files_symlinks
|
||||
write_source_files(
|
||||
name = "write_symlinks",
|
||||
diff_test = False,
|
||||
files = {"symlink_test": ":symlinks"},
|
||||
)
|
Loading…
Reference in New Issue