Striptests is not necessary anymore
This commit is contained in:
parent
259b1a5dc6
commit
a68e3aeb26
|
@ -16,7 +16,8 @@ COPY LICENSE Setup.hs shellcheck.hs ./
|
||||||
COPY src src
|
COPY src src
|
||||||
RUN cabal build Paths_ShellCheck && \
|
RUN cabal build Paths_ShellCheck && \
|
||||||
ghc -optl-static -optl-pthread -isrc -idist/build/autogen --make shellcheck -split-sections -optc-Wl,--gc-sections -optlo-Os && \
|
ghc -optl-static -optl-pthread -isrc -idist/build/autogen --make shellcheck -split-sections -optc-Wl,--gc-sections -optlo-Os && \
|
||||||
strip --strip-all shellcheck
|
strip --strip-all shellcheck && \
|
||||||
|
ls -l shellcheck
|
||||||
|
|
||||||
RUN mkdir -p /out/bin && \
|
RUN mkdir -p /out/bin && \
|
||||||
cp shellcheck /out/bin/
|
cp shellcheck /out/bin/
|
||||||
|
|
65
striptests
65
striptests
|
@ -1,57 +1,12 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# This file strips all unit tests from ShellCheck, removing
|
# This file *stripped* all unit tests from ShellCheck, removing
|
||||||
# the dependency on QuickCheck and Template Haskell and
|
# the dependency on QuickCheck and Template Haskell and
|
||||||
# reduces the binary size considerably.
|
# reduces the binary size considerably.
|
||||||
|
#
|
||||||
|
# Currently it only checks that run from right directory and
|
||||||
|
# there aren't local git changes
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
sponge() {
|
|
||||||
data="$(cat)"
|
|
||||||
printf '%s\n' "$data" > "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
modify() {
|
|
||||||
if ! "${@:2}" < "$1" | sponge "$1"
|
|
||||||
then
|
|
||||||
{
|
|
||||||
printf 'Failed to modify %s: ' "$1"
|
|
||||||
printf '%q ' "${@:2}"
|
|
||||||
printf '\n'
|
|
||||||
} >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
detestify() {
|
|
||||||
echo "-- AUTOGENERATED from ShellCheck by striptests. Do not modify."
|
|
||||||
awk '
|
|
||||||
BEGIN {
|
|
||||||
state = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/LANGUAGE TemplateHaskell/ { next; }
|
|
||||||
/^import.*Test\./ { next; }
|
|
||||||
|
|
||||||
/^module/ {
|
|
||||||
sub(/,[^,)]*runTests/, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
# Delete tests
|
|
||||||
/^prop_/ { state = 1; next; }
|
|
||||||
|
|
||||||
# ..and any blank lines following them.
|
|
||||||
state == 1 && /^ / { next; }
|
|
||||||
|
|
||||||
# Template Haskell marker
|
|
||||||
/^return / {
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
{ state = 0; print; }
|
|
||||||
'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [[ ! -e ShellCheck.cabal ]]
|
if [[ ! -e ShellCheck.cabal ]]
|
||||||
then
|
then
|
||||||
echo "Run me from the ShellCheck directory." >&2
|
echo "Run me from the ShellCheck directory." >&2
|
||||||
|
@ -63,15 +18,3 @@ then
|
||||||
echo "You have local changes! These may be overwritten." >&2
|
echo "You have local changes! These may be overwritten." >&2
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
modify ShellCheck.cabal sed -e '
|
|
||||||
/QuickCheck/d
|
|
||||||
/^test-suite/{ s/.*//; q; }
|
|
||||||
'
|
|
||||||
|
|
||||||
find . -name '.git' -prune -o -type f -name '*.hs' -print |
|
|
||||||
while IFS= read -r file
|
|
||||||
do
|
|
||||||
modify "$file" detestify
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue