spiegel-keyman/android/Samples/KMSample1/build.sh
Marc Durdin 767927bf16 chore(common): use /usr/bin/env bash
Fixes up scripts (except under /linux) to use `#!/usr/bin/env bash`
instead of `#!/bin/bash` or `#!/bin/sh` so that we don't end up with
the ancient version of bash supplied with macOS.

This became urgent with this PR, because of bash-4.xisms in
build-utils.sh, for example on line 572:

```
if [[ -v _builder_params[$e] ]]; then
```
2022-07-25 14:59:37 +10:00

61 lines
1,002 B
Bash
Executable file

#!/usr/bin/env bash
# Build KMSample1
set -e
set -u
display_usage ( ) {
echo "build.sh [-no-daemon] [-debug]"
echo
echo "Build KM Sample 1"
echo " -no-daemon Don't start the Gradle daemon. Use for CI"
echo " -debug Compile only Debug variant"
exit 1
}
echo Build KMSample1
#
# Prevents 'clear' on exit of mingw64 bash shell
#
SHLVL=0
NO_DAEMON=false
ONLY_DEBUG=false
# Parse args
while [[ $# -gt 0 ]] ; do
key="$1"
case $key in
-no-daemon)
NO_DAEMON=true
;;
-debug)
ONLY_DEBUG=true
;;
-h|-\?)
display_usage
;;
esac
shift # past argument
done
echo
echo "NO_DAEMON: $NO_DAEMON"
echo "ONLY_DEBUG: $ONLY_DEBUG"
echo
if [ "$NO_DAEMON" = true ]; then
DAEMON_FLAG=--no-daemon
else
DAEMON_FLAG=
fi
if [ "$ONLY_DEBUG" = true ]; then
BUILD_FLAG=assembleDebug
else
BUILD_FLAG=build
fi
./gradlew $DAEMON_FLAG clean $BUILD_FLAG