Skip to content

Commit

Permalink
Merge branch 'release/0.25.0' into main
Browse files Browse the repository at this point in the history
* release/0.25.0:
  (build) Updated version and release notes.
  cake-buildGH-1997: Add support for --trace command line option for NUnit3 settings + runner
  (cake-buildGH-1995) Make In-Proc NuGet addin/tool installtion default
  Adds missing .NET CLI dependencies/restore switches
  (cake-buildGH-1937) Speed up in-process NuGet
  Update MSBuildVerbosityExtensions.cs
  (cake-buildGH-1992) Update to .NET Core 1.0.9 / SDK 1.1.7
  cake-buildGH-1987: Normalize exception handling in PropertyToken for invalid parameter index
  [ci skip] Get more Open Source Helpers
  Removed unnecessary parameter
  Fix writing start and end progress messages
  (cake-buildGH-1974) Added System.Collections work around for Mono
  (cake-buildGH-1689) Add documentation that Chocolatey licensed is required
  (build) Updated Cake tool to version 0.24.0
  • Loading branch information
devlead committed Jan 17, 2018
2 parents 75c6259 + c072ac9 commit 05b4d3f
Show file tree
Hide file tree
Showing 47 changed files with 764 additions and 44 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![NuGet](https://img.shields.io/nuget/v/Cake.svg)](https://www.nuget.org/packages/Cake) [![MyGet](https://img.shields.io/myget/cake/vpre/Cake.svg?label=myget)](https://www.myget.org/gallery/cake) [![Chocolatey](https://img.shields.io/chocolatey/v/Cake.portable.svg)](https://chocolatey.org/packages/cake.portable)
[![homebrew](https://img.shields.io/homebrew/v/cake.svg)](http://braumeister.org/formula/cake)
[![Help Contribute to Open Source](https://www.codetriage.com/cake-build/cake/badges/users.svg)](https://www.codetriage.com/cake-build/cake)

[![Source Browser](https://img.shields.io/badge/Browse-Source-green.svg)](http://sourcebrowser.io/Browse/cake-build/cake)

Expand Down
15 changes: 15 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
### New in 0.25.0 (Released 2018/01/17)

* 1995 Make In-proc NuGet addin/tool installation default
* 1994 Get MSBuild Verbosity enum from string
* 1988 TeamCity writing start and end progress contains invalid messages property
* 1974 ToDictionary on Mono causes "The type 'Dictionary<,>' is defined in an assembly that is not referenced"
* 1998 Some .NET Core commands missing no dependencies/restore
* 1997 Add the --trace option to the NUnit3Settings class.
* 1992 Update to .NET Runtime 1.0.9 because security issues
* 1989 Path unnecessarily trims backslash in already normalized string
* 1987 Confusing Error from Bad Format String to Information()
* 1937 UseInProcessClient=true is slow
* 1982 CodeTriage - Get more Open Source Helpers
* 1689 ChocolateyDownload should be documented to only work in paid edition

### New in 0.24.0 (Released 2017/12/29)

* 1950 Allow Cake modules to be bootstrapped by Cake in a pre-processing phase
Expand Down
4 changes: 2 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ Param(
[string[]]$ScriptArgs
)

$CakeVersion = "0.23.0"
$CakeVersion = "0.24.0"
$DotNetChannel = "Current";
$DotNetVersion = "1.1.5";
$DotNetVersion = "1.1.7";
$DotNetInstallerUri = "https://dot.net/v1/dotnet-install.ps1";
$NugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"

Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
TOOLS_DIR=$SCRIPT_DIR/tools
NUGET_EXE=$TOOLS_DIR/nuget.exe
NUGET_URL=https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
CAKE_VERSION=0.23.0
CAKE_VERSION=0.24.0
CAKE_EXE=$TOOLS_DIR/Cake.$CAKE_VERSION/Cake.exe

# Temporarily skip verification and opt-in to new in-proc NuGet
Expand Down Expand Up @@ -50,7 +50,7 @@ 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
sudo bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version 1.1.5 --install-dir .dotnet --no-path
sudo bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version 1.1.7 --install-dir .dotnet --no-path
export PATH="$SCRIPT_DIR/.dotnet":$PATH
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"projects": [ "src" ],
"sdk": {
"version": "1.1.5"
"version": "1.1.7"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,14 @@ public void Should_Add_Build_Arguments()
var fixture = new DotNetCoreBuilderFixture();
fixture.Settings.NoIncremental = true;
fixture.Settings.NoDependencies = true;
fixture.Settings.NoRestore = true;
fixture.Project = "./src/*";

// When
var result = fixture.Run();

// Then
Assert.Equal("build \"./src/*\" --no-incremental --no-dependencies", result.Args);
Assert.Equal("build \"./src/*\" --no-incremental --no-dependencies --no-restore", result.Args);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ public void Should_Add_Settings()
// Given
var fixture = new DotNetCorePackFixture();
fixture.Settings.NoBuild = true;
fixture.Settings.NoDependencies = true;
fixture.Settings.NoRestore = true;
fixture.Settings.Configuration = "Release";
fixture.Settings.OutputDirectory = "./artifacts/";
fixture.Settings.VersionSuffix = "rc1";
Expand All @@ -118,7 +120,7 @@ public void Should_Add_Settings()
var result = fixture.Run();

// Then
Assert.Equal("pack --output \"/Working/artifacts\" --no-build --include-symbols --include-source --configuration Release --version-suffix rc1 --serviceable --verbosity Minimal", result.Args);
Assert.Equal("pack --output \"/Working/artifacts\" --no-build --no-dependencies --no-restore --include-symbols --include-source --configuration Release --version-suffix rc1 --serviceable --verbosity Minimal", result.Args);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ public void Should_Add_Settings()
{
// Given
var fixture = new DotNetCorePublisherFixture();
fixture.Settings.NoDependencies = true;
fixture.Settings.NoRestore = true;
fixture.Settings.Framework = "dnxcore50";
fixture.Settings.Configuration = "Release";
fixture.Settings.Runtime = "runtime1";
Expand All @@ -116,7 +118,7 @@ public void Should_Add_Settings()
var result = fixture.Run();

// Then
Assert.Equal("publish --output \"/Working/artifacts\" --runtime runtime1 --framework dnxcore50 --configuration Release --version-suffix rc1 --verbosity Minimal", result.Args);
Assert.Equal("publish --output \"/Working/artifacts\" --runtime runtime1 --framework dnxcore50 --configuration Release --version-suffix rc1 --no-dependencies --no-restore --verbosity Minimal", result.Args);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public void Should_Add_Additional_Settings()
// Given
var fixture = new DotNetCoreTesterFixture();
fixture.Settings.NoBuild = true;
fixture.Settings.NoRestore = true;
fixture.Settings.Framework = "dnxcore50";
fixture.Settings.Configuration = "Release";
fixture.Settings.OutputDirectory = "./artifacts/";
Expand All @@ -122,7 +123,7 @@ public void Should_Add_Additional_Settings()
var result = fixture.Run();

// Then
Assert.Equal("test --settings \"/Working/demo.runsettings\" --filter \"Priority = 1\" --test-adapter-path \"/Working/custom-test-adapter\" --logger \"trx;LogFileName=/Working/logfile.trx\" --output \"/Working/artifacts\" --framework dnxcore50 --configuration Release --diag \"/Working/artifacts/logging/diagnostics.txt\" --no-build --results-directory \"/Working/tests\"", result.Args);
Assert.Equal("test --settings \"/Working/demo.runsettings\" --filter \"Priority = 1\" --test-adapter-path \"/Working/custom-test-adapter\" --logger \"trx;LogFileName=/Working/logfile.trx\" --output \"/Working/artifacts\" --framework dnxcore50 --configuration Release --diag \"/Working/artifacts/logging/diagnostics.txt\" --no-build --no-restore --results-directory \"/Working/tests\"", result.Args);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Linq;
using Cake.Common.Tools.MSBuild;
using Cake.Core;
using Cake.Core.Diagnostics;
using Xunit;

namespace Cake.Common.Tests.Unit.Tools.MSBuild
{
public sealed class MSBuildVerbosityExtensionsTests
{
public sealed class GetMSBuildVerbosityMethod
{
[Theory]
[InlineData("quiet", Verbosity.Quiet)]
[InlineData("minimal", Verbosity.Minimal)]
[InlineData("normal", Verbosity.Normal)]
[InlineData("detailed", Verbosity.Verbose)]
[InlineData("diagnostic", Verbosity.Diagnostic)]
public void Should_Convert_Valid_String_To_Verbosity_Enum(string verbosityName, Verbosity expectedVerbosity)
{
// Given

// When
var actualVerbosity = MSBuildVerbosityExtensions.GetMSBuildVerbosity(verbosityName);

// Then
Assert.Equal(expectedVerbosity, actualVerbosity);
}

[Theory]
[InlineData("QUIET", Verbosity.Quiet)]
[InlineData("MINIMAL", Verbosity.Minimal)]
[InlineData("NORMAL", Verbosity.Normal)]
[InlineData("DETAILED", Verbosity.Verbose)]
[InlineData("DIAGNOSTIC", Verbosity.Diagnostic)]
public void Should_Convert_Valid_UpperCase_String_To_Verbosity_Enum(string verbosityName, Verbosity expectedVerbosity)
{
// Given

// When
var actualVerbosity = MSBuildVerbosityExtensions.GetMSBuildVerbosity(verbosityName);

// Then
Assert.Equal(expectedVerbosity, actualVerbosity);
}

[Fact]
public void Should_Throws_Exception_When_Parameter_Is_Null()
{
// Given

// When
var actualException = Assert.Throws<CakeException>(() => MSBuildVerbosityExtensions.GetMSBuildVerbosity(null));

// Then
Assert.Equal("Encountered unknown MSBuild build log verbosity ''. Valid values are 'quiet', 'minimal', 'normal', 'detailed' and 'diagnostic'.", actualException.Message);
}

[Theory]
[InlineData("", "Encountered unknown MSBuild build log verbosity ''. Valid values are 'quiet', 'minimal', 'normal', 'detailed' and 'diagnostic'.")]
[InlineData("invalid", "Encountered unknown MSBuild build log verbosity 'invalid'. Valid values are 'quiet', 'minimal', 'normal', 'detailed' and 'diagnostic'.")]
public void Should_Throws_Exception_When_Parameter_Has_Invalid_Value(string invalidVerbosityValue, string expectedMessage)
{
// Given

// When
var actualException = Assert.Throws<CakeException>(() => MSBuildVerbosityExtensions.GetMSBuildVerbosity(invalidVerbosityValue));

// Then
Assert.Equal(expectedMessage, actualException.Message);
}
}
}
}
16 changes: 16 additions & 0 deletions src/Cake.Common.Tests/Unit/Tools/NUnit/NUnit3RunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ public void Should_Set_Commandline_Switches()
fixture.Settings.DisposeRunners = true;
fixture.Settings.ShadowCopy = true;
fixture.Settings.Agents = 3;
fixture.Settings.TraceLevel = NUnitInternalTraceLevel.Debug;
fixture.Settings.Params = new Dictionary<string, string>
{
["one"] = "1",
Expand All @@ -262,6 +263,7 @@ public void Should_Set_Commandline_Switches()
"\"--config=Debug\" \"--framework=net3.5\" --x86 " +
"--dispose-runners --shadowcopy --agents=3 " +
"--process=InProcess --domain=Single " +
"--trace=verbose " +
"\"--params=one=1\" " +
"\"--params=two=2\" " +
"\"--params=three=3\"", result.Args);
Expand Down Expand Up @@ -336,6 +338,20 @@ public void Should_Not_Set_Switch_For_Default_AppDomainUsage()
// Then
Assert.Equal("\"/Working/Test1.dll\"", result.Args);
}

[Fact]
public void Should_Not_Set_Switch_For_Default_TraceLevel()
{
// Given
var fixture = new NUnit3RunnerFixture();
fixture.Settings.TraceLevel = null;

// When
var result = fixture.Run();

// Then
Assert.Equal("\"/Working/Test1.dll\"", result.Args);
}
}
}
}
10 changes: 10 additions & 0 deletions src/Cake.Common.Tests/Unit/Tools/NUnit/NUnit3SettingsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ public void Should_Use_Default_AppDomainUsage_By_Default()
// Then
Assert.Equal(settings.AppDomainUsage, NUnit3AppDomainUsage.Default);
}

[Fact]
public void Should_Use_No_Internal_Trace_By_Default()
{
// Given, When
var settings = new NUnit3Settings();

// Then
Assert.Equal(settings.TraceLevel, null);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using Cake.Common.Tools.NUnit;
using Xunit;

namespace Cake.Common.Tests.Unit.Tools.NUnit
{
public sealed class NUnitInternalTraceLevelExtensionsTests
{
public sealed class TheGetArgumentValueMethod
{
[Theory]
[InlineData(NUnitInternalTraceLevel.Off, "off")]
[InlineData(NUnitInternalTraceLevel.Error, "error")]
[InlineData(NUnitInternalTraceLevel.Warning, "warning")]
[InlineData(NUnitInternalTraceLevel.Info, "info")]
[InlineData(NUnitInternalTraceLevel.Debug, "verbose")]
#pragma warning disable xUnit1025 // InlineData should be unique within the Theory it belongs to
[InlineData(NUnitInternalTraceLevel.Verbose, "verbose")]
#pragma warning restore xUnit1025 // InlineData should be unique within the Theory it belongs to
public void Should_Return_Correct_Value(NUnitInternalTraceLevel level, string expected)
{
// Given, When
var result = level.GetArgumentValue();

// Then
Assert.Equal(expected, result);
}

[Fact]
public void Should_Throw_On_Unexpected_Value()
{
// Given
var level = (NUnitInternalTraceLevel)128;

// When
var ex = Record.Exception(() => level.GetArgumentValue());

// Then
Assert.IsType<ArgumentOutOfRangeException>(ex);
}
}
}
}
6 changes: 3 additions & 3 deletions src/Cake.Common/Build/TeamCity/TeamCityProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void WriteProgressMessage(string message)
/// <param name="message">Build log message.</param>
public void WriteStartProgress(string message)
{
WriteServiceMessage("progressStart", "message", message);
WriteServiceMessage("progressStart", message);
}

/// <summary>
Expand All @@ -143,7 +143,7 @@ public void WriteStartProgress(string message)
/// <param name="message">Build log message.</param>
public void WriteEndProgress(string message)
{
WriteServiceMessage("progressFinish", "message", message);
WriteServiceMessage("progressFinish", message);
}

/// <summary>
Expand Down Expand Up @@ -339,4 +339,4 @@ private static string Sanitize(string source)
return source;
}
}
}
}
4 changes: 4 additions & 0 deletions src/Cake.Common/Tools/Chocolatey/ChocolateyAliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,7 @@ public static void ChocolateyNew(this ICakeContext context, string packageId, Ch

/// <summary>
/// Downloads a Chocolatey package to the current working directory.
/// Requires Chocolatey licensed edition.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="packageId">The id of the package to download.</param>
Expand All @@ -1165,6 +1166,9 @@ public static void ChocolateyDownload(this ICakeContext context, string packageI

/// <summary>
/// Downloads a Chocolatey package using the specified settings.
/// Requires Chocolatey licensed edition.
/// Features requiring Chocolatey for Business or a minimum version are documented
/// in <see cref="ChocolateyDownloadSettings"/>.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="packageId">The id of the package to install.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public ChocolateyDownloader(

/// <summary>
/// Downloads Chocolatey packages using the specified package id and settings.
/// Requires Chocolatey licensed edition.
/// Features requiring Chocolatey for Business or a minimum version are documented
/// in <see cref="ChocolateyDownloadSettings"/>.
/// </summary>
/// <param name="packageId">The source package id.</param>
/// <param name="settings">The settings.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ public sealed class DotNetCoreBuildSettings : DotNetCoreSettings
/// </summary>
public bool NoDependencies { get; set; }

/// <summary>
/// Gets or sets a value indicating whether to not do implicit NuGet package restore.
/// This makes build faster, but requires restore to be done before build is executed.
/// </summary>
/// <remarks>
/// Requires .NET Core 2.x or newer.
/// </remarks>
public bool NoRestore { get; set; }

/// <summary>
/// Gets or sets additional arguments to be passed to MSBuild.
/// </summary>
Expand Down
Loading

0 comments on commit 05b4d3f

Please sign in to comment.