Grapeyard.Labs.Nuke.Launchpad
0.2.0
See the version list below for details.
dotnet add package Grapeyard.Labs.Nuke.Launchpad --version 0.2.0
NuGet\Install-Package Grapeyard.Labs.Nuke.Launchpad -Version 0.2.0
<PackageReference Include="Grapeyard.Labs.Nuke.Launchpad" Version="0.2.0" />
paket add Grapeyard.Labs.Nuke.Launchpad --version 0.2.0
#r "nuget: Grapeyard.Labs.Nuke.Launchpad, 0.2.0"
// Install Grapeyard.Labs.Nuke.Launchpad as a Cake Addin #addin nuget:?package=Grapeyard.Labs.Nuke.Launchpad&version=0.2.0 // Install Grapeyard.Labs.Nuke.Launchpad as a Cake Tool #tool nuget:?package=Grapeyard.Labs.Nuke.Launchpad&version=0.2.0
NUKE Launchpad
Quickstart and extension library for the build automation tool NUKE for C# and .NET.
It contains common feature extensions as well as predefined build parameters and build targets in the form of configurable build component interfaces, that enable quick and easy realization of lightweight build processes.
Installation
After setting up a NUKE build project as described in the NUKE documentation, install NUKE Launchpad by adding this package to it as a NuGet dependency using a NuGet package manager or by adding it manually to its project file:
<ItemGroup>
<PackageReference Include="Grapeyard.Labs.Nuke.Launchpad" Version="0.2.0" />
</ItemGroup>
This will automatically install all packages that are part of NUKE Launchpad and their transitive dependencies.
If the installation fails with NuGet error NU1202, upgrade the target framework of the NUKE build project to a compatible version first – net7.0
or above – using its project properties or manually via its project file:
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
Usage
For the fundamentals of working with NUKE, read its documentation first.
When utilizing NUKE, the build process of a solution is defined using a NUKE build project. The project contains a central build class, usually located in a file Build.cs
, that inherits the NukeBuild
class and defines build parameters and build targets, which are individual steps of the build process. Both build parameters and build targets may either be defined directly in the central build class or in the form of build component interfaces to be implemented by it.
NUKE Launchpad contains predefined build parameters and build targets in the form of configurable build component interfaces, that enable quick and easy realization of lightweight build processes, by simply making the central build class implement them:
using System;
using Grapeyard.Labs.Nuke.Launchpad.Parameters;
using Grapeyard.Labs.Nuke.Launchpad.Targets.Clean;
using Grapeyard.Labs.Nuke.Launchpad.Targets.Compile;
using Grapeyard.Labs.Nuke.Launchpad.Targets.Pack;
using Grapeyard.Labs.Nuke.Launchpad.Targets.Restore;
using Grapeyard.Labs.Nuke.Launchpad.Targets.Test;
using Nuke.Common;
using Nuke.Common.Git;
using static Grapeyard.Labs.Nuke.Launchpad.Common.BuildConfiguration;
/// <summary>
/// Entry point of the NUKE build project.
/// </summary>
public class Build
: NukeBuild,
IHasGitRepository, // Parameter interface
ICleanForDotNet, // Target interfaces
IRestoreWithDotNet,
ICompileWithDotNet,
IUnitTestWithDotNet,
IPackWithDotNet
{
/// <inheritdoc/>
public string DefaultBuildConfiguration => Git.IsOnMainOrMasterBranch() ? Release : Debug;
/// <summary>
/// A representation of the local Git repository.
/// </summary>
/// <seealso cref="IHasGitRepository.GitRepository"/>
private GitRepository Git => ((IHasGitRepository) this).GitRepository;
/// <summary>
/// Invokes the build process and defines any number of default build targets.
/// </summary>
public static int Main()
{
return Execute<Build>(x => ((ITest) x).Test, x => ((IPack) x).Pack);
}
}
After modifying the central build class, the NUKE build project can be regenerated using the help command of NUKE, which also retrieves a list of available build parameters and build targets:
nuke --help
The parameter and target interfaces of NUKE Launchpad are documented extensively and should be self-explanatory. Check their code documentation before implementing them to be aware of potential quirks and configuration options.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- Grapeyard.Labs.Nuke.Launchpad.Common (>= 0.2.0)
- Grapeyard.Labs.Nuke.Launchpad.Parameters (>= 0.2.0)
- Grapeyard.Labs.Nuke.Launchpad.Targets (>= 0.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
• Added several string constants for .NET language properties, Semantic Versioning and the Keep a Changelog format to the Constants class.
• Added class BadgeProviderExtensions and moved all methods updating static badges from class BadgeProviderTasks to it to make them more concise to use. Additionally, optional Boolean logging parameters have been added to the methods, allowing to enable or disable logging of the utilized badge providers in the update process.
• Added enumeration class FileSystemItemType.
• Added method RequiresWhenOtherwise to the ITargetDefinitionExtensions class, that allows checking one of two build target requirements based on a Boolean condition.
• Added method ConvertAll to the IEnumerableExtensions class, that allows converting a generic enumerable of one type to an array of another type using a Converter.
• Added method JoinElementsToString and overloaded method JoinElementsToPrettyString to the IEnumerableExtensions class, that act as shortcuts to (pretty) print all elements of enumerables.
• Added method SecretVerified to the ObjectExtensions class, that verifies values annotated with the SecretAttribute of NUKE.
• Added overloaded method ToPrettyString to the ObjectExtensions and StringExtensions classes, that allows to pretty print objects of corresponding types.
• Added class CharExtensions with method IsAnyOf, that checks whether a character corresponds to any element of a character list, and overloaded method ToPrettyString, that allows to pretty print characters.
• Added method ReformatCodeExpressionToSingleLine to the StringExtensions class, that allows source code expressions spanning multiple lines to be reformatted into a single line.
• Added method ReplaceTabsWithSpaces to the StringExtensions class, that allows replacing horizontal and vertical tabs in strings with a given number of spaces.
• Added parameter interface IHasBadges that contains a build parameter for a badge register.
• Added methods FinalizeCustomItems, GetCustomLicenseModifications, GetCustomMainReadmeModifications and WereThirdPartyLicensesCustomModified to the IFinalizeVersion target base interface, that can be overridden to expand the repository finalization process.
• Added configuration property AutomatedReleaseNotes to the IPackWithDotNet target surrogate interface, that allows enabling or disabling automated package release notes.
• Added configuration property VerboseReportLogging to the IIntegrationTestWithDotNet and IUnitTestWithDotNet target surrogate interfaces, that allows verbose logging to be enabled for the generation of test reports at the end of the target run.
• Added methods CreateTestReportFromLogFilesWithCustomFormats and GetCustomTestTargets to the IUpdateStaticBadges target bundle interface, that can be overridden to expand the process of updating static test result badges.
• Added configuration property VerboseLogging to the IUpdateStaticBadgesInMainReadmeForBadgeProviders and IUpdateThirdPartyLicensesFromWebLinks target surrogate interfaces, that allows verbose logging to be enabled for the updates of static badges respectively third party licenses during the target run.
• Modified internals of the KeepAChangelogFormatTasks class, so that its methods also recognize logged changes that use the unordered list characters asterisk or plus instead of a hyphen.
• Improved most documentation comments and NUKE description texts.
• Overhauled the repository documentation with a focus on the operating manual.
• Removed unnecessary nullability modifiers from generic type parameters in the following methods:
◦ Methods ElementsNotNull, NotNull, NotNullOrEmpty and PropertyNotNull of the ExtendedAssert class.
◦ Methods RequiresForEach, RequiresMember and RequiresParameter of the ITargetDefinitionExtensions class.
◦ Method ElementsNotNull of the IEnumerableExtensions class.
• Renamed parameters of the following methods to be less generic and more type-related:
◦ All methods of the ExtendedAssert class that target integers or strings.
◦ Method UpdateLastPublicationYearOfCopyrightNotices of the LicensingTasks class.
◦ Methods AppendExceptionMessage, IsEmpty, IsValidFileName and IsWhiteSpace of the StringExtensions class.
• Added optional Boolean logging parameters to the following methods, so that key components of their execution and/or result can be logged:
◦ Method UpdateStaticBadge of the BadgeProvider class.
◦ Overloaded method CreateTestReportFromLogFilesInDirectory of the VisualStudioTestFormatTasks class.
• Changed visibility of class BadgeProviderTasks to internal.
• Modified overloaded method ExtractReleaseNotesForNuGet of the KeepAChangelogFormatTasks class to preserve indentation for logged changes and therefore nested lists in release notes intended for NuGet.
• Generalized the object type of the singular parameter of method InitializeFromRegex of the ThirdPartyWebLink class, making the method more universally usable.
• Renamed methods GetShortState and HasCleanState of the GitRepositoryExtensions class to GetStatusShort and HasCleanStatus to be closer to the names of the intended Git commands.
• Modified overloaded method DistinctBy of the ArrayExtensions class, so that it no longer throws an exception if an element of the array passed to it is null.
• Renamed method AsNonNullBuildParameter of the ObjectExtensions class to RequirementVerified to better reflect its use case of verifying values annotated with the RequiredAttribute of NUKE.
• Renamed method TrimAndPool of the ObjectExtensions class to PruneWhiteSpaces to better reflect its functionality, which has been shortened to the sole responsibility of pruning white-space characters from a string by eliminating the additional trimming.
• Renamed method ContainsAny of class StringExtensions to ContainsAnyOf. Additionally, renamed its parameters to be less generic and more type-related.
• Renamed parameter interface IHasLocalRepositories to IHasLocalPackageRepositories and its build parameter --local-repository-dirs to --local-package-repo-dirs.
• Renamed parameter interface IHasWebRepository to IHasWebPackageRepository and its build parameters --web-repository-source-url and --web-repository-api-key to --web-package-repo-source-url and --web-package-repo-api-key.
• Renamed configuration properties of the following target surrogate interfaces for clarity:
◦ Property LogFineGranular of the ICleanForDotNet interface to VerboseLogging.
◦ Property IncludeRepositoryLinks of the ICompileWithDotNet interface to AutomatedVcsProperties.
◦ Properties DraftSectionCaption and RepositoryEndpoint of the IFinalizeChangelogWithKeepAChangelogFormat interface to UnreleasedSectionCaption and VcsComparisonEndpoint.
◦ Properties PreparePublish and Version of the IFinishVersionForGrapeyardLabs interface to CheckOutIntoMasterBranch and TagName.
◦ Properties IncludeRepositoryLinks and RepositoryCommitIdentifier of the IPackWithDotNet interface to AutomatedVcsProperties and VcsCommitIdentifier.
◦ Property TestProjectSettings of the IIntegrationTestWithDotNet and IUnitTestWithDotNet interfaces to DotNetTestSettingsPerProject.
◦ Property LimitToFirstMatch of the IUpdateCopyrightYearsOfRepositoryLicenseToCurrent interface to LimitToFirstCopyrightNotice.
◦ Properties FileNamePrefix and FileNameSuffix of the IUpdateThirdPartyFrameworksFromWebLinks to LicenseFileNamePrefix and LicenseFileNameSuffix.
• Withdrew the nullability of configuration properties ReleaseVersion of the IFinalizeChangelogWithKeepAChangelogFormat target surrogate interface and Version of the IFinalizeVersionForGrapeyardLabs target surrogate interface.
• Renamed target base interface IPublishToLocalRepositories to IPublishToLocalPackageRepositories. Renamed the associated target surrogate interface and build targets accordingly.
• Renamed target base interface IPublishToWebRepositoy to IPublishToWebPackageRepository. Renamed the associated target surrogate interface and build targets accordingly.
• Changed the default value of configuration property CompleteOnFailure of the IPublishToWebPackageRepositoryWithDotNet target surrogate interface to false.
• Renamed target bundle interface IUpdateReadmeBadges to IUpdateStaticBadges. Renamed the associated build target accordingly.
• Renamed target base interface IUpdateStaticReadmeBadges to IUpdateStaticBadgesInMainReadme. Renamed the associated target surrogate interface and build targets accordingly.
• Renamed target bundle interface IUpdateProjectLicense to IUpdateCopyrightYearsOfLicenses. Renamed the associated build target accordingly.
• Renamed target base interface IUpdateCopyrightYearOfProjectLicense to IUpdateCopyrightYearsOfRepositoryLicense. Renamed the associated target surrogate interface and build targets accordingly.
• Updated NuGet package Nuke.Common from version 7.0.5 to 7.0.6.
• Removed the unnecessary class NetworkTasks.
• Fixed a bug where the overloaded method ExtractReleaseNotesForNuGet of the KeepAChangelogFormatTasks class did not replace quotation marks in release notes intended for NuGet with their ASCII counterparts, resulting in them not appearing in the "Release Notes" section of the central NuGet repository.
• Fixed some pre-generated internal regular expressions in the Constants class that matched unintended characters.
• Fixed a bug in methods OnlyWhenAllDynamic and OnlyWhenExactlyDynamic of the ITargetDefinitionExtensions class that resulted in the log output of a finished NUKE build process missing the reason why a build target was actually skipped.
• Fixed a bug in the ITargetDefinitionExtensions class that caused code expressions used for exception messages to contain unwanted white-space characters near reformatted line breaks.
• Fixed a bug in method UpdateStaticBadges of the BadgenTasks and ShieldTasks classes that caused tooltips to be deleted from Markdown images of static badges.
Full changelog at https://gitlab.com/grapeyard-labs/libs/nuke-launchpad/-/blob/0.2.0/CHANGELOG.md