Skip to content

Commit ed0b487

Browse files
committed
Merge branch 'release/0.16.0'
2 parents b7cdef4 + dff8752 commit ed0b487

File tree

106 files changed

+26344
-6801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+26344
-6801
lines changed

CHANGELOG.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,25 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [vNext]
88

9+
## [0.16.0] / 2019-01-30
10+
- Changed setting of default working directory for process invocations
11+
- Changed `Logger.Log` to `Logger.Normal`
12+
- Added `NukeBuild.Execute` overload without default target
13+
- Added `ContinueOnFailure` and `AssuredAfterFailure` as target definition methods
14+
- Added `AbsolutePath` extensions for `GlobDirectories/Files`
15+
- Added `AggregateException` handling to show number as prefix when flattening
16+
- Added `AnsiColorOutputSink` for Bitrise, TeamCity, Travis, TeamServices
17+
- Added `ProjectModelTasks.ParseProject` based on `Microsoft.Build` packages
18+
- Added `LocalExecutableAttribute`
19+
- Added `degreeOfParallelism` and `completeOnError` for combinatorial invocations
20+
- Added `[Tool].[Tool]Logger` as settable field for custom logging
21+
- Added `VerbosityMappingAttribute`
22+
- Added format-property map for CLI tasks
23+
- Fixed `EnsureCleanDirectory` to only clean instead of delete and recreate
24+
- Fixed `TeamCityOutputSink` to not report errors as build problems
25+
- Fixed `SolutionAttribute` to resolve first by constructor argument
26+
- Fixed `Xunit2ParallelOption` to use lower-case text
27+
928
## [0.15.0] / 2019-01-16
1029
- Changed `OnlyWhen` to `OnlyWhenStatic` and `OnlyWhenDynamic`
1130
- Changed `graph` parameter to `plan`
@@ -268,7 +287,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
268287
- Added CLT tasks for Git
269288
- Fixed background color in console output
270289

271-
[vNext]: https://github.com/nuke-build/common/compare/0.15.0...HEAD
290+
[vNext]: https://github.com/nuke-build/common/compare/0.16.0...HEAD
291+
[0.16.0]: https://github.com/nuke-build/common/compare/0.15.0...0.16.0
272292
[0.15.0]: https://github.com/nuke-build/common/compare/0.14.1...0.15.0
273293
[0.14.1]: https://github.com/nuke-build/common/compare/0.14.0...0.14.1
274294
[0.14.0]: https://github.com/nuke-build/common/compare/0.13.0...0.14.0

build/Build.cs

+18-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018 Maintainers of NUKE.
1+
// Copyright 2018 Maintainers of NUKE.
22
// Distributed under the MIT License.
33
// https://github.com/nuke-build/nuke/blob/master/LICENSE
44

@@ -24,11 +24,11 @@
2424
using static Nuke.Common.Tools.InspectCode.InspectCodeTasks;
2525
using static Nuke.Common.IO.FileSystemTasks;
2626
using static Nuke.Common.IO.PathConstruction;
27-
using static Nuke.Common.EnvironmentInfo;
2827
using static Nuke.Common.Tools.Slack.SlackTasks;
2928

3029
// ReSharper disable HeapView.DelegateAllocation
3130

31+
// [DotNetVerbosityMapping]
3232
partial class Build : NukeBuild
3333
{
3434
public static int Main() => Execute<Build>(x => x.Pack);
@@ -59,7 +59,7 @@ partial class Build : NukeBuild
5959
.Before(Restore)
6060
.Executes(() =>
6161
{
62-
DeleteDirectories(GlobDirectories(SourceDirectory, "*/bin", "*/obj"));
62+
SourceDirectory.GlobDirectories("*/bin", "*/obj").ForEach(DeleteDirectory);
6363
EnsureCleanDirectory(OutputDirectory);
6464
});
6565

@@ -131,13 +131,14 @@ from framework in project.GetMSBuildProject().GetTargetFrameworks()
131131
.DependsOn(Compile)
132132
.Executes(() =>
133133
{
134-
Solution.GetProjects("*.Tests")
135-
.ForEach(x => DotNetTest(s => s
136-
.SetProjectFile(x)
137-
.SetConfiguration(Configuration)
138-
.EnableNoBuild()
139-
.SetLogger("trx")
140-
.SetResultsDirectory(OutputDirectory)));
134+
DotNetTest(s => s
135+
.SetConfiguration(Configuration)
136+
.EnableNoBuild()
137+
.SetLogger("trx")
138+
.SetResultsDirectory(OutputDirectory)
139+
.CombineWith(
140+
Solution.GetProjects("*.Tests"), (cs, v) => cs
141+
.SetProjectFile(v)));
141142
});
142143

143144
Target Analysis => _ => _
@@ -166,13 +167,15 @@ from framework in project.GetMSBuildProject().GetTargetFrameworks()
166167
GitRepository.Branch.StartsWithOrdinalIgnoreCase(HotfixBranchPrefix))
167168
.Executes(() =>
168169
{
169-
GlobFiles(OutputDirectory, "*.nupkg").NotEmpty()
170-
.Where(x => !x.EndsWith(".symbols.nupkg"))
171-
.ForEach(x => DotNetNuGetPush(s => s
172-
.SetTargetPath(x)
170+
DotNetNuGetPush(s => s
173171
.SetSource(Source)
174172
.SetSymbolSource(SymbolSource)
175-
.SetApiKey(ApiKey)));
173+
.SetApiKey(ApiKey)
174+
.CombineWith(
175+
OutputDirectory.GlobFiles("*.nupkg").NotEmpty(), (cs, v) => cs
176+
.SetTargetPath(v)),
177+
degreeOfParallelism: 5,
178+
completeOnFailure: true);
176179

177180
if (GitRepository.Branch.EqualsOrdinalIgnoreCase(MasterBranch))
178181
{

build/specifications/DotNet.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"name": "DotNet",
1414
"officialUrl": "https://docs.microsoft.com/en-us/dotnet/core/tools/",
1515
"pathExecutable": "dotnet",
16-
"logLevelParsing": true,
16+
"customLogger": true,
1717
"tasks": [
1818
{
1919
"help": "The <c>dotnet test</c> command is used to execute unit tests in a given project. Unit tests are console application projects that have dependencies on the unit test framework (for example, MSTest, NUnit, or xUnit) and the dotnet test runner for the unit testing framework. These are packaged as NuGet packages and are restored as ordinary dependencies for the project.",

build/specifications/SignTool.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
{
219219
"name": "AuthenticodeDigestSignPassUnmodified",
220220
"type": "string",
221-
"format": "dmdf {value}",
221+
"format": "/dmdf {value}",
222222
"help": "When used with the <c>/dlib</c> option, passes the file's contents to the AuthenticodeDigestSign function without modification."
223223
},
224224
{

build/specifications/SonarScanner.json

+21
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,27 @@
6565
"format": "/d:sonar.verbose={value}",
6666
"help": "Sets the logging verbosity to detailed. Add this argument before sending logs for troubleshooting."
6767
},
68+
{
69+
"name": "VSTestReports",
70+
"type": "List<string>",
71+
"format": "/d:sonar.cs.vstest.reportsPaths={value}",
72+
"separator": ",",
73+
"help": "Comma separated list of VSTest report files to include."
74+
},
75+
{
76+
"name": "NUnitTestReports",
77+
"type": "List<string>",
78+
"format": "/d:sonar.cs.nunit.reportsPaths={value}",
79+
"separator": ",",
80+
"help": "Comma separated list of NUnit report files to include."
81+
},
82+
{
83+
"name": "XUnitTestReports",
84+
"type": "List<string>",
85+
"format": "/d:sonar.cs.xunit.reportsPaths={value}",
86+
"separator": ",",
87+
"help": "Comma separated list of xUnit report files to include."
88+
},
6889
{
6990
"name": "CoverageExclusions",
7091
"type": "List<string>",

build/specifications/Unity.json

-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@
325325
{
326326
"name": "UnityBaseSettings",
327327
"extensionMethods": true,
328-
"argumentConstruction": true,
329328
"properties": [
330329
{
331330
"name": "LogFile",

build/specifications/Xunit.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@
181181
{
182182
"name": "Xunit2ParallelOption",
183183
"values": [
184-
"None",
185-
"Collections",
186-
"Assemblies",
187-
"All"
184+
"none",
185+
"collections",
186+
"assemblies",
187+
"all"
188188
]
189189
},
190190
{

global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "2.1.300"
3+
"version": "2.2.101"
44
}
55
}

source/Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
<Authors>Matthias Koch, Sebastian Karasek</Authors>
1717
<Copyright>Copyright $([System.DateTime]::Now.Year) Maintainers of NUKE</Copyright>
1818
<PackageTags>build automation continuous-integration tools orchestration</PackageTags>
19+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1920
<PackageProjectUrl>https://nuke.build</PackageProjectUrl>
2021
<RepositoryUrl>https://github.com/nuke-build/nuke</RepositoryUrl>
21-
<PackageLicenseUrl>https://github.com/nuke-build/nuke/blob/master/LICENSE</PackageLicenseUrl>
2222
<PackageIconUrl>https://raw.githubusercontent.com/nuke-build/nuke/master/icon.png</PackageIconUrl>
2323
</PropertyGroup>
2424

source/Nuke.CodeGeneration/Generators/DataClassGenerator.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static class DataClassGenerator
1818
{
1919
public static void Run(DataClass dataClass, ToolWriter toolWriter)
2020
{
21-
if (dataClass.ArgumentConstruction)
21+
if (dataClass.IsToolSettingsClass)
2222
{
2323
foreach (var property in dataClass.Properties)
2424
{
@@ -40,7 +40,7 @@ public static void Run(DataClass dataClass, ToolWriter toolWriter)
4040
.WriteLine($"public partial class {dataClass.Name} : {baseType}")
4141
.WriteBlock(w => w
4242
.WriteToolPath()
43-
.WriteLogLevelParser()
43+
.WriteLogger()
4444
.ForEach(dataClass.Properties, WritePropertyDeclaration)
4545
.WriteConfigureArguments())
4646
.WriteLine("#endregion");
@@ -88,14 +88,14 @@ private static DataClassWriter WriteToolPath(this DataClassWriter writer)
8888
.WriteLine($"public override string ToolPath => base.ToolPath ?? {resolver};");
8989
}
9090

91-
private static DataClassWriter WriteLogLevelParser(this DataClassWriter writer)
91+
private static DataClassWriter WriteLogger(this DataClassWriter writer)
9292
{
93-
var tool = writer.DataClass.Tool;
94-
if (!tool.LogLevelParsing)
93+
if (!writer.DataClass.IsToolSettingsClass)
9594
return writer;
96-
97-
var logLevelParser = $"{tool.GetClassName()}.ParseLogLevel";
98-
return writer.WriteLine($"protected override Func<string, LogLevel> LogLevelParser => {logLevelParser};");
95+
96+
var tool = writer.DataClass.Tool;
97+
var logger = $"{tool.GetClassName()}.{tool.Name}Logger";
98+
return writer.WriteLine($"public override Action<OutputType, string> CustomLogger => {logger};");
9999
}
100100

101101
private static void WritePropertyDeclaration(DataClassWriter writer, Property property)

source/Nuke.CodeGeneration/Generators/ModelExtensions.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using System.Linq;
77
using System.Text.RegularExpressions;
8+
using JetBrains.Annotations;
89
using Nuke.CodeGeneration.Model;
910
using Nuke.Common;
1011
using Nuke.Common.Utilities;
@@ -84,7 +85,8 @@ public static bool IsBoolean(this Property property)
8485
{
8586
return property.Type.StartsWith("bool");
8687
}
87-
88+
89+
8890
public static string GetClassName(this Tool tool)
8991
{
9092
return $"{tool.Name}Tasks";

source/Nuke.CodeGeneration/Generators/StringExtensions.cs

+9-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Humanizer;
1010
using JetBrains.Annotations;
1111
using Nuke.Common;
12+
using Nuke.Common.Utilities;
1213

1314
namespace Nuke.CodeGeneration.Generators
1415
{
@@ -112,12 +113,16 @@ public static string EscapeProperty(this string propertyName)
112113
return s_reservedWords.Contains(propertyName) ? propertyName + "_" : propertyName;
113114
}
114115

115-
public static string Paragraph([CanBeNull] this string text)
116+
public static string Paragraph(this string text)
116117
{
117-
if (text == null)
118-
return string.Empty;
118+
return text == null || text.StartsWith("<p>") && text.EndsWith("</p>")
119+
? text
120+
: $"<p>{text}</p>";
121+
}
119122

120-
return !text.StartsWith("<p>") ? $"<p>{text}</p>" : text;
123+
public static string Emphasize(this string text)
124+
{
125+
return $"<em>{text}</em>";
121126
}
122127

123128
public static string ToSingular(this string name)

source/Nuke.CodeGeneration/Generators/TaskGenerator.cs

+27-11
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ public static void Run(Tool tool, ToolWriter toolWriter)
2727
.WriteLine($"public static partial class {tool.GetClassName()}")
2828
.WriteBlock(w =>
2929
{
30-
w.WriteToolPath();
31-
w.WriteGenericTask();
30+
w
31+
.WriteToolPath()
32+
.WriteLogger()
33+
.WriteGenericTask();
34+
3235
tool.Tasks.ForEach(x => new TaskWriter(x, toolWriter)
3336
.WriteToolSettingsTask()
3437
.WriteConfiguratorTask()
@@ -56,7 +59,7 @@ private static void WriteGenericTask(this ToolWriter writer)
5659
"environmentVariables",
5760
"timeout",
5861
"logOutput",
59-
writer.Tool.LogLevelParsing ? "ParseLogLevel" : "null",
62+
$"{tool.Name}Logger",
6063
"outputFilter"
6164
};
6265
writer
@@ -100,6 +103,7 @@ private static TaskWriter WriteConfiguratorTask(this TaskWriter writer)
100103

101104
return writer
102105
.WriteSummary(task)
106+
.WriteRemarks(task)
103107
.WriteObsoleteAttributeWhenObsolete(task)
104108
.WriteLine($"public static {returnType} {task.GetTaskMethodName()}(Configure<{task.SettingsClass.Name}> configurator)")
105109
.WriteBlock(w => w
@@ -109,21 +113,25 @@ private static TaskWriter WriteConfiguratorTask(this TaskWriter writer)
109113
private static TaskWriter WriteCombinatorialConfiguratorTask(this TaskWriter writer)
110114
{
111115
var task = writer.Task;
116+
112117
var returnType = !task.HasReturnValue()
113118
? $"IEnumerable<({task.SettingsClass.Name} Settings, IReadOnlyCollection<Output> Output)>"
114119
: $"IEnumerable<({task.SettingsClass.Name} Settings, {task.ReturnType} Result, IReadOnlyCollection<Output> Output)>";
115-
var selector = !task.HasReturnValue()
116-
? "(x.ToolSettings, x.ReturnValue)"
117-
: "(x.ToolSettings, x.ReturnValue.Result, x.ReturnValue.Output)";
118-
120+
121+
var parameters = new[]
122+
{
123+
$"CombinatorialConfigure<{task.SettingsClass.Name}> configurator",
124+
"int degreeOfParallelism = 1",
125+
"bool completeOnFailure = false"
126+
}.JoinComma();
127+
119128
return writer
120129
.WriteSummary(task)
130+
.WriteRemarks(task)
121131
.WriteObsoleteAttributeWhenObsolete(task)
122-
.WriteLine($"public static {returnType} {task.GetTaskMethodName()}(CombinatorialConfigure<{task.SettingsClass.Name}> configurator)")
132+
.WriteLine($"public static {returnType} {task.GetTaskMethodName()}({parameters})")
123133
.WriteBlock(w => w
124-
.WriteLine($"return configurator(new {task.SettingsClass.Name}())")
125-
.WriteLine($" .Select(x => (ToolSettings: x, ReturnValue: {task.GetTaskMethodName()}(x)))")
126-
.WriteLine($" .Select(x => {selector}).ToList();"));
134+
.WriteLine($"return configurator.Invoke({task.GetTaskMethodName()}, {task.Tool.Name}Logger, degreeOfParallelism, completeOnFailure);"));
127135
}
128136

129137
private static string GetProcessStart(Task task)
@@ -166,5 +174,13 @@ private static ToolWriter WriteToolPath(this ToolWriter writer)
166174
.WriteLine($" ToolPathResolver.TryGetEnvironmentExecutable(\"{tool.Name.ToUpperInvariant()}_EXE\") ??")
167175
.WriteLine($" {resolvers.Single()};");
168176
}
177+
178+
private static ToolWriter WriteLogger(this ToolWriter writer)
179+
{
180+
var tool = writer.Tool;
181+
var logger = tool.CustomLogger ? "CustomLogger" : "ProcessManager.DefaultLogger";
182+
return writer
183+
.WriteLine($"public static Action<OutputType, string> {tool.Name}Logger {{ get; set; }} = {logger};");
184+
}
169185
}
170186
}

0 commit comments

Comments
 (0)