From e7c7291b9a4da9fcb09be16301157e9b6772bc1b Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Sat, 27 Jun 2020 10:43:17 +0100 Subject: [PATCH] (GH-80) Add build.sh for building on posix In order to get this to compile, I had to remove the 461 target. Could be that there is something else that can be done here. --- build.sh | 50 +++++++++++++++++++ build/Build.csproj | 4 +- .../Cake.Frosting.Example.csproj | 7 ++- .../Cake.Frosting.Tests.csproj | 15 +++--- src/Cake.Frosting/Cake.Frosting.csproj | 5 +- template/Build.csproj | 4 +- 6 files changed, 70 insertions(+), 15 deletions(-) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..e17152e --- /dev/null +++ b/build.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# Define varibles +SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source $SCRIPT_DIR/build.config +TOOLS_DIR=$SCRIPT_DIR/tools + +if [ "$DOTNET_VERSION" = "" ]; then + echo "An error occured while parsing .NET Core SDK version." + exit 1 +fi + +# Make sure the tools folder exist. +if [ ! -d "$TOOLS_DIR" ]; then + mkdir "$TOOLS_DIR" +fi + +########################################################################### +# INSTALL .NET CORE CLI +########################################################################### + +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +export DOTNET_CLI_TELEMETRY_OPTOUT=1 +export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 +export DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2 + +DOTNET_INSTALLED_VERSION=$(dotnet --version 2>&1) + +if [ "$DOTNET_VERSION" != "$DOTNET_INSTALLED_VERSION" ]; then + echo "Installing .NET CLI..." + if [ ! -d "$SCRIPT_DIR/.dotnet" ]; then + mkdir "$SCRIPT_DIR/.dotnet" + fi + curl -Lsfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" https://dot.net/v1/dotnet-install.sh + bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version $DOTNET_VERSION --install-dir .dotnet --no-path + export PATH="$SCRIPT_DIR/.dotnet":$PATH + export DOTNET_ROOT="$SCRIPT_DIR/.dotnet" +fi + +########################################################################### +# RUN BUILD SCRIPT +########################################################################### + +echo "Running build script.." +pushd . +echo "Changing to build folder..." +cd build +echo "dotnet run..." +dotnet run --project Build.csproj -- "$@" +echo "going back to previous folder..." +popd diff --git a/build/Build.csproj b/build/Build.csproj index 72a73c5..52021c5 100644 --- a/build/Build.csproj +++ b/build/Build.csproj @@ -2,11 +2,11 @@ Exe - net461 + netcoreapp3.0 - + diff --git a/src/Cake.Frosting.Example/Cake.Frosting.Example.csproj b/src/Cake.Frosting.Example/Cake.Frosting.Example.csproj index a69c2a7..17ad2bd 100644 --- a/src/Cake.Frosting.Example/Cake.Frosting.Example.csproj +++ b/src/Cake.Frosting.Example/Cake.Frosting.Example.csproj @@ -8,7 +8,7 @@ git https://github.com/cake-build/frosting 0.1.0 - net461;netcoreapp2.0 + netcoreapp3.0 Cake.Frosting.Example Exe Cake.Frosting.Example @@ -20,4 +20,7 @@ - \ No newline at end of file + + + + diff --git a/src/Cake.Frosting.Tests/Cake.Frosting.Tests.csproj b/src/Cake.Frosting.Tests/Cake.Frosting.Tests.csproj index 5b9fabe..0b14f14 100644 --- a/src/Cake.Frosting.Tests/Cake.Frosting.Tests.csproj +++ b/src/Cake.Frosting.Tests/Cake.Frosting.Tests.csproj @@ -8,11 +8,11 @@ https://github.com/cake-build/frosting/blob/develop/LICENSE git https://github.com/cake-build/frosting - net461;netcoreapp2.0 + netcoreapp3.0 7 - + $(DefineConstants);NETCORE portable @@ -22,15 +22,16 @@ - - - + + + - + + - \ No newline at end of file + diff --git a/src/Cake.Frosting/Cake.Frosting.csproj b/src/Cake.Frosting/Cake.Frosting.csproj index 9dc3d37..206c937 100644 --- a/src/Cake.Frosting/Cake.Frosting.csproj +++ b/src/Cake.Frosting/Cake.Frosting.csproj @@ -10,7 +10,7 @@ git https://github.com/cake-build/frosting 0.1.0 - netstandard2.0;net461 + netstandard2.0 true Cake.Frosting false @@ -29,6 +29,7 @@ + @@ -38,4 +39,4 @@ true - \ No newline at end of file + diff --git a/template/Build.csproj b/template/Build.csproj index f78a2ec..8d5d411 100644 --- a/template/Build.csproj +++ b/template/Build.csproj @@ -2,11 +2,11 @@ Exe - netcoreapp2.0 + netcoreapp3.0 - \ No newline at end of file +