Skip to content

Commit

Permalink
(GH-2603) Added .NET Core 3 moniker to Cake.Tool
Browse files Browse the repository at this point in the history
* Updated SDK to .NET Core 3 (3.0.100-preview9-014004)
* Added netcoreapp3.0 moniker to Cake.Tool
* Added netcoreapp3.0 moniker to Unit tests
* Execute unit tests under netcoreapp3.0
* Consolidated Cake.Tool.csproj into Cake.csproj (sorts VS2019 issues)
* fixes #2603
  • Loading branch information
devlead committed Sep 4, 2019
1 parent a28a6f2 commit 53021cd
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mono:
- 5.12.0
- 5.20.1

dotnet: 2.1.701
dotnet: 3.0.100-preview9-014004

before_install:
- git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags
Expand Down
22 changes: 17 additions & 5 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,28 @@ Task("Run-Unit-Tests")
var projectName = project.GetFilenameWithoutExtension().FullPath;
FilePath
testResultsCore = MakeAbsolute(parameters.Paths.Directories.TestResults.CombineWithFilePath($"{projectName}_core_TestResults.xml")),
testResultsCore2 = MakeAbsolute(parameters.Paths.Directories.TestResults.CombineWithFilePath($"{projectName}_core_TestResults2.xml")),
testResultsCore3 = MakeAbsolute(parameters.Paths.Directories.TestResults.CombineWithFilePath($"{projectName}_core_TestResults3.xml")),
testResultsFull = MakeAbsolute(parameters.Paths.Directories.TestResults.CombineWithFilePath($"{projectName}_full_TestResults.xml"));
// .NET Core
// .NET Core 2
DotNetCoreTest(project.FullPath, new DotNetCoreTestSettings
{
Framework = "netcoreapp2.0",
NoBuild = true,
NoRestore = true,
Configuration = parameters.Configuration,
ArgumentCustomization = args=>args.Append($"--logger trx;LogFileName=\"{testResultsCore}\"")
ArgumentCustomization = args=>args.Append($"--logger trx;LogFileName=\"{testResultsCore2}\"")
});
// .NET Core 3
DotNetCoreTest(project.FullPath, new DotNetCoreTestSettings
{
Framework = "netcoreapp3.0",
NoBuild = true,
NoRestore = true,
Configuration = parameters.Configuration,
ArgumentCustomization = args=>args.Append($"--logger trx;LogFileName=\"{testResultsCore3}\"")
});
// .NET Framework/Mono
Expand Down Expand Up @@ -403,11 +414,12 @@ Task("Create-NuGet-Packages")
.ToArray()
});
DotNetCorePack("./src/Cake/Cake.Tool.csproj", new DotNetCorePackSettings {
DotNetCorePack("./src/Cake/Cake.csproj", new DotNetCorePackSettings {
Configuration = parameters.Configuration,
OutputDirectory = parameters.Paths.Directories.NuGetRoot,
IncludeSymbols = true,
MSBuildSettings = msBuildSettings
MSBuildSettings = msBuildSettings,
ArgumentCustomization = arg => arg.Append("/p:PackAsTool=true")
});
});

Expand Down
2 changes: 1 addition & 1 deletion build.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
CAKE_VERSION=0.34.1
DOTNET_VERSION=2.1.701
DOTNET_VERSION=3.0.100-preview9-014004
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"src"
],
"sdk": {
"version": "2.1.701"
"version": "3.0.100-preview9-014004"
}
}
5 changes: 4 additions & 1 deletion src/Cake.Common.Tests/Cake.Common.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Cake.Common.Tests</AssemblyName>
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp2.0;netcoreapp3.0</TargetFrameworks>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<IsCakeTestProject>true</IsCakeTestProject>
</PropertyGroup>
Expand All @@ -28,6 +28,9 @@
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
<Reference Include="System.IO.Compression" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<Reference Include="System.IO.Compression" />
</ItemGroup>
<ItemGroup>
<None Update=".\Properties\PropertyList-1.0.dtd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Core.Tests/Cake.Core.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Cake.Core.Tests</AssemblyName>
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp2.0;netcoreapp3.0</TargetFrameworks>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<IsCakeTestProject>true</IsCakeTestProject>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void Should_Throw_If_Key_Is_Empty(string key)
// Then
Assert.IsType<ArgumentException>(result);
Assert.Equal("key", ((ArgumentException)result)?.ParamName);
Assert.Equal($"Key cannot be empty.", result.Message?.SplitLines()[0]);
Assert.StartsWith("Key cannot be empty", result.Message?.SplitLines()[0]);
}

[Theory]
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.NuGet.Tests/Cake.NuGet.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Cake.NuGet.Tests</AssemblyName>
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp2.0;netcoreapp3.0</TargetFrameworks>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<IsCakeTestProject>true</IsCakeTestProject>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Tests/Cake.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Cake.Tests</AssemblyName>
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp2.0;netcoreapp3.0</TargetFrameworks>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<IsCakeTestProject>true</IsCakeTestProject>
</PropertyGroup>
Expand Down
15 changes: 0 additions & 15 deletions src/Cake/Cake.Tool.csproj

This file was deleted.

10 changes: 9 additions & 1 deletion src/Cake/Cake.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Cake</AssemblyName>
<TargetFrameworks Condition=" '$(PackAsTool)' != 'true'">net461;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(PackAsTool)' != 'true'">net461;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<PlatformTarget>AnyCpu</PlatformTarget>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<PropertyGroup Condition=" '$(PackAsTool)' == 'true'">
<ToolCommandName>dotnet-cake</ToolCommandName>
<PackageId>Cake.Tool</PackageId>
<PackageDescription>The Cake .NET Core Global Tool.</PackageDescription>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)..\Shared.msbuild" />
<!-- Project references -->
<ItemGroup>
Expand Down
12 changes: 8 additions & 4 deletions src/Shared.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>
<!-- Misc -->
<PropertyGroup>
<NetStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">2.0.0</NetStandardImplicitPackageVersion>
<NetStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' OR '$(TargetFramework)' == 'netcoreapp3.0' ">2.0.0</NetStandardImplicitPackageVersion>
</PropertyGroup>
<!-- Global solution information -->
<ItemGroup>
Expand All @@ -27,15 +27,19 @@
</PropertyGroup>
<!-- Define .NET Core constants -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
<DefineConstants>$(DefineConstants);NETCORE;NETSTANDARD2_0</DefineConstants>
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
<DefineConstants>$(DefineConstants);NETCORE;NETCORE2_0</DefineConstants>
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
<DefineConstants>$(DefineConstants);NETCORE;NETCORE2_1</DefineConstants>
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">
<DefineConstants>$(DefineConstants);NETCORE;NETCORE3_0</DefineConstants>
<DebugType>portable</DebugType>
</PropertyGroup>
<!-- Attribute generation -->
Expand Down

0 comments on commit 53021cd

Please sign in to comment.