Skip to content

Commit

Permalink
Merge branch 'hotfix/6.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Jul 2, 2022
2 parents 706f53a + 5617b1b commit 12a091b
Show file tree
Hide file tree
Showing 12 changed files with 153 additions and 75 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [vNext]

## [6.1.2] / 2022-07-02
- Removed `Newtonsoft.Json.Schema` dependency
- Fixed `Nuke.GlobalTool` to target `net6.0`
- Fixed telemetry to calculate properties only on demand
- Fixed missing `Framework` in `MinVerTasks` and `MinVerAttribute`
- Fixed missing arguments in `DotNetTasks`

## [6.1.1] / 2022-06-21
- Fixed output encoding in `Nuke.GlobalTool` to be UTF-8
- Fixed telemetry to handle Git repositories without remote
Expand Down Expand Up @@ -941,7 +948,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added CLT tasks for Git
- Fixed background color in console output

[vNext]: https://github.com/nuke-build/nuke/compare/6.1.1...HEAD
[vNext]: https://github.com/nuke-build/nuke/compare/6.1.2...HEAD
[6.1.2]: https://github.com/nuke-build/nuke/compare/6.1.1...6.1.2
[6.1.1]: https://github.com/nuke-build/nuke/compare/6.1.0...6.1.1
[6.1.0]: https://github.com/nuke-build/nuke/compare/6.0.3...6.1.0
[6.0.3]: https://github.com/nuke-build/nuke/compare/6.0.2...6.0.3
Expand Down Expand Up @@ -1031,4 +1039,3 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
[0.3.1]: https://github.com/nuke-build/nuke/compare/0.2.10...0.3.1
[0.2.10]: https://github.com/nuke-build/nuke/compare/0.2.0...0.2.10
[0.2.0]: https://github.com/nuke-build/nuke/tree/0.2.0

8 changes: 0 additions & 8 deletions build/Build.CodeGeneration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,19 @@

using System;
using JetBrains.Annotations;
using Nuke.CodeGeneration.Model;
using Nuke.Common;
using Nuke.Common.IO;
using Nuke.Common.Tools.GitHub;
using Nuke.Common.Utilities.Collections;
using static Nuke.CodeGeneration.CodeGenerator;
using static Nuke.CodeGeneration.ReferenceUpdater;
using static Nuke.CodeGeneration.SchemaGenerator;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Tools.Git.GitTasks;

partial class Build
{
AbsolutePath SpecificationsDirectory => RootDirectory / "source" / "Nuke.Common" / "Tools";
string ReferencesDirectory => BuildProjectDirectory / "references";
string ToolSchemaFile => SourceDirectory / "Nuke.CodeGeneration" / "schema.json";

Target References => _ => _
.Requires(() => GitHasCleanWorkingCopy())
Expand All @@ -34,11 +31,6 @@ partial class Build
Target GenerateTools => _ => _
.Executes(() =>
{
GenerateSchema<Tool>(
ToolSchemaFile,
GitRepository.GetGitHubDownloadUrl(ToolSchemaFile, MasterBranch),
"Tool specification schema file by NUKE");
SpecificationsDirectory.GlobFiles("*/*.json").ForEach(x =>
GenerateCode(
x,
Expand Down
1 change: 0 additions & 1 deletion source/Nuke.CodeGeneration/Nuke.CodeGeneration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.43" />
<PackageReference Include="Humanizer" Version="2.14.1" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.14" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.4.1" />
</ItemGroup>

Expand Down
37 changes: 0 additions & 37 deletions source/Nuke.CodeGeneration/SchemaGenerator.cs

This file was deleted.

49 changes: 28 additions & 21 deletions source/Nuke.Common/Execution/Telemetry.Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,64 +17,71 @@ public static void BuildStarted(NukeBuild build)
{
TrackEvent(
eventName: nameof(BuildStarted),
properties: GetCommonProperties(build)
.AddDictionary(GetBuildProperties(build))
.AddDictionary(GetRepositoryProperties(NukeBuild.RootDirectory)));
propertiesProvider: () =>
GetCommonProperties(build)
.AddDictionary(GetBuildProperties(build))
.AddDictionary(GetRepositoryProperties(NukeBuild.RootDirectory)));
}

public static void TargetSucceeded(ExecutableTarget target, NukeBuild build)
{
if (target.Name.EqualsAnyOrdinalIgnoreCase(s_knownTargets) &&
target.Status == ExecutionStatus.Succeeded)
{
TrackEvent(
eventName: nameof(TargetSucceeded),
properties: GetCommonProperties(build)
if (!target.Name.EqualsAnyOrdinalIgnoreCase(s_knownTargets) ||
target.Status != ExecutionStatus.Succeeded)
return;

TrackEvent(
eventName: nameof(TargetSucceeded),
propertiesProvider: () =>
GetCommonProperties(build)
.AddDictionary(GetTargetProperties(build, target))
.AddDictionary(GetBuildProperties(build))
.AddDictionary(GetRepositoryProperties(NukeBuild.RootDirectory)));
}
}

public static void ConfigurationGenerated(Type hostType, string generatorId, NukeBuild build)
{
TrackEvent(
eventName: nameof(ConfigurationGenerated),
properties: GetCommonProperties(build)
.AddDictionary(GetGeneratorProperties(hostType, generatorId))
.AddDictionary(GetBuildProperties(build))
.AddDictionary(GetRepositoryProperties(EnvironmentInfo.WorkingDirectory)));
propertiesProvider: () =>
GetCommonProperties(build)
.AddDictionary(GetGeneratorProperties(hostType, generatorId))
.AddDictionary(GetBuildProperties(build))
.AddDictionary(GetRepositoryProperties(EnvironmentInfo.WorkingDirectory)));
}

public static void SetupBuild()
{
TrackEvent(
eventName: nameof(SetupBuild),
properties: GetCommonProperties()
.AddDictionary(GetRepositoryProperties(EnvironmentInfo.WorkingDirectory)));
propertiesProvider: () =>
GetCommonProperties()
.AddDictionary(GetRepositoryProperties(EnvironmentInfo.WorkingDirectory)));
}

public static void ConvertCake()
{
TrackEvent(
eventName: nameof(ConvertCake),
properties: GetCommonProperties()
.AddDictionary(GetRepositoryProperties(EnvironmentInfo.WorkingDirectory)));
propertiesProvider: () =>
GetCommonProperties()
.AddDictionary(GetRepositoryProperties(EnvironmentInfo.WorkingDirectory)));
}

public static void AddPackage()
{
TrackEvent(
eventName: nameof(AddPackage),
properties: GetCommonProperties()
.AddDictionary(GetRepositoryProperties(EnvironmentInfo.WorkingDirectory)));
propertiesProvider: () =>
GetCommonProperties()
.AddDictionary(GetRepositoryProperties(EnvironmentInfo.WorkingDirectory)));
}

private static void TrackEvent(string eventName, IDictionary<string, string> properties)
private static void TrackEvent(string eventName, Func<IDictionary<string, string>> propertiesProvider)
{
if (s_client == null)
return;

var properties = propertiesProvider.Invoke();
// TODO: logging additional
Log.Verbose("Sending {EventName} telemetry event ...", eventName);
var longestPropertyName = properties.Keys.Max(x => x.Length);
Expand Down
65 changes: 65 additions & 0 deletions source/Nuke.Common/Tools/DotNet/DotNet.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ public static IReadOnlyCollection<Output> DotNetPack(Configure<DotNetPackSetting
/// <li><c>--output</c> via <see cref="DotNetBuildSettings.OutputDirectory"/></li>
/// <li><c>--packages</c> via <see cref="DotNetBuildSettings.PackageDirectory"/></li>
/// <li><c>--runtime</c> via <see cref="DotNetBuildSettings.Runtime"/></li>
/// <li><c>--self-contained</c> via <see cref="DotNetBuildSettings.SelfContained"/></li>
/// <li><c>--source</c> via <see cref="DotNetBuildSettings.Sources"/></li>
/// <li><c>--use-lock-file</c> via <see cref="DotNetBuildSettings.UseLockFile"/></li>
/// <li><c>--verbosity</c> via <see cref="DotNetBuildSettings.Verbosity"/></li>
Expand Down Expand Up @@ -564,6 +565,7 @@ public static IReadOnlyCollection<Output> DotNetBuild(DotNetBuildSettings toolSe
/// <li><c>--output</c> via <see cref="DotNetBuildSettings.OutputDirectory"/></li>
/// <li><c>--packages</c> via <see cref="DotNetBuildSettings.PackageDirectory"/></li>
/// <li><c>--runtime</c> via <see cref="DotNetBuildSettings.Runtime"/></li>
/// <li><c>--self-contained</c> via <see cref="DotNetBuildSettings.SelfContained"/></li>
/// <li><c>--source</c> via <see cref="DotNetBuildSettings.Sources"/></li>
/// <li><c>--use-lock-file</c> via <see cref="DotNetBuildSettings.UseLockFile"/></li>
/// <li><c>--verbosity</c> via <see cref="DotNetBuildSettings.Verbosity"/></li>
Expand Down Expand Up @@ -601,6 +603,7 @@ public static IReadOnlyCollection<Output> DotNetBuild(Configure<DotNetBuildSetti
/// <li><c>--output</c> via <see cref="DotNetBuildSettings.OutputDirectory"/></li>
/// <li><c>--packages</c> via <see cref="DotNetBuildSettings.PackageDirectory"/></li>
/// <li><c>--runtime</c> via <see cref="DotNetBuildSettings.Runtime"/></li>
/// <li><c>--self-contained</c> via <see cref="DotNetBuildSettings.SelfContained"/></li>
/// <li><c>--source</c> via <see cref="DotNetBuildSettings.Sources"/></li>
/// <li><c>--use-lock-file</c> via <see cref="DotNetBuildSettings.UseLockFile"/></li>
/// <li><c>--verbosity</c> via <see cref="DotNetBuildSettings.Verbosity"/></li>
Expand Down Expand Up @@ -1879,6 +1882,10 @@ public partial class DotNetBuildSettings : ToolSettings
/// </summary>
public virtual string OutputDirectory { get; internal set; }
/// <summary>
/// Publishes the .NET runtime with the application so the runtime doesn't need to be installed on the target machine. The default is <c>true</c> if a runtime identifier is specified. Available since .NET 6 SDK
/// </summary>
public virtual bool? SelfContained { get; internal set; }
/// <summary>
/// Specifies the target runtime. For a list of Runtime Identifiers (RIDs), see the <a href="https://docs.microsoft.com/en-us/dotnet/core/rid-catalog">RID catalog</a>.
/// </summary>
public virtual string Runtime { get; internal set; }
Expand Down Expand Up @@ -1963,6 +1970,7 @@ protected override Arguments ConfigureProcessArguments(Arguments arguments)
.Add("--no-incremental", NoIncremental)
.Add("--no-restore", NoRestore)
.Add("--output {value}", OutputDirectory)
.Add("--self-contained {value}", SelfContained)
.Add("--runtime {value}", Runtime)
.Add("--verbosity {value}", Verbosity)
.Add("--version-suffix {value}", VersionSuffix)
Expand Down Expand Up @@ -11108,6 +11116,63 @@ public static T ResetOutputDirectory<T>(this T toolSettings) where T : DotNetBui
return toolSettings;
}
#endregion
#region SelfContained
/// <summary>
/// <p><em>Sets <see cref="DotNetBuildSettings.SelfContained"/></em></p>
/// <p>Publishes the .NET runtime with the application so the runtime doesn't need to be installed on the target machine. The default is <c>true</c> if a runtime identifier is specified. Available since .NET 6 SDK</p>
/// </summary>
[Pure]
public static T SetSelfContained<T>(this T toolSettings, bool? selfContained) where T : DotNetBuildSettings
{
toolSettings = toolSettings.NewInstance();
toolSettings.SelfContained = selfContained;
return toolSettings;
}
/// <summary>
/// <p><em>Resets <see cref="DotNetBuildSettings.SelfContained"/></em></p>
/// <p>Publishes the .NET runtime with the application so the runtime doesn't need to be installed on the target machine. The default is <c>true</c> if a runtime identifier is specified. Available since .NET 6 SDK</p>
/// </summary>
[Pure]
public static T ResetSelfContained<T>(this T toolSettings) where T : DotNetBuildSettings
{
toolSettings = toolSettings.NewInstance();
toolSettings.SelfContained = null;
return toolSettings;
}
/// <summary>
/// <p><em>Enables <see cref="DotNetBuildSettings.SelfContained"/></em></p>
/// <p>Publishes the .NET runtime with the application so the runtime doesn't need to be installed on the target machine. The default is <c>true</c> if a runtime identifier is specified. Available since .NET 6 SDK</p>
/// </summary>
[Pure]
public static T EnableSelfContained<T>(this T toolSettings) where T : DotNetBuildSettings
{
toolSettings = toolSettings.NewInstance();
toolSettings.SelfContained = true;
return toolSettings;
}
/// <summary>
/// <p><em>Disables <see cref="DotNetBuildSettings.SelfContained"/></em></p>
/// <p>Publishes the .NET runtime with the application so the runtime doesn't need to be installed on the target machine. The default is <c>true</c> if a runtime identifier is specified. Available since .NET 6 SDK</p>
/// </summary>
[Pure]
public static T DisableSelfContained<T>(this T toolSettings) where T : DotNetBuildSettings
{
toolSettings = toolSettings.NewInstance();
toolSettings.SelfContained = false;
return toolSettings;
}
/// <summary>
/// <p><em>Toggles <see cref="DotNetBuildSettings.SelfContained"/></em></p>
/// <p>Publishes the .NET runtime with the application so the runtime doesn't need to be installed on the target machine. The default is <c>true</c> if a runtime identifier is specified. Available since .NET 6 SDK</p>
/// </summary>
[Pure]
public static T ToggleSelfContained<T>(this T toolSettings) where T : DotNetBuildSettings
{
toolSettings = toolSettings.NewInstance();
toolSettings.SelfContained = !toolSettings.SelfContained;
return toolSettings;
}
#endregion
#region Runtime
/// <summary>
/// <p><em>Sets <see cref="DotNetBuildSettings.Runtime"/></em></p>
Expand Down
2 changes: 1 addition & 1 deletion source/Nuke.Common/Tools/DotNet/DotNet.json
Original file line number Diff line number Diff line change
Expand Up @@ -1249,4 +1249,4 @@
]
}
]
}
}
27 changes: 25 additions & 2 deletions source/Nuke.Common/Tools/MinVer/MinVer.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static partial class MinVerTasks
/// </summary>
public static string MinVerPath =>
ToolPathResolver.TryGetEnvironmentExecutable("MINVER_EXE") ??
ToolPathResolver.GetPackageExecutable("minver-cli", "minver-cli.dll");
GetToolPath();
public static Action<OutputType, string> MinVerLogger { get; set; } = ProcessTasks.DefaultLogger;
/// <summary>
/// <p>Minimalistic versioning using Git tags.</p>
Expand Down Expand Up @@ -116,14 +116,15 @@ public partial class MinVerSettings : ToolSettings
/// <summary>
/// Path to the MinVer executable.
/// </summary>
public override string ProcessToolPath => base.ProcessToolPath ?? MinVerTasks.MinVerPath;
public override string ProcessToolPath => base.ProcessToolPath ?? GetProcessToolPath();
public override Action<OutputType, string> ProcessCustomLogger => MinVerTasks.MinVerLogger;
public virtual MinVerVersionPart AutoIncrement { get; internal set; }
public virtual string BuildMetadata { get; internal set; }
public virtual string DefaultPreReleasePhase { get; internal set; }
public virtual string MinimumMajorMinor { get; internal set; }
public virtual string TagPrefix { get; internal set; }
public virtual MinVerVerbosity Verbosity { get; internal set; }
public virtual string Framework { get; internal set; }
protected override Arguments ConfigureProcessArguments(Arguments arguments)
{
arguments
Expand Down Expand Up @@ -298,6 +299,28 @@ public static T ResetVerbosity<T>(this T toolSettings) where T : MinVerSettings
return toolSettings;
}
#endregion
#region Framework
/// <summary>
/// <p><em>Sets <see cref="MinVerSettings.Framework"/></em></p>
/// </summary>
[Pure]
public static T SetFramework<T>(this T toolSettings, string framework) where T : MinVerSettings
{
toolSettings = toolSettings.NewInstance();
toolSettings.Framework = framework;
return toolSettings;
}
/// <summary>
/// <p><em>Resets <see cref="MinVerSettings.Framework"/></em></p>
/// </summary>
[Pure]
public static T ResetFramework<T>(this T toolSettings) where T : MinVerSettings
{
toolSettings = toolSettings.NewInstance();
toolSettings.Framework = null;
return toolSettings;
}
#endregion
}
#endregion
#region MinVerVerbosity
Expand Down
8 changes: 6 additions & 2 deletions source/Nuke.Common/Tools/MinVer/MinVer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"name": "MinVer",
"officialUrl": "https://github.com/adamralph/minver",
"help": "Minimalistic versioning using Git tags.",
"packageId": "minver-cli",
"packageExecutable": "minver-cli.dll",
"customExecutable": true,
"tasks": [
{
"returnType": "MinVer",
Expand Down Expand Up @@ -42,6 +41,11 @@
"name": "Verbosity",
"type": "MinVerVerbosity",
"format": "--verbosity {value}"
},
{
"name": "Framework",
"type": "string",
"noArgument": true
}
]
}
Expand Down
Loading

0 comments on commit 12a091b

Please sign in to comment.