2019-02-12 16:05:51 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-02-08 13:30:40 +03:00
|
|
|
# script inspired by https://andrewlock.net/simplifying-the-cake-global-tool-bootstrapper-scripts-in-netcore3-with-local-tools/
|
2019-02-12 16:05:51 +03:00
|
|
|
|
|
|
|
# Define default arguments.
|
|
|
|
SCRIPT="build.cake"
|
2021-02-08 13:30:40 +03:00
|
|
|
CAKE_ARGUMENTS=()
|
2019-02-12 16:05:51 +03:00
|
|
|
|
|
|
|
# Parse arguments.
|
|
|
|
for i in "$@"; do
|
|
|
|
case $1 in
|
|
|
|
-s|--script) SCRIPT="$2"; shift ;;
|
2021-02-08 13:30:40 +03:00
|
|
|
--) shift; CAKE_ARGUMENTS+=("$@"); break ;;
|
|
|
|
*) CAKE_ARGUMENTS+=("$1") ;;
|
2019-02-12 16:05:51 +03:00
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2021-02-08 13:30:40 +03:00
|
|
|
# Restore Cake tool
|
2021-02-22 21:02:09 +03:00
|
|
|
dotnet tool restore
|
2019-02-12 16:05:51 +03:00
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
2023-09-26 10:22:56 +03:00
|
|
|
echo "An error occurred while installing Cake."
|
2019-02-12 16:05:51 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-02-08 13:30:40 +03:00
|
|
|
echo "${CAKE_ARGUMENTS[@]}"
|
2019-02-12 16:05:51 +03:00
|
|
|
|
|
|
|
# Start Cake
|
2023-09-26 10:22:56 +03:00
|
|
|
dotnet tool run dotnet-cake "$SCRIPT" "${CAKE_ARGUMENTS[@]}"
|