Skip to content

Commit

Permalink
(cake-archiveGH-80) Add build.sh for building on posix
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gep13 committed Jun 28, 2020
1 parent 3522317 commit e7c7291
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 15 deletions.
50 changes: 50 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions build/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net461</TargetFramework>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cake.Frosting" Version="0.33.0" />
<PackageReference Include="Cake.Frosting" Version="0.38.2" />
</ItemGroup>

</Project>
7 changes: 5 additions & 2 deletions src/Cake.Frosting.Example/Cake.Frosting.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/cake-build/frosting</RepositoryUrl>
<VersionPrefix>0.1.0</VersionPrefix>
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<AssemblyName>Cake.Frosting.Example</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>Cake.Frosting.Example</PackageId>
Expand All @@ -20,4 +20,7 @@
<ItemGroup>
<ProjectReference Include="..\Cake.Frosting\Cake.Frosting.csproj" />
</ItemGroup>
</Project>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
</ItemGroup>
</Project>
15 changes: 8 additions & 7 deletions src/Cake.Frosting.Tests/Cake.Frosting.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<PackageLicenseUrl>https://github.com/cake-build/frosting/blob/develop/LICENSE</PackageLicenseUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/cake-build/frosting</RepositoryUrl>
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<LangVersion>7</LangVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
<DebugType>portable</DebugType>
</PropertyGroup>
Expand All @@ -22,15 +22,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="Cake.Testing" Version="0.34.0" />
<PackageReference Include="Cake.Testing" Version="0.38.4" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
</ItemGroup>

<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

</Project>
</Project>
5 changes: 3 additions & 2 deletions src/Cake.Frosting/Cake.Frosting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/cake-build/frosting</RepositoryUrl>
<VersionPrefix>0.1.0</VersionPrefix>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Cake.Frosting</AssemblyName>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
Expand All @@ -29,6 +29,7 @@
<PackageReference Include="Cake.Core" Version="0.38.4" />
<PackageReference Include="Cake.Common" Version="0.38.4" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="images\" />
Expand All @@ -38,4 +39,4 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
</Project>
</Project>
4 changes: 2 additions & 2 deletions template/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cake.Frosting" Version="0.37.0" />
</ItemGroup>

</Project>
</Project>

0 comments on commit e7c7291

Please sign in to comment.