Skip to content

Instantly share code, notes, and snippets.

@natemcmaster
Created February 20, 2016 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natemcmaster/3a0d5043cc6ca0a6ab2a to your computer and use it in GitHub Desktop.
Save natemcmaster/3a0d5043cc6ca0a6ab2a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
set -e
export DOTNET_INSTALL_DIR="$DIR/.dotnet"
export DOTNET_CLI_PATH="$DOTNET_INSTALL_DIR/share/dotnet/cli"
DOTNET="$DOTNET_INSTALL_DIR/share/dotnet/cli/bin/dotnet"
if [ ! -e $DOTNET ]; then
echo "Installing dotnet-cli"
curl -s https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.sh | sh -s -- --channel beta
fi
if [[ tasks/project.json -nt tasks/project.lock.json ]]; then
echo "Restoring packages for build tasks"
$DOTNET restore tasks/
fi
echo "Running build tasks"
$DOTNET run --framework dnxcore50 --project "$DIR/tasks" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment