forked from amethyst/amethyst
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test book in CI, with smarts for cleaning libraries.
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# /bin/sh | ||
# | ||
# Clean amethyst build artifacts so `mdbook test` does not fail on multiple | ||
# built libraries found. | ||
# | ||
# Allow nullglob so build doesn't fail if there were no build artifacts. | ||
|
||
set -e | ||
|
||
shopt -u | grep -q nullglob && changed=true && shopt -s nullglob | ||
|
||
crates_to_clean=$( | ||
find book -type f -name '*.md' -exec grep -hF 'extern crate ' {} \+ | | ||
grep -o '[a-z0-9_]\+;$' | | ||
cut -d ';' -f 1 | | ||
sort | | ||
uniq | ||
) | ||
|
||
for crate in $crates_to_clean | ||
do | ||
echo Running rm -rf "target/debug/deps/lib${crate}-*" "target/debug/deps/${crate}-*" | ||
rm -rf "target/debug/deps/lib${crate}-*" "target/debug/deps/${crate}-*" | ||
done | ||
|
||
[ $changed ] && shopt -u nullglob; unset changed | ||
|
||
exit 0 |