Skip to content

Commit

Permalink
Merge branch 'release/0.30.0' into main
Browse files Browse the repository at this point in the history
* release/0.30.0: (22 commits)
  (build) Updated version and release notes.
  (GH-2214) Use Environment.CommandLine directly and remove polyfill.
  (GH-2238) Add repository metadata to NuGet packages
  Added alias for checking if the current run is a dry run.
  Execute setup and teardown when dry running script.
  (GH-2233) Documented bootstrap argument
  (GH-2232) Document exclusive argument
  (GH-2234) Removed Mono from CakeOption
  Add XML comments for CakeTaskExtensions
  Fix CakeTaskExtensions accessibility
  (build) Change tool name & fix packaging
  (build) Added Cake.Tool package to parameters.cake
  Allow opting out from using working directory.
  (GH-2067) Cake .NET Core Tool package * Updates SDK * Addes Cake.Tool project * Fixes #2067 * Fixes #1644
  Support for DotCover configuration file added - fixes #1401
  Initialized all tool settings collection properties
  Failing tests for initialized tool settings collections
  (GH-2207) Update to NuGet 4.7.0
  (GH-2220) Corrected documentation for InnoSetup alias
  (doc) Minor modification
  ...
  • Loading branch information
devlead committed Aug 22, 2018
2 parents c531c9e + 6512b79 commit cab58db
Show file tree
Hide file tree
Showing 68 changed files with 742 additions and 163 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ osx_image: xcode9.2
mono:
- 4.4.2

dotnet: 2.1.4
dotnet: 2.1.400

before_install:
- git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags
Expand Down
17 changes: 17 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
### New in 0.30.0 (Released 2018/08/22)

* 2067 Publish as .NET Core Global Tool.
* 2238 Add repository metadata to NuGet packages.
* 2234 Remove mono argument from Argument Parser.
* 2211 DotNetCorePublishSettings doesn't contain --no-build flag support introduced in .NET Core SDK 2.1.
* 2146 Enabling initializer syntax for all collection properties.
* 1401 Support for dotCover configuration file.
* 2233 Add bootstrap argument to Help Command.
* 2232 Add exclusive argument to Help Command.
* 2220 Incorrect documentation for InnoSetup Alias.
* 2228 CakeTaskExtensions are no longer accessible.
* 2224 Add option for ProcessSettings to opt out of working directory magic.
* 2214 Cake.CoreCLR can't handle whitespace in path.
* 2208 WithCriteria does not work with 'DryRun' (WhatIf flag).
* 2207 NuGet hang due to bug in NuGet 4.6.0.

### New in 0.29.0 (Released 2018/07/06)

* 2140 DotNetCorePublish does not respect SelfContained DotNetCorePublishSettings property.
Expand Down
10 changes: 8 additions & 2 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Task("Copy-Files")
.Does(() =>
{
// .NET 4.6
DotNetCorePublish("./src/Cake", new DotNetCorePublishSettings
DotNetCorePublish("./src/Cake/Cake.csproj", new DotNetCorePublishSettings
{
Framework = "net461",
NoRestore = true,
Expand All @@ -191,7 +191,7 @@ Task("Copy-Files")
});

// .NET Core
DotNetCorePublish("./src/Cake", new DotNetCorePublishSettings
DotNetCorePublish("./src/Cake/Cake.csproj", new DotNetCorePublishSettings
{
Framework = "netcoreapp2.0",
NoRestore = true,
Expand Down Expand Up @@ -325,6 +325,12 @@ Task("Create-NuGet-Packages")
.Select(file=> new NuSpecContent { Source = file, Target = file })
.ToArray()
});

DotNetCorePack("./src/Cake/Cake.Tool.csproj", new DotNetCorePackSettings {
Configuration = parameters.Configuration,
OutputDirectory = parameters.Paths.Directories.NugetRoot,
MSBuildSettings = msBuildSettings
});
});

Task("Sign-Binaries")
Expand Down
7 changes: 5 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ Param(
[string[]]$ScriptArgs
)

$CakeVersion = "0.28.1"
$CakeVersion = "0.29.0"
$DotNetChannel = "Current";
$DotNetVersion = "2.1.101";
$DotNetVersion = "2.1.400";
$DotNetInstallerUri = "https://dot.net/v1/dotnet-install.ps1";
$NugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"

# SSL FIX
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;

# Temporarily skip verification of addins.
$ENV:CAKE_SETTINGS_SKIPVERIFICATION='true'

Expand Down
5 changes: 3 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.28.1
CAKE_VERSION=0.29.0
CAKE_EXE=$TOOLS_DIR/Cake.$CAKE_VERSION/Cake.exe

# Temporarily skip verification of addins.
Expand Down Expand Up @@ -50,10 +50,11 @@ 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 2.1.101 --install-dir .dotnet --no-path
sudo bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version 2.1.400 --install-dir .dotnet --no-path
export PATH="$SCRIPT_DIR/.dotnet":$PATH
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0
"$SCRIPT_DIR/.dotnet/dotnet" --info

###########################################################################
Expand Down
2 changes: 1 addition & 1 deletion build/parameters.cake
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class BuildParameters
Packages = BuildPackages.GetPackages(
Paths.Directories.NugetRoot,
Version.SemVersion,
new [] { "Cake", "Cake.Core", "Cake.Common", "Cake.Testing", "Cake.CoreCLR", "Cake.NuGet" },
new [] { "Cake", "Cake.Core", "Cake.Common", "Cake.Testing", "Cake.CoreCLR", "Cake.NuGet", "Cake.Tool" },
new [] { "cake.portable" });
}

Expand Down
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.4"
"version": "2.1.400"
}
}
1 change: 1 addition & 0 deletions nuspec/Cake.CoreCLR.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<projectUrl>https://github.com/cake-build/cake</projectUrl>
<iconUrl>https://raw.githubusercontent.com/cake-build/graphics/master/png/cake-medium.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<repository type="git" url="https://github.com/cake-build/cake"/>
<copyright>Copyright (c) .NET Foundation and contributors</copyright>
<tags>Cake Script Build</tags>
</metadata>
Expand Down
1 change: 1 addition & 0 deletions nuspec/Cake.CoreCLR.symbols.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<projectUrl>https://github.com/cake-build/cake</projectUrl>
<iconUrl>https://raw.githubusercontent.com/cake-build/graphics/master/png/cake-medium.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<repository type="git" url="https://github.com/cake-build/cake"/>
<copyright>Copyright (c) .NET Foundation and contributors</copyright>
<tags>Cake Script Build</tags>
</metadata>
Expand Down
1 change: 1 addition & 0 deletions nuspec/Cake.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<projectUrl>https://github.com/cake-build/cake</projectUrl>
<iconUrl>https://raw.githubusercontent.com/cake-build/graphics/master/png/cake-medium.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<repository type="git" url="https://github.com/cake-build/cake"/>
<copyright>Copyright (c) .NET Foundation and contributors</copyright>
<tags>Cake Script Build</tags>
</metadata>
Expand Down
1 change: 1 addition & 0 deletions nuspec/Cake.symbols.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<projectUrl>https://github.com/cake-build/cake</projectUrl>
<iconUrl>https://raw.githubusercontent.com/cake-build/graphics/master/png/cake-medium.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<repository type="git" url="https://github.com/cake-build/cake"/>
<copyright>Copyright (c) .NET Foundation and contributors</copyright>
<tags>Cake Script Build</tags>
</metadata>
Expand Down
32 changes: 32 additions & 0 deletions src/Cake.Common.Tests/CrossCutting/ToolSettingsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// 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.Collections.Generic;
using System.Linq;
using System.Reflection;
using Cake.Core.Tooling;
using Cake.Testing;
using Cake.Testing.Extensions;
using Xunit;

namespace Cake.Common.Tests.CrossCutting
{
public static class ToolSettingsTests
{
// Ensures that C# initializer syntax will not throw NullReferenceException when collection properties are used.
[Theory]
[MemberData(nameof(ToolSettingsTypes))]
public static void Tool_settings_collection_properties_must_be_initialized(MemberTestInfo<PropertyInfo> toolSettingsProperty)
{
Assert.NotNull(toolSettingsProperty.Member.GetValue(toolSettingsProperty.Instance));
}

public static IEnumerable<object[]> ToolSettingsTypes =>
from type in MemberTestingUtils.GetMembersToTest(typeof(ToolSettings), type =>
type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)
.Where(property => !property.PropertyType.IsArray
&& property.PropertyType.ImplementsInterfaceDefinition(typeof(ICollection<>))))
select new object[] { type };
}
}
4 changes: 2 additions & 2 deletions src/Cake.Common.Tests/Unit/ProcessAliasesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ public void Should_Use_Environments_Working_Directory()

// Then
fixture.ProcessRunner.Received(1).Start(
Arg.Any<FilePath>(), Arg.Is<ProcessSettings>(info =>
info.WorkingDirectory.FullPath == "/Working"));
Arg.Any<FilePath>(), Arg.Is<ProcessSettings>(
info => info.WorkingDirectory.FullPath == "/Working"));
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,22 @@ public void Should_Capture_NUnit()
"/TargetArguments=\"\\\"/Working/Test.dll\\\" -noshadow\" " +
"/Output=\"/Working/result.xml\"", result.Args);
}

[Fact]
public void Should_Append_ConfigurationFile()
{
// Given
var fixture = new DotCoverAnalyserFixture();
fixture.Settings.WithConfigFile(new FilePath("./config.xml"));

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

// Then
Assert.Equal("Analyse \"/Working/config.xml\" /TargetExecutable=\"/Working/tools/Test.exe\" " +
"/TargetArguments=\"-argument\" " +
"/Output=\"/Working/result.xml\"", result.Args);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,22 @@ public void Should_Capture_NUnit()
"/TargetArguments=\"\\\"/Working/Test.dll\\\" -noshadow\" " +
"/Output=\"/Working/result.dcvr\"", result.Args);
}

[Fact]
public void Should_Append_ConfigurationFile()
{
// Given
var fixture = new DotCoverCovererFixture();
fixture.Settings.WithConfigFile(new FilePath("./config.xml"));

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

// Then
Assert.Equal("Cover \"/Working/config.xml\" /TargetExecutable=\"/Working/tools/Test.exe\" " +
"/TargetArguments=\"-argument\" " +
"/Output=\"/Working/result.dcvr\"", result.Args);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System.Collections.Generic;
using Cake.Common.Tests.Fixtures.Tools.DotCover.Merge;
using Cake.Common.Tools.DotCover;
using Cake.Core.IO;
using Xunit;

Expand Down Expand Up @@ -85,6 +86,22 @@ public void Should_Append_LogFile()
"/Output=\"/Working/result.dcvr\" " +
"/LogFile=\"/Working/logfile.log\"", result.Args);
}

[Fact]
public void Should_Append_ConfigurationFile()
{
// Given
var fixture = new DotCoverMergerFixture();
fixture.Settings.WithConfigFile(new FilePath("./config.xml"));

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

// Then
Assert.Equal("Merge \"/Working/config.xml\" " +
"/Source=\"/Working/result1.dcvr;/Working/result2.dcvr\" " +
"/Output=\"/Working/result.dcvr\"", result.Args);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

using Cake.Common.Tests.Fixtures.Tools.DotCover.Report;
using Cake.Common.Tools.DotCover;
using Cake.Common.Tools.NUnit;
using Cake.Common.Tools.XUnit;
using Cake.Core.IO;
using Cake.Testing;
using Xunit;

namespace Cake.Common.Tests.Unit.Tools.DotCover.Report
Expand Down Expand Up @@ -95,6 +92,22 @@ public void Should_Append_LogFile()
"/Output=\"/Working/result.xml\" " +
"/LogFile=\"/Working/logfile.log\"", result.Args);
}

[Fact]
public void Should_Append_ConfigurationFile()
{
// Given
var fixture = new DotCoverReporterFixture();
fixture.Settings.WithConfigFile(new FilePath("./config.xml"));

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

// Then
Assert.Equal("Report \"/Working/config.xml\" " +
"/Source=\"/Working/result.dcvr\" " +
"/Output=\"/Working/result.xml\"", result.Args);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public void Should_Add_Settings()
{
// Given
var fixture = new DotNetCorePublisherFixture();
fixture.Settings.NoBuild = true;
fixture.Settings.NoDependencies = true;
fixture.Settings.NoRestore = true;
fixture.Settings.Framework = "dnxcore50";
Expand All @@ -121,7 +122,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 --no-dependencies --no-restore --force --self-contained --source \"https://api.nuget.org/v3/index.json\" --verbosity Minimal", result.Args);
Assert.Equal("publish --output \"/Working/artifacts\" --runtime runtime1 --framework dnxcore50 --configuration Release --version-suffix rc1 --no-build --no-dependencies --no-restore --force --self-contained --source \"https://api.nuget.org/v3/index.json\" --verbosity Minimal", result.Args);
}

[Fact]
Expand Down
44 changes: 44 additions & 0 deletions src/Cake.Common/DryRunAliases.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// 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 System.ComponentModel;
using System.Globalization;
using Cake.Core;
using Cake.Core.Annotations;

namespace Cake.Common
{
/// <summary>
/// Contains functionality related to arguments.
/// </summary>
[CakeAliasCategory("Dry Run")]
public static class DryRunAliases
{
/// <summary>
/// Determines whether or not the current script execution is a dry run.
/// </summary>
/// <param name="context">The context.</param>
/// <returns>Whether or not the current script execution is a dry run.</returns>
/// <example>
/// <code>
/// Setup(context =>
/// {
/// if (!context.IsDryRun())
/// {
/// // Do things that you don't want to
/// // do when script is being dry runned.
/// }
/// });
/// </code>
/// </example>
[CakeMethodAlias]
public static bool IsDryRun(this ICakeContext context)
{
return (context.Argument<bool?>("dryrun", false) ?? true)
|| (context.Argument<bool?>("noop", false) ?? true)
|| (context.Argument<bool?>("whatif", false) ?? true);
}
}
}
12 changes: 7 additions & 5 deletions src/Cake.Common/ProcessAliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ public static int StartProcess(this ICakeContext context, FilePath fileName, str
[CakeMethodAlias]
public static int StartProcess(this ICakeContext context, FilePath fileName, ProcessSettings settings)
{
IEnumerable<string> redirectedOutput;
return StartProcess(context, fileName, settings, out redirectedOutput);
return StartProcess(context, fileName, settings, out var redirectedOutput);
}

/// <summary>
Expand Down Expand Up @@ -253,9 +252,12 @@ public static IProcess StartAndReturnProcess(this ICakeContext context, FilePath
throw new ArgumentNullException(nameof(settings));
}

// Get the working directory.
var workingDirectory = settings.WorkingDirectory ?? context.Environment.WorkingDirectory;
settings.WorkingDirectory = workingDirectory.MakeAbsolute(context.Environment);
if (!settings.NoWorkingDirectory)
{
// Set the working directory.
var workingDirectory = settings.WorkingDirectory ?? context.Environment.WorkingDirectory;
settings.WorkingDirectory = workingDirectory.MakeAbsolute(context.Environment);
}

// Start the process.
var process = context.ProcessRunner.Start(fileName, settings);
Expand Down
Loading

0 comments on commit cab58db

Please # to comment.