2017-05-06 12:30:12 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
##########################################################################
|
|
|
|
# This is the Fake bootstrapper script for Linux and OS X.
|
|
|
|
##########################################################################
|
2015-11-25 01:10:39 +03:00
|
|
|
|
2017-05-06 12:30:12 +03:00
|
|
|
# Define directories.
|
|
|
|
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
|
|
TOOLS_DIR=$SCRIPT_DIR/tools
|
2019-05-17 04:14:01 +03:00
|
|
|
INCREMENTALIST_DIR=$TOOLS_DIR/incrementalist
|
|
|
|
INCREMENTALIST_EXE=$INCREMENTALIST_DIR/Incrementalist.Cmd.exe
|
2017-05-06 12:30:12 +03:00
|
|
|
NUGET_EXE=$TOOLS_DIR/nuget.exe
|
2021-01-04 18:44:07 +03:00
|
|
|
NUGET_URL=https://dist.nuget.org/win-x86-commandline/v5.8.0/nuget.exe
|
2017-09-12 20:23:46 +03:00
|
|
|
FAKE_VERSION=4.63.0
|
2017-05-06 12:30:12 +03:00
|
|
|
FAKE_EXE=$TOOLS_DIR/FAKE/tools/FAKE.exe
|
2017-08-24 21:24:49 +03:00
|
|
|
DOTNET_EXE=$SCRIPT_DIR/.dotnet/dotnet
|
2021-01-04 18:44:07 +03:00
|
|
|
DOTNETCORE_VERSION=3.1.105
|
|
|
|
DOTNET_VERSION=5.0.101
|
2020-02-14 18:03:13 +03:00
|
|
|
DOTNET_INSTALLER_URL=https://dot.net/v1/dotnet-install.sh
|
2019-05-16 21:32:25 +03:00
|
|
|
DOTNET_CHANNEL=LTS
|
2022-08-30 17:13:37 +03:00
|
|
|
PROTOBUF_VERSION=3.21.5
|
2023-11-23 01:01:22 +03:00
|
|
|
INCREMENTALIST_VERSION=0.9.0
|
2015-11-25 01:10:39 +03:00
|
|
|
|
2017-05-06 12:30:12 +03:00
|
|
|
# Define default arguments.
|
|
|
|
TARGET="Default"
|
|
|
|
CONFIGURATION="Release"
|
|
|
|
VERBOSITY="verbose"
|
|
|
|
DRYRUN=
|
|
|
|
SCRIPT_ARGUMENTS=()
|
2015-11-25 01:10:39 +03:00
|
|
|
|
2017-05-06 12:30:12 +03:00
|
|
|
# Parse arguments.
|
|
|
|
for i in "$@"; do
|
|
|
|
case $1 in
|
|
|
|
-t|--target) TARGET="$2"; shift ;;
|
|
|
|
-c|--configuration) CONFIGURATION="$2"; shift ;;
|
|
|
|
-v|--verbosity) VERBOSITY="$2"; shift ;;
|
|
|
|
-d|--dryrun) DRYRUN="-dryrun" ;;
|
|
|
|
--) shift; SCRIPT_ARGUMENTS+=("$@"); break ;;
|
|
|
|
*) SCRIPT_ARGUMENTS+=("$1") ;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
# Make sure the tools folder exist.
|
|
|
|
if [ ! -d "$TOOLS_DIR" ]; then
|
|
|
|
mkdir "$TOOLS_DIR"
|
2015-11-25 01:10:39 +03:00
|
|
|
fi
|
|
|
|
|
2017-05-06 12:30:12 +03:00
|
|
|
###########################################################################
|
|
|
|
# INSTALL NUGET
|
|
|
|
###########################################################################
|
2015-11-25 01:10:39 +03:00
|
|
|
|
2017-05-06 12:30:12 +03:00
|
|
|
# Download NuGet if it does not exist.
|
|
|
|
if [ ! -f "$NUGET_EXE" ]; then
|
|
|
|
echo "Downloading NuGet..."
|
|
|
|
curl -Lsfo "$NUGET_EXE" $NUGET_URL
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "An error occured while downloading nuget.exe."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
###########################################################################
|
|
|
|
# INSTALL FAKE
|
|
|
|
###########################################################################
|
2015-12-08 05:39:46 +03:00
|
|
|
|
2017-05-06 12:30:12 +03:00
|
|
|
if [ ! -f "$FAKE_EXE" ]; then
|
|
|
|
mono "$NUGET_EXE" install Fake -ExcludeVersion -Version $FAKE_VERSION -OutputDirectory "$TOOLS_DIR"
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "An error occured while installing Cake."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2015-11-25 01:10:39 +03:00
|
|
|
|
2017-05-06 12:30:12 +03:00
|
|
|
# Make sure that Fake has been installed.
|
|
|
|
if [ ! -f "$FAKE_EXE" ]; then
|
|
|
|
echo "Could not find Fake.exe at '$FAKE_EXE'."
|
|
|
|
exit 1
|
2015-11-25 01:10:39 +03:00
|
|
|
fi
|
|
|
|
|
2019-05-17 04:14:01 +03:00
|
|
|
###########################################################################
|
|
|
|
# INSTALL Incrementalist
|
|
|
|
###########################################################################
|
|
|
|
if [ ! -f "$INCREMENTALIST_EXE" ]; then
|
2021-01-07 05:02:57 +03:00
|
|
|
dotnet tool install Incrementalist.Cmd --version $INCREMENTALIST_VERSION --tool-path "$INCREMENTALIST_DIR"
|
2019-05-17 04:14:01 +03:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Incrementalist already installed."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2017-05-11 17:16:33 +03:00
|
|
|
###########################################################################
|
|
|
|
# WORKAROUND FOR MONO
|
|
|
|
###########################################################################
|
|
|
|
export FrameworkPathOverride=/usr/lib/mono/4.5/
|
|
|
|
|
2017-05-06 12:30:12 +03:00
|
|
|
###########################################################################
|
|
|
|
# RUN BUILD SCRIPT
|
|
|
|
###########################################################################
|
2015-11-25 01:10:39 +03:00
|
|
|
|
2017-05-06 12:30:12 +03:00
|
|
|
# Start Fake
|
|
|
|
exec mono "$FAKE_EXE" build.fsx "${SCRIPT_ARGUMENTS[@]}" --verbosity=$VERBOSITY --configuration=$CONFIGURATION --target=$TARGET $DRYRUN
|