developer: Update build.sh to remove redundant copyright comments

This commit is contained in:
Ethan P 2020-04-30 22:06:11 -07:00
parent 275c66b213
commit 50e9cd8caa
No known key found for this signature in database
GPG Key ID: 6963FD04F6CF35EA

View File

@ -261,7 +261,7 @@ pp_consolidate__do() {
if will_minify lib; then if will_minify lib; then
pp_strip_comments | pp_minify | pp_minify_unsafe pp_strip_comments | pp_minify | pp_minify_unsafe
else else
cat pp_strip_copyright | pp_strip_separators
fi fi
} < <(pp_consolidate__do "$((depth + 1))" < "$script") | sed "s/^/${indent}/" } < <(pp_consolidate__do "$((depth + 1))" < "$script") | sed "s/^/${indent}/"
echo "${indent}# --- END LIBRARY FILE ---" echo "${indent}# --- END LIBRARY FILE ---"
@ -306,6 +306,16 @@ pp_strip_comments() {
sed '/^[[:space:]]*#.*$/d' sed '/^[[:space:]]*#.*$/d'
} }
# Strips copyright comments from the start of a Bash source file.
pp_strip_copyright() {
awk '/^#/ {if(!p){ next }} { p=1; print $0 }'
}
# Strips separator comments from the start of a Bash source file.
pp_strip_separators() {
awk '/^#\s*-{5,}/ { next; } {print $0}'
}
# Minify a Bash source file. # Minify a Bash source file.
# https://github.com/mvdan/sh # https://github.com/mvdan/sh
pp_minify() { pp_minify() {