mirror of
https://github.com/eth-p/bat-extras.git
synced 2025-03-06 09:21:12 +01:00
build: Allow for only specific scripts to be built
This commit is contained in:
parent
0cefe6efe1
commit
bd7cb3ea9e
30
build.sh
30
build.sh
@ -370,6 +370,7 @@ OPT_INLINE=true
|
|||||||
OPT_MINIFY="lib"
|
OPT_MINIFY="lib"
|
||||||
OPT_PREFIX="/usr/local"
|
OPT_PREFIX="/usr/local"
|
||||||
OPT_BAT="$(basename "$EXECUTABLE_BAT")"
|
OPT_BAT="$(basename "$EXECUTABLE_BAT")"
|
||||||
|
BUILD_FILTER=()
|
||||||
|
|
||||||
DOCS_URL="https://github.com/eth-p/bat-extras/blob/master/doc"
|
DOCS_URL="https://github.com/eth-p/bat-extras/blob/master/doc"
|
||||||
DOCS_MAINTAINER="eth-p <eth-p@hidden.email>"
|
DOCS_MAINTAINER="eth-p <eth-p@hidden.email>"
|
||||||
@ -389,8 +390,12 @@ while shiftopt; do
|
|||||||
--minify) shiftval; OPT_MINIFY="$OPT_VAL" ;;
|
--minify) shiftval; OPT_MINIFY="$OPT_VAL" ;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
if ! [[ -f "${SRC}/${OPT}.sh" ]]; then
|
||||||
printc_err "%{RED}%s: unknown option '%s'%{CLEAR}" "$PROGRAM" "$OPT"
|
printc_err "%{RED}%s: unknown option '%s'%{CLEAR}" "$PROGRAM" "$OPT"
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
BUILD_FILTER+=("$OPT")
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -445,8 +450,31 @@ SOURCES=()
|
|||||||
|
|
||||||
printc_msg "%{YELLOW}Preparing scripts...%{CLEAR}\n"
|
printc_msg "%{YELLOW}Preparing scripts...%{CLEAR}\n"
|
||||||
for file in "$SRC"/*.sh; do
|
for file in "$SRC"/*.sh; do
|
||||||
SOURCES+=("$file")
|
file_bin="$(basename -- "$file" ".sh")"
|
||||||
|
buildable=false
|
||||||
|
|
||||||
|
if ! "$buildable" && [[ "${#BUILD_FILTER[@]}" -eq 0 ]]; then
|
||||||
|
buildable=true
|
||||||
|
elif ! "$buildable"; then
|
||||||
|
for buildable_file in "${BUILD_FILTER[@]}"; do
|
||||||
|
if [[ "$buildable_file" = "$file_bin" ]]; then
|
||||||
|
buildable=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If that one is allowed to build, add it to the sources list.
|
||||||
|
if "$buildable"; then
|
||||||
|
SOURCES+=("$file")
|
||||||
|
else
|
||||||
|
printc_msg " %{YELLOW}Skipping %{MAGENTA}%s%{CLEAR}\n" "$(basename "$file_bin")"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${#BUILD_FILTER[@]}" -gt 0 ]]; then
|
||||||
|
printf "\n"
|
||||||
|
fi
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Build manuals.
|
# Build manuals.
|
||||||
|
Loading…
Reference in New Issue
Block a user