Skip to content

Commit ece91fc

Browse files
committed
Merge branch 'release/0.20.0'
2 parents 42cfb32 + 7bcc9d4 commit ece91fc

File tree

9 files changed

+96
-12
lines changed

9 files changed

+96
-12
lines changed

CHANGELOG.md

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

77
## [vNext]
88

9+
## [0.20.0] / 2019-05-29
10+
- Changed `Solution.GetProject` to allow resolution from full path
11+
- Changed HTML execution plan to be shown left-to-right
12+
- Added `When` overload for combinatorial settings
13+
- Added `Project.GetOutputType` method for convenience
14+
- Added `GlobbingOptionsAttribute` for configuration of case-sensitivity
15+
- Fixed casing of `NuGet.exe`
16+
- Fixed `TeamServices` to resolve `BuildNumber` as `string`
17+
918
## [0.19.2] / 2019-05-10
1019
- Fixed `ProjectModelTasks` to use existing `MSBUILD_EXE_PATH` value
1120
- Fixed `ParameterService` to consider nullable enum types in value set calculation
@@ -357,7 +366,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
357366
- Added CLT tasks for Git
358367
- Fixed background color in console output
359368

360-
[vNext]: https://github.com/nuke-build/common/compare/0.19.2...HEAD
369+
[vNext]: https://github.com/nuke-build/common/compare/0.20.0...HEAD
370+
[0.20.0]: https://github.com/nuke-build/common/compare/0.19.2...0.20.0
361371
[0.19.2]: https://github.com/nuke-build/common/compare/0.19.1...0.19.2
362372
[0.19.1]: https://github.com/nuke-build/common/compare/0.19.0...0.19.1
363373
[0.19.0]: https://github.com/nuke-build/common/compare/0.18.0...0.19.0

build/specifications/NuGet.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"officialUrl": "https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference",
1111
"help": "The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.",
1212
"packageId": "NuGet.CommandLine",
13-
"packageExecutable": "nuget.exe",
13+
"packageExecutable": "NuGet.exe",
1414
"tasks": [
1515
{
1616
"postfix": "Push",

source/Nuke.Common/BuildServers/TeamServices.cs

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

@@ -40,7 +40,7 @@ internal TeamServices(Action<string> messageSink = null)
4040
public string AgentWorkFolder => Variable("AGENT_WORKFOLDER");
4141
public string ArtifactStagingDirectory => Variable("BUILD_ARTIFACTSTAGINGDIRECTORY");
4242
public long BuildId => Variable<long>("BUILD_BUILDID");
43-
public long BuildNumber => Variable<long>("BUILD_BUILDNUMBER");
43+
[NoConvert] public string BuildNumber => Variable<string>("BUILD_BUILDNUMBER");
4444
public string BuildUri => Variable("BUILD_BUILDURI");
4545
public string BinariesDirectory => Variable("BUILD_BINARIESDIRECTORY");
4646
public string DefinitionName => Variable("BUILD_DEFINITIONNAME");

source/Nuke.Common/Execution/execution-plan.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,11 @@
7373

7474
<body>
7575
<div class="mermaid">
76-
graph TD
76+
graph LR
7777
__GRAPH__
7878

7979
linkStyle default interpolate basis
80+
<!-- https://github.com/knsv/mermaid/issues/26 -->
8081
</div>
8182
</body>
8283

source/Nuke.Common/IO/PathConstruction.cs

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

@@ -11,18 +11,39 @@
1111
using System.Linq;
1212
using GlobExpressions;
1313
using JetBrains.Annotations;
14+
using Nuke.Common.Execution;
1415
using Nuke.Common.Utilities;
1516

1617
// ReSharper disable ArrangeMethodOrOperatorBody
1718

1819
namespace Nuke.Common.IO
1920
{
21+
/// <summary>
22+
/// Indicates the case sensitivity used for globbing.
23+
/// </summary>
24+
public enum GlobbingCaseSensitivity
25+
{
26+
/// <summary>
27+
/// Automatically determines whether to use case-sensitive or case-insensitive matching when globbing. This
28+
/// means using case-insensitive matching when running on Windows, and case-sensitive otherwise.
29+
/// </summary>
30+
Auto,
31+
/// <summary>
32+
/// Globbing patterns will be case-sensitive.
33+
/// </summary>
34+
CaseSensitive,
35+
/// <summary>
36+
/// Globbing patterns will be case-insensitive.
37+
/// </summary>
38+
CaseInsensitive
39+
}
40+
2041
/// <summary>
2142
/// <p>Provides an abstraction for generating Windows/Unix/UNC-compliant
2243
/// file-system paths independently of the underlying operating system. Usages should be restricted to the moment
2344
/// of construction, i.e., avoid using it as part of an API.</p>
2445
/// <p>Casting a string with <c>(RelativePath)</c> will construct any intermediate part of a path using the specific separators
25-
/// for the currently running operating-system. By using <c>(WinRelativePath)</c> and <c>(UnixRelativePath)</c> other separators can be
46+
/// for the currently running operating-system. By using <c>(WinRelativePath)</c> and <c>(UnixRelativePath)</c> other separators can be
2647
/// used intentionally. Casting with <c>(AbsolutePath)</c> ensures that the path is rooted as Windows/Unix/UNC-path. The operators
2748
/// <c>/</c> and <c>+</c> allow to append sub-directories.</p>
2849
/// <p>Resulting paths are automatically normalized if possible. So <c>C:\foo\..\bar\.</c> will become <c>C:\bar</c>.</p>
@@ -45,6 +66,24 @@ namespace Nuke.Common.IO
4566
[PublicAPI]
4667
public static class PathConstruction
4768
{
69+
internal static GlobbingCaseSensitivity GlobbingCaseSensitivity;
70+
71+
private static GlobOptions GlobOptions
72+
{
73+
get
74+
{
75+
switch (GlobbingCaseSensitivity)
76+
{
77+
case GlobbingCaseSensitivity.CaseSensitive:
78+
return GlobOptions.None;
79+
case GlobbingCaseSensitivity.CaseInsensitive:
80+
return GlobOptions.CaseInsensitive;
81+
default:
82+
return EnvironmentInfo.IsWin ? GlobOptions.CaseInsensitive : GlobOptions.None;
83+
}
84+
}
85+
}
86+
4887
// TODO: check usages
4988
[Pure]
5089
public static string GetRelativePath(string basePath, string destinationPath, bool normalize = true)
@@ -75,7 +114,7 @@ public static bool IsDescendantPath(string basePath, string destinationPath)
75114
public static IReadOnlyCollection<string> GlobFiles(string directory, params string[] patterns)
76115
{
77116
var directoryInfo = new DirectoryInfo(directory);
78-
return patterns.SelectMany(x => directoryInfo.GlobFiles(x)).Select(x => x.FullName).ToList();
117+
return patterns.SelectMany(x => Glob.Files(directoryInfo, x, GlobOptions)).Select(x => x.FullName).ToList();
79118
}
80119

81120
public static IReadOnlyCollection<AbsolutePath> GlobFiles(this AbsolutePath directory, params string[] patterns)
@@ -87,7 +126,7 @@ public static IReadOnlyCollection<AbsolutePath> GlobFiles(this AbsolutePath dire
87126
public static IReadOnlyCollection<string> GlobDirectories(string directory, params string[] patterns)
88127
{
89128
var directoryInfo = new DirectoryInfo(directory);
90-
return patterns.SelectMany(x => directoryInfo.GlobDirectories(x)).Select(x => x.FullName).ToList();
129+
return patterns.SelectMany(x => Glob.Directories(directoryInfo, x, GlobOptions)).Select(x => x.FullName).ToList();
91130
}
92131

93132
public static IReadOnlyCollection<AbsolutePath> GlobDirectories(this AbsolutePath directory, params string[] patterns)
@@ -415,4 +454,24 @@ public override string ToString()
415454
}
416455
}
417456
}
457+
458+
/// <summary>
459+
/// Allows to configure the case-sensitivity used for globbing operations in <see cref="PathConstruction"/>.
460+
/// </summary>
461+
[PublicAPI]
462+
[AttributeUsage(AttributeTargets.Class)]
463+
public sealed class GlobbingOptionsAttribute : Attribute, IPreLogoBuildExtension
464+
{
465+
private readonly GlobbingCaseSensitivity _caseSensitivity;
466+
467+
public GlobbingOptionsAttribute(GlobbingCaseSensitivity caseSensitivity)
468+
{
469+
_caseSensitivity = caseSensitivity;
470+
}
471+
472+
public void Execute(NukeBuild build, IReadOnlyCollection<ExecutableTarget> executableTargets, IReadOnlyCollection<ExecutableTarget> executionPlan)
473+
{
474+
PathConstruction.GlobbingCaseSensitivity = _caseSensitivity;
475+
}
476+
}
418477
}

source/Nuke.Common/ProjectModel/ProjectExtensions.cs

+6
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,11 @@ public static IReadOnlyCollection<string> GetTargetFrameworks(this Project proje
6969

7070
return new string[0];
7171
}
72+
73+
public static string GetOutputType(this Project project)
74+
{
75+
var msbuildProject = project.GetMSBuildProject();
76+
return msbuildProject.GetProperty("OutputType").EvaluatedValue;
77+
}
7278
}
7379
}

source/Nuke.Common/ProjectModel/Solution.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Text.RegularExpressions;
99
using JetBrains.Annotations;
1010
using Nuke.Common.IO;
11+
using Nuke.Common.Utilities;
1112

1213
namespace Nuke.Common.ProjectModel
1314
{
@@ -57,9 +58,10 @@ public SolutionFolder GetSolutionFolder(string name)
5758
}
5859

5960
[CanBeNull]
60-
public Project GetProject(string name)
61+
public Project GetProject(string nameOrFullPath)
6162
{
62-
return AllProjects.SingleOrDefault(x => name.Equals(x.Name, StringComparison.Ordinal));
63+
return AllProjects.SingleOrDefault(x => nameOrFullPath.Equals(x.Name, StringComparison.Ordinal)) ??
64+
AllProjects.SingleOrDefault(x => x.Path.ToString().EqualsOrdinalIgnoreCase(nameOrFullPath));
6365
}
6466

6567
public IEnumerable<Project> GetProjects(string wildcardPattern)

source/Nuke.Common/Tooling/ToolSettings.When.cs

+6
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@ public static T When<T>(this T settings, bool condition, Configure<T> configurat
1414
{
1515
return condition ? configurator(settings) : settings;
1616
}
17+
18+
public static T[] When<T>(this T[] settings, Func<T, bool> condition, Configure<T> configurator)
19+
where T : ToolSettings
20+
{
21+
return settings.Select(x => condition(x) ? x : configurator(x)).ToArray();
22+
}
1723
}
1824
}

source/Nuke.Common/Tools/NuGet/NuGet.Generated.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static partial class NuGetTasks
2828
/// </summary>
2929
public static string NuGetPath =>
3030
ToolPathResolver.TryGetEnvironmentExecutable("NUGET_EXE") ??
31-
ToolPathResolver.GetPackageExecutable("NuGet.CommandLine", "nuget.exe");
31+
ToolPathResolver.GetPackageExecutable("NuGet.CommandLine", "NuGet.exe");
3232
public static Action<OutputType, string> NuGetLogger { get; set; } = ProcessTasks.DefaultLogger;
3333
/// <summary>
3434
/// The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.

0 commit comments

Comments
 (0)