From fdb5b058f832f7fa0d55cec4e36a5b4f7dd09e34 Mon Sep 17 00:00:00 2001
From: Matthias Koch
Date: Thu, 18 Jan 2024 11:30:08 +0100
Subject: [PATCH 01/56] fix(components): fallback to GitHub Actions
---
source/Nuke.Components/ICreateGitHubRelease.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source/Nuke.Components/ICreateGitHubRelease.cs b/source/Nuke.Components/ICreateGitHubRelease.cs
index 5057b045f..0a57bc72e 100644
--- a/source/Nuke.Components/ICreateGitHubRelease.cs
+++ b/source/Nuke.Components/ICreateGitHubRelease.cs
@@ -24,7 +24,7 @@ public interface ICreateGitHubRelease : IHazGitRepository, IHazChangelog
{
public const string GitHubRelease = nameof(GitHubRelease);
- [Parameter] [Secret] string GitHubToken => TryGetValue(() => GitHubToken) ?? GitHubActions.Instance.Token;
+ [Parameter] [Secret] string GitHubToken => TryGetValue(() => GitHubToken) ?? GitHubActions.Instance?.Token;
string Name { get; }
bool Prerelease => false;
From 37f14582d8ae3270adac6ebaad73f06e68a1980b Mon Sep 17 00:00:00 2001
From: Matthias Koch
Date: Thu, 18 Jan 2024 11:29:35 +0100
Subject: [PATCH 02/56] chore: update secrets
---
appveyor.yml | 6 +++---
build/Build.CI.AppVeyor.cs | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/appveyor.yml b/appveyor.yml
index 3e2a0fb73..decd911ec 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -35,9 +35,9 @@ artifacts:
environment:
PublicNuGetApiKey:
- secure: dSaquYHVNEAZO+hhGGoGqeHaVP99BP8koHTTqcD3WInWBTmB7yE4CzxZ1pWypnX2
+ secure: AzhHrKZGYyWnvMtPg06Q7PMJPp47dl5NxAHaE9ZB9tjIWVqmySx3F26YtVhRSPGa
GitHubReleaseGitHubToken:
- secure: a5UfxXiDEere9GkCCN9TUZMUdyzjC01cvHthbMLtSl0w+/giDwOyApiHRRRrwyKL5yd/vjD6xDBTBj+W/ZxKzMtzC+gDCSTNO8bSJG9Rh2n9eGzLtWzEFDw/zDYZXe5N
+ secure: a5UfxXiDEere9GkCCN9TURaC8CmN/ZaqWIeoHbHNshmXWLedwrEAdwGNzPf3dusKEykOMB7T/fIorZHPIqSRuuR3JsMya/3zPrvozT5o1A5qf6LpNAtWpdB20+3rvupZ
SignPathApiToken:
secure: uQTH2MxpqiqWTy7EJkjtNc43ipG17EUOQN99QsODRNgtNEcikDaP0t4ylekK/ibn
TwitterConsumerKey:
@@ -49,7 +49,7 @@ environment:
TwitterAccessTokenSecret:
secure: /RrBl2p46rlgpzBHweWeD0spt3JNZDsM8vABoI9Ao29+Z9D4rUYvpM5oHUWA8Lb6
SlackWebhook:
- secure: xENxLITTR28hBLEY51YWMeHhxkhg1h1tLY1zGre1/hmM/XDRPsJCxvZvTHFhtfLsQ3cF7GQi3xDaShkVVR7zoXHsIYT+KT0zLnq9FSEvr5c=
+ secure: xENxLITTR28hBLEY51YWMeHhxkhg1h1tLY1zGre1/hl7LyoC3HT+0Ft9rXAZBoUij6kag6PsFaF+7siaJIG7EFgnyXe9uK3sstrgKNl1bk0=
DiscordWebhook:
secure: K5WG8m71vcB56C75b0ErFPLYTsqywhPy8hSn49uqc5XBE7txUnZqWBHfbWCuU9AdFkm3TNgSYLoejjF59OgiACEn45fghVe7XCwAXo2l54ZXl08MZyBkJ8by9HsZirL9W+SeysNdw/Cfc0sxKrWcpDkn1IH2zZ+iXAgqBsW2CNY=
MastodonAccessToken:
diff --git a/build/Build.CI.AppVeyor.cs b/build/Build.CI.AppVeyor.cs
index 51dd13e13..1c3099eda 100644
--- a/build/Build.CI.AppVeyor.cs
+++ b/build/Build.CI.AppVeyor.cs
@@ -34,14 +34,14 @@
SkipTags = true,
InvokedTargets = new[] { nameof(ITest.Test), nameof(IPack.Pack) },
Secrets = new string[0])]
-[AppVeyorSecret(nameof(PublicNuGetApiKey), "dSaquYHVNEAZO+hhGGoGqeHaVP99BP8koHTTqcD3WInWBTmB7yE4CzxZ1pWypnX2")]
-[AppVeyorSecret(ICreateGitHubRelease.GitHubRelease + nameof(ICreateGitHubRelease.GitHubToken), "a5UfxXiDEere9GkCCN9TUZMUdyzjC01cvHthbMLtSl0w+/giDwOyApiHRRRrwyKL5yd/vjD6xDBTBj+W/ZxKzMtzC+gDCSTNO8bSJG9Rh2n9eGzLtWzEFDw/zDYZXe5N")]
+[AppVeyorSecret(nameof(PublicNuGetApiKey), "AzhHrKZGYyWnvMtPg06Q7PMJPp47dl5NxAHaE9ZB9tjIWVqmySx3F26YtVhRSPGa")]
+[AppVeyorSecret(ICreateGitHubRelease.GitHubRelease + nameof(ICreateGitHubRelease.GitHubToken), "a5UfxXiDEere9GkCCN9TURaC8CmN/ZaqWIeoHbHNshmXWLedwrEAdwGNzPf3dusKEykOMB7T/fIorZHPIqSRuuR3JsMya/3zPrvozT5o1A5qf6LpNAtWpdB20+3rvupZ")]
[AppVeyorSecret(ISignPackages.SignPath + nameof(ISignPackages.ApiToken), "uQTH2MxpqiqWTy7EJkjtNc43ipG17EUOQN99QsODRNgtNEcikDaP0t4ylekK/ibn")]
[AppVeyorSecret(IHazTwitterCredentials.Twitter + nameof(IHazTwitterCredentials.ConsumerKey), "T61zL4r+xtyj7b0aOGYCsyixrXHooXE759T8z3M67Lw=")]
[AppVeyorSecret(IHazTwitterCredentials.Twitter + nameof(IHazTwitterCredentials.ConsumerSecret), "CZwdlO4PHT51Xr0Pe/mT6WpfBzQXsL0C3yWfHgXqdYrf22rx8ePEt5qpszWckbHE5Vh5ErtVfIAQgLeFrqe2Gg==")]
[AppVeyorSecret(IHazTwitterCredentials.Twitter + nameof(IHazTwitterCredentials.AccessToken), "nnv1h5nkNm4MS50soQHiYZk9hnPkWEMQP/5cdf6RJfDIL1gUYxLR7uBaAi1M4sswT0TQ7oL4TBIN/yziq33N5A==")]
[AppVeyorSecret(IHazTwitterCredentials.Twitter + nameof(IHazTwitterCredentials.AccessTokenSecret), "/RrBl2p46rlgpzBHweWeD0spt3JNZDsM8vABoI9Ao29+Z9D4rUYvpM5oHUWA8Lb6")]
-[AppVeyorSecret(nameof(SlackWebhook), "xENxLITTR28hBLEY51YWMeHhxkhg1h1tLY1zGre1/hmM/XDRPsJCxvZvTHFhtfLsQ3cF7GQi3xDaShkVVR7zoXHsIYT+KT0zLnq9FSEvr5c=")]
+[AppVeyorSecret(nameof(SlackWebhook), "xENxLITTR28hBLEY51YWMeHhxkhg1h1tLY1zGre1/hl7LyoC3HT+0Ft9rXAZBoUij6kag6PsFaF+7siaJIG7EFgnyXe9uK3sstrgKNl1bk0=")]
[AppVeyorSecret(nameof(DiscordWebhook), "K5WG8m71vcB56C75b0ErFPLYTsqywhPy8hSn49uqc5XBE7txUnZqWBHfbWCuU9AdFkm3TNgSYLoejjF59OgiACEn45fghVe7XCwAXo2l54ZXl08MZyBkJ8by9HsZirL9W+SeysNdw/Cfc0sxKrWcpDkn1IH2zZ+iXAgqBsW2CNY=")]
[AppVeyorSecret(nameof(MastodonAccessToken), "pD/C1TvhUnFtb0oLUvlf2NtjkWeZQcrUVvYJE/LgZb8nxagK8Lwk+OR7TUqOh+Nn")]
partial class Build
From 78bb364409bb657c79c4e0b817b44b0c0ccb2cd4 Mon Sep 17 00:00:00 2001
From: Matthias Koch
Date: Mon, 22 Jan 2024 13:11:11 +0100
Subject: [PATCH 03/56] chore: update download links
---
docs/07-ide/visual-studio.md | 2 +-
docs/07-ide/vscode.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/07-ide/visual-studio.md b/docs/07-ide/visual-studio.md
index 7eae418f5..7842ffea3 100644
--- a/docs/07-ide/visual-studio.md
+++ b/docs/07-ide/visual-studio.md
@@ -5,7 +5,7 @@ title: Visual Studio
import DownloadButton from '@site/src/components/DownloadButton';
In [Visual Studio](https://visualstudio.microsoft.com/) you can install the _NUKE Support extension_ to be more productive in writing, running, and debugging your builds.
diff --git a/docs/07-ide/vscode.md b/docs/07-ide/vscode.md
index bb3ea2b8e..c5a794e47 100644
--- a/docs/07-ide/vscode.md
+++ b/docs/07-ide/vscode.md
@@ -6,7 +6,7 @@ import DownloadButton from '@site/src/components/DownloadButton';
import ControlKey from '@site/src/components/ControlKey';
In [Visual Studio Code](https://code.visualstudio.com/) you can install the _NUKE Support extension_ to be more productive in writing, running, and debugging your builds.
From da755bf40a88085a053f424b31ff4751c15d73a3 Mon Sep 17 00:00:00 2001
From: Matthias Koch
Date: Sat, 27 Jan 2024 05:05:52 +0100
Subject: [PATCH 04/56] docs: remove download events
---
docs/07-ide/resharper.md | 4 +---
docs/07-ide/rider.md | 4 +---
docs/07-ide/visual-studio.md | 4 +---
docs/07-ide/vscode.md | 4 +---
4 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/docs/07-ide/resharper.md b/docs/07-ide/resharper.md
index 4818f0c70..98280d11e 100644
--- a/docs/07-ide/resharper.md
+++ b/docs/07-ide/resharper.md
@@ -4,9 +4,7 @@ title: ReSharper
import DownloadButton from '@site/src/components/DownloadButton';
-
+
In [ReSharper](https://www.jetbrains.com/resharper) you can install the _NUKE Support extension_ to be more productive in writing, running, and debugging your builds.
diff --git a/docs/07-ide/rider.md b/docs/07-ide/rider.md
index 247dc80aa..7c38a4eb1 100644
--- a/docs/07-ide/rider.md
+++ b/docs/07-ide/rider.md
@@ -5,9 +5,7 @@ sidebar_position: 1
import DownloadButton from '@site/src/components/DownloadButton';
-
+
In [JetBrains Rider](https://www.jetbrains.com/rider) you can install the _NUKE Support plugin_ to be more productive in writing, running, and debugging your builds.
diff --git a/docs/07-ide/visual-studio.md b/docs/07-ide/visual-studio.md
index 7842ffea3..c0afa572d 100644
--- a/docs/07-ide/visual-studio.md
+++ b/docs/07-ide/visual-studio.md
@@ -4,9 +4,7 @@ title: Visual Studio
import DownloadButton from '@site/src/components/DownloadButton';
-
+
In [Visual Studio](https://visualstudio.microsoft.com/) you can install the _NUKE Support extension_ to be more productive in writing, running, and debugging your builds.
diff --git a/docs/07-ide/vscode.md b/docs/07-ide/vscode.md
index c5a794e47..f894096e3 100644
--- a/docs/07-ide/vscode.md
+++ b/docs/07-ide/vscode.md
@@ -5,9 +5,7 @@ title: Visual Studio Code
import DownloadButton from '@site/src/components/DownloadButton';
import ControlKey from '@site/src/components/ControlKey';
-
+
In [Visual Studio Code](https://code.visualstudio.com/) you can install the _NUKE Support extension_ to be more productive in writing, running, and debugging your builds.
From 92cc2a0d6986ea67621a13c7de9a37805af834a4 Mon Sep 17 00:00:00 2001
From: Matthias Koch
Date: Sat, 3 Feb 2024 01:09:45 +0100
Subject: [PATCH 05/56] chore: update CONTRIBUTING.md
---
CONTRIBUTING.md | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 32d893388..561e2cc95 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -4,7 +4,7 @@ As a community, we want to help each other, provide constructive feedback, and m
## Consumer Expectations
-NUKE is a personal project that was made open-source to let the whole community benefit from it **free of charge** but also ["as is"](https://github.com/nuke-build/nuke/blob/develop/LICENSE). Like a lot of open-source projects, it is primarily maintained and developed by a [single person](https://github.com/matkoch). Some of the **most time-consuming tasks** around the project are:
+NUKE is a personal project that was made open-source to let the whole community benefit from it **free of charge** but also ["as is"](https://github.com/nuke-build/nuke/blob/develop/LICENSE). Like many open-source projects, it is primarily maintained and developed by a [single person](https://github.com/matkoch). Some of the **most time-consuming tasks** around the project are:
- Development of the NuGet package itself (C#, .NET, MSBuild)
- Collecting CLI metadata (.NET ClI, MSBuild, Docker, +30 others)
@@ -14,32 +14,31 @@ NUKE is a personal project that was made open-source to let the whole community
- Hosting (Azure, Cloudflare, Algolia, Fathom)
- Documentation, presentation slides, and blog posts
- Helping in GitHub issues/discussions, Slack, and Discord
-- Talking at conferences and meetups including travel
+- Talking at conferences and meetups, including travel
- Promotion on Twitter and Mastodon
-This list should give you an impression of what it took to make NUKE what it is today and what it continuously takes to move it forward. Obviously though, there's only a limited amount of time a single person can dedicate besides their personal life and real job [without burning out](https://www.jeffgeerling.com/blog/2022/burden-open-source-maintainer).
+This list should give you an impression of what it took to make NUKE what it is today and what it continuously takes to move it forward. Obviously, though, there's only a limited amount of time a single person can dedicate besides their personal life and real job [without burning out](https://www.jeffgeerling.com/blog/2022/burden-open-source-maintainer).
-Therefore, **everything that benefits a larger audience is prioritized** over digging into issues that only affect a single or few individuals. Please don't take offense when your issue or pull-request is not getting the attention you were hoping for. It is simply a time management decision.
+Therefore, **everything that benefits a larger audience is prioritized** over digging into issues that only affect a single or few individuals. Please don't take offense when your issue or pull request is not getting the attention you were hoping for. It is simply a time management decision.
## Baseline Contributions
-There are a number of minimal to zero efforts you can make to show your support for the project:
+There are several minimal to zero efforts you can make to show your support for the project:
- Give the [GitHub project](https://github.com/nuke-build/nuke/stargazers) a star (and tell your team)
- Follow [@nukebuildnet](https://twitter.com/nukebuildnet) and [@nuke@dotnet.social](https://dotnet.social/@nuke)
-- Upvote, share, and comment our content (see [#mentions](https://app.slack.com/client/T9QUKHC4A/CDJD8CGQ5) on Slack)
+- Upvote, share and comment on our content (see [#mentions](https://app.slack.com/client/T9QUKHC4A/CDJD8CGQ5) on Slack)
- Talk about NUKE on social media and let others know where it can help (tag us!)
The above points are considered somewhat of the norm in exchange for using the project free of charge.
## Sustainability Contributions
-There are plenty of ways to show your commitment to the project and strengthen its longevity. These are typically tied to contributing time or money, but also allow for prioritizing your individual issues in return:
+There are plenty of ways to show your commitment to the project and strengthen its longevity. These are typically tied to contributing time or money but also allow for prioritizing your own issues in return:
- [Convince your company to sponsor](https://humanwhocodes.com/blog/2021/05/talk-to-your-company-sponsoring-open-source/)
- Sponsor personally (e.g., when the project improves your work performance reviews)
-- Fix or investigate issues that are marked as [`good first issue`](https://github.com/nuke-build/nuke/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
-- Take ownership for a tool wrapper or CI/CD service (.NET CLI, GitHub Actions, ...)
+- Take ownership of a tool wrapper or CI/CD service (.NET CLI, GitHub Actions, etc.)
- Write a blog post or give a meetup talk (let us know!)
- Help others in GitHub issues/discussions or on Slack and Discord
@@ -54,14 +53,14 @@ Evaluate whether your topic is going to be a valid issue:
- Have you read and searched the [documentation](https://nuke.build/docs/introduction/)?
- Have you checked the [FAQ](https://nuke.build/faq/)?
- Is your issue more of a question? Ask on [GitHub discussions](https://github.com/nuke-build/nuke/discussions), [Slack](https://nuke.build/slack), or [Discord](https://nuke.build/discord)!
-- Have you checked existing/closed issues? Maybe your version is behind?
-- Did you verify it's not an external tool issue? Invoke the command manually!
-- Don't file issues for tool wrappers. Send a pull-request instead!
+- Have you checked existing/closed issues? Is your version behind?
+- Have you verified it's not an external tool issue? Invoke the command manually!
+- Don't file issues for tool wrappers. Send a pull request instead!
- Refrain from debating the governance or state of the project out of your own interests (see [consumer expectations](#consumer-expectations) & [sustainability contributions](#sustainability-contributions))
### When creating an issue
-Choose one of the [issue templates](https://github.com/nuke-build/nuke/issues/new/choose) and fill it out as good as possible. This includes, but is not limited to:
+Choose one of the [issue templates](https://github.com/nuke-build/nuke/issues/new/choose) and fill it out as well as possible. This includes, but is not limited to:
- State the issue as short as possible (more likely there's time to comprehend it)
- Use [markdown](https://docs.github.com/en/get-started/writing-on-github) for code, logs, and other special text fragments
@@ -74,12 +73,12 @@ Choose one of the [issue templates](https://github.com/nuke-build/nuke/issues/ne
Once the `triage` label is removed from your issue, you will know how it is seen from the project's perspective:
-- Issues labelled as `area:cicd` or `area:tools` usually can be fixed in user code
+- Issues labeled as `area:cicd` or `area:tools` usually can be fixed in user code
- [Custom arguments](https://nuke.build/docs/common/cli-tools/#custom-arguments) can be wrapped in local extension methods
- Additional steps in CI/CD configuration generation can be added through inheritance
-- If your issue is labelled as `good first issue`, consider sending a pull-request
+- If your issue is labeled as `good first issue`, consider sending a pull-request
-Depending on the priority, available time, and your personal commitment to the project, the issue will be addressed sooner or later. In (hopefully) rare cases, it might also be closed due to missing resources.
+The issue will be addressed sooner or later depending on the priority, available time, and your commitment to the project. In rare cases, it might also be closed due to missing resources.
## Pull-Requests
@@ -96,9 +95,9 @@ In your own interest of getting a pull-request merged (timely):
- Aim for qualitative and readable code
- Follow the coding style of the existing codebase
-- Make sure the project builds and all tests pass
+- Make sure the project builds, and all tests pass
- Don't copy/paste chunks of code, even when it's meant as a draft
-- Drafting APIs is okay, as long as you're ready to finish it later
+- Drafting APIs is okay as long as you're ready to finish it later
- Add tests when meaningful, particularly when there is a related test class already
### When creating a pull-request
@@ -118,7 +117,8 @@ For tool wrappers (e.g. [.NET CLI](https://github.com/nuke-build/nuke/blob/devel
- `` in between paragraphs (as opposed to `
...
`)
- Don't explicitly define `secret: false` (it's the default)
- Don't provide `default: xxx` (it's obsolete)
-- Don't generate the code; it will be done manually once per release
+- Test your changes by calling the `GenerateTools` target
+- Don't commit generated code; it will be done manually once per release
### After creating a pull-request
From 6fe1e3b72dd9550032daedae5edcbdb3c0291f9c Mon Sep 17 00:00:00 2001
From: Matthias Koch
Date: Wed, 21 Feb 2024 17:05:32 +0100
Subject: [PATCH 06/56] feat(utilities): add extensions
---
.../Collections/Enumerable.ToEmptyIfNull.cs | 25 +++++++++++++++++++
.../Nuke.Utilities/Text/String.Emptiness.cs | 22 +++++++++++++++-
source/Nuke.Utilities/Text/String.Split.cs | 13 ++++++++--
.../Text/String.StartsEndsContains.cs | 9 +++++++
4 files changed, 66 insertions(+), 3 deletions(-)
create mode 100644 source/Nuke.Utilities/Collections/Enumerable.ToEmptyIfNull.cs
diff --git a/source/Nuke.Utilities/Collections/Enumerable.ToEmptyIfNull.cs b/source/Nuke.Utilities/Collections/Enumerable.ToEmptyIfNull.cs
new file mode 100644
index 000000000..131d204a0
--- /dev/null
+++ b/source/Nuke.Utilities/Collections/Enumerable.ToEmptyIfNull.cs
@@ -0,0 +1,25 @@
+// Copyright 2024 Maintainers of NUKE.
+// Distributed under the MIT License.
+// https://github.com/nuke-build/nuke/blob/master/LICENSE
+
+using System.Collections.Generic;
+
+namespace Nuke.Common.Utilities.Collections;
+
+public static partial class EnumerableExtensions
+{
+ public static IEnumerable ToEmptyIfNull(this IEnumerable enumerable)
+ {
+ return enumerable ?? [];
+ }
+
+ public static T[] ToEmptyIfNull(this T[] array)
+ {
+ return array ?? [];
+ }
+
+ public static IList ToEmptyIfNull(this IList list)
+ {
+ return list ?? [];
+ }
+}
diff --git a/source/Nuke.Utilities/Text/String.Emptiness.cs b/source/Nuke.Utilities/Text/String.Emptiness.cs
index d25cfca3c..f48cfe61c 100644
--- a/source/Nuke.Utilities/Text/String.Emptiness.cs
+++ b/source/Nuke.Utilities/Text/String.Emptiness.cs
@@ -19,7 +19,7 @@ public static bool IsNullOrEmpty(this string str)
}
///
- /// Indicates whether a specified string is null, empty, or consists only of white-space characters.
+ /// Indicates whether a specified string is null, empty, or only white-space.
///
[Pure]
[ContractAnnotation("null => halt")]
@@ -27,4 +27,24 @@ public static bool IsNullOrWhiteSpace(this string str)
{
return string.IsNullOrWhiteSpace(str);
}
+
+ ///
+ /// Returns null if the specified string is empty.
+ ///
+ [Pure]
+ [ContractAnnotation("null => null")]
+ public static string ToNullIfEmpty(this string str)
+ {
+ return str.IsNullOrEmpty() ? null : str;
+ }
+
+ ///
+ /// Returns null if the specified string is empty or only white-space.
+ ///
+ [Pure]
+ [ContractAnnotation("null => null")]
+ public static string ToNullIfWhiteSpace(this string str)
+ {
+ return str.IsNullOrWhiteSpace() ? null : str;
+ }
}
diff --git a/source/Nuke.Utilities/Text/String.Split.cs b/source/Nuke.Utilities/Text/String.Split.cs
index 602e64121..3c1f72758 100644
--- a/source/Nuke.Utilities/Text/String.Split.cs
+++ b/source/Nuke.Utilities/Text/String.Split.cs
@@ -64,9 +64,18 @@ public static IEnumerable SplitCamelHumps(this string str, params string
/// Splits a given string by new-lines with empty entries preserved.
///
[Pure]
- public static string[] SplitLineBreaks(this string str)
+ public static string[] SplitLineBreaks(this string str, StringSplitOptions options = StringSplitOptions.None)
{
- return str.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None);
+ return str.Split(new[] { "\r\n", "\n" }, options);
+ }
+
+ ///
+ /// Splits a given string by paragraphs (double new-line) with empty entries preserved.
+ ///
+ [Pure]
+ public static string[] SplitParagraphs(this string str, StringSplitOptions options = StringSplitOptions.None)
+ {
+ return str.Split(new[] { "\r\n\r\n", "\n\n" }, options);
}
///
diff --git a/source/Nuke.Utilities/Text/String.StartsEndsContains.cs b/source/Nuke.Utilities/Text/String.StartsEndsContains.cs
index 31f2799f0..495fb676d 100644
--- a/source/Nuke.Utilities/Text/String.StartsEndsContains.cs
+++ b/source/Nuke.Utilities/Text/String.StartsEndsContains.cs
@@ -20,6 +20,15 @@ public static bool ContainsOrdinalIgnoreCase(this string str, string other)
return str.IndexOf(other, StringComparison.OrdinalIgnoreCase) >= 0;
}
+ ///
+ /// Indicates whether a collection of strings contains any other string under comparison.
+ ///
+ [Pure]
+ public static bool ContainsAnyOrdinalIgnoreCase(this IEnumerable str, params string[] others)
+ {
+ return others.Any(x => str.Contains(x, StringComparer.OrdinalIgnoreCase));
+ }
+
///
/// Indicates whether a string equals another string under comparison.
///
From 425c9f24ca36d0276a53cb596959e092a7e93028 Mon Sep 17 00:00:00 2001
From: Nefarion
Date: Wed, 20 Mar 2024 02:27:54 +0100
Subject: [PATCH 07/56] feat(cicd): update GitLab for v16.10 (#1341)
---
source/Nuke.Common/CI/GitLab/GitLab.cs | 765 +++++++++++++++++++++++--
1 file changed, 733 insertions(+), 32 deletions(-)
diff --git a/source/Nuke.Common/CI/GitLab/GitLab.cs b/source/Nuke.Common/CI/GitLab/GitLab.cs
index 94cb1d888..c8b6aae22 100644
--- a/source/Nuke.Common/CI/GitLab/GitLab.cs
+++ b/source/Nuke.Common/CI/GitLab/GitLab.cs
@@ -1,4 +1,4 @@
-// Copyright 2023 Maintainers of NUKE.
+// Copyright 2024 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
@@ -61,7 +61,7 @@ private string GetSectionId(string text)
}
///
- /// Mark that job is executed in CI environment.
+ /// Available for all jobs executed in CI/CD. true when available.
///
public bool Ci => EnvironmentInfo.GetVariable("CI");
@@ -71,7 +71,9 @@ private string GetSectionId(string text)
public string CommitRefName => EnvironmentInfo.GetVariable("CI_COMMIT_REF_NAME");
///
- /// $CI_COMMIT_REF_NAME lowercased, shortened to 63 bytes, and with everything except 0-9 and a-z replaced with -. No leading / trailing -. Use in URLs, host names and domain names.
+ /// $CI_COMMIT_REF_NAME lowercased, shortened to 63 bytes, and with everything except 0-9 and a-z replaced with -.
+ /// No leading / trailing -.
+ /// Use in URLs, host names and domain names.
///
public string CommitRefSlug => EnvironmentInfo.GetVariable("CI_COMMIT_REF_SLUG");
@@ -81,27 +83,32 @@ private string GetSectionId(string text)
public string CommitSha => EnvironmentInfo.GetVariable("CI_COMMIT_SHA");
///
- /// The commit tag name. Present only when building tags.
+ /// The commit tag name.
+ /// Available only in pipelines for tags.
///
[CanBeNull] public string CommitTag => EnvironmentInfo.GetVariable("CI_COMMIT_TAG");
///
- /// The path to CI config file. Defaults to .gitlab-ci.yml.
+ /// The path to the CI/CD configuration file.
+ /// Defaults to .gitlab-ci.yml.
+ /// Read-only inside a running pipeline.
///
public string ConfigPath => EnvironmentInfo.GetVariable("CI_CONFIG_PATH");
///
- /// Marks that the job is executed in a disposable environment (something that is created only for this job and disposed of/destroyed after the execution - all executors except shell and ssh). If the environment is disposable, it is set to true, otherwise it is not defined at all.
+ /// Only available if the job is executed in a disposable environment (something that is created only for this job and disposed of/destroyed after the execution - all executors except shell and ssh).
+ /// true when available.
///
public bool DisposableEnvironment => EnvironmentInfo.GetVariable("CI_DISPOSABLE_ENVIRONMENT");
///
- /// The unique id of the current job that GitLab CI uses internally.
+ /// The internal ID of the job, unique across all jobs in the GitLab instance.
///
public long JobId => EnvironmentInfo.GetVariable("CI_JOB_ID");
///
- /// The flag to indicate that job was manually started.
+ /// Only available if the job was started manually.
+ /// true when available.
///
public bool JobManual => EnvironmentInfo.GetVariable("CI_JOB_MANUAL");
@@ -116,32 +123,34 @@ private string GetSectionId(string text)
public string JobStage => EnvironmentInfo.GetVariable("CI_JOB_STAGE");
///
- /// Token used for authenticating with the GitLab Container Registry.
+ /// A token to authenticate with certain API endpoints.
+ /// The token is valid as long as the job is running.
///
public string JobToken => EnvironmentInfo.GetVariable("CI_JOB_TOKEN");
///
- /// The URL to clone the Git repository.
+ /// The full path to Git clone (HTTP) the repository with a CI/CD job token, in the format https://gitlab-ci-token:$CI_JOB_TOKEN@gitlab.example.com/my-group/my-project.git.
///
public string RepositoryUrl => EnvironmentInfo.GetVariable("CI_REPOSITORY_URL");
///
- /// The description of the runner as saved in GitLab.
+ /// The description of the runner.
///
public string RunnerDescription => EnvironmentInfo.GetVariable("CI_RUNNER_DESCRIPTION");
///
- /// The unique id of runner being used.
+ /// The unique ID of the runner being used.
///
public long RunnerId => EnvironmentInfo.GetVariable("CI_RUNNER_ID");
///
- /// The defined runner tags.
+ /// A comma-separated list of the runner tags.
///
public string RunnerTags => EnvironmentInfo.GetVariable("CI_RUNNER_TAGS");
///
- /// The unique id of the current pipeline that GitLab CI uses internally.
+ /// The instance-level ID of the current pipeline.
+ /// This ID is unique across all projects on the GitLab instance.
///
public long PipelineId => EnvironmentInfo.GetVariable("CI_PIPELINE_ID");
@@ -151,7 +160,9 @@ private string GetSectionId(string text)
public bool PipelineTriggered => EnvironmentInfo.GetVariable("CI_PIPELINE_TRIGGERED");
///
- /// The source for this pipeline, one of: push, web, trigger, schedule, api, external. Pipelines created before 9.5 will have unknown as source.
+ /// How the pipeline was triggered.
+ /// Can be push, web, schedule, api, external, chat, webide, merge_request_event, external_pull_request_event, parent_pipeline, trigger, or pipeline.
+ /// For a description of each value, see Common if clauses for rules, which uses this variable to control when jobs run.
///
public string PipelineSource => EnvironmentInfo.GetVariable("CI_PIPELINE_SOURCE");
@@ -161,87 +172,103 @@ private string GetSectionId(string text)
public string ProjectDirectory => EnvironmentInfo.GetVariable("CI_PROJECT_DIR");
///
- /// The unique id of the current project that GitLab CI uses internally.
+ /// The ID of the current project.
+ /// This ID is unique across all projects on the GitLab instance.
///
public long ProjectId => EnvironmentInfo.GetVariable("CI_PROJECT_ID");
///
- /// The project name that is currently being built (actually it is project folder name).
+ /// The name of the directory for the project.
+ /// For example if the project URL is gitlab.example.com/group-name/project-1, $CI_PROJECT_NAME is project-1.
///
public string ProjectName => EnvironmentInfo.GetVariable("CI_PROJECT_NAME");
///
- /// The project namespace (username or groupname) that is currently being built.
+ /// The project namespace (username or group name) of the job.
///
public string ProjectNamespace => EnvironmentInfo.GetVariable("CI_PROJECT_NAMESPACE");
///
- /// The namespace with project name.
+ /// The project namespace with the project name included.
///
public string ProjectPath => EnvironmentInfo.GetVariable("CI_PROJECT_PATH");
///
- /// $CI_PROJECT_PATH lowercased and with everything except 0-9 and a-z replaced with -. Use in URLs and domain names.
+ /// $CI_PROJECT_PATH in lowercase with characters that are not a-z or 0-9 replaced with - and shortened to 63 bytes.
+ /// Use in URLs and domain names.
///
public string ProjectPathSlug => EnvironmentInfo.GetVariable("CI_PROJECT_PATH_SLUG");
///
- /// The HTTP address to access project.
+ /// The HTTP(S) address of the project.
///
public string ProjectUrl => EnvironmentInfo.GetVariable("CI_PROJECT_URL");
///
- /// The project visibility (internal, private, public).
+ /// The project visibility.
+ /// Can be internal, private, or public.
///
public GitLabProjectVisibility ProjectVisibility => EnvironmentInfo.GetVariable("CI_PROJECT_VISIBILITY");
///
- /// If the Container Registry is enabled it returns the address of GitLab's Container Registry.
+ /// Address of the container registry server, formatted as <host>[:<port>].
+ /// For example: registry.gitlab.example.com.
+ /// Only available if the container registry is enabled for the GitLab instance.
///
public string Registry => EnvironmentInfo.GetVariable("CI_REGISTRY");
///
- /// If the Container Registry is enabled for the project it returns the address of the registry tied to the specific project.
+ /// Base address for the container registry to push, pull, or tag project's images, formatted as <host>[:<port>]/<project_full_path>.
+ /// For example: registry.gitlab.example.com/my_group/my_project.
+ /// Image names must follow the container registry naming convention.
+ /// Only available if the container registry is enabled for the project.
///
public string RegistryImage => EnvironmentInfo.GetVariable("CI_REGISTRY_IMAGE");
///
- /// The password to use to push containers to the GitLab Container Registry.
+ /// The password to push containers to the GitLab project's container registry.
+ /// Only available if the container registry is enabled for the project.
+ /// This password value is the same as the $CI_JOB_TOKEN and is valid only as long as the job is running.
+ /// Use the $CI_DEPLOY_PASSWORD for long-lived access to the registry
///
public string RegistryPassword => EnvironmentInfo.GetVariable("CI_REGISTRY_PASSWORD");
///
- /// The username to use to push containers to the GitLab Container Registry.
+ /// The username to push containers to the project's GitLab container registry.
+ /// Only available if the container registry is enabled for the project.
///
public string RegistryUser => EnvironmentInfo.GetVariable("CI_REGISTRY_USER");
///
- /// The name of CI server that is used to coordinate jobs.
+ /// The name of CI/CD server that coordinates jobs.
///
public string ServerName => EnvironmentInfo.GetVariable("CI_SERVER_NAME");
///
- /// GitLab revision that is used to schedule jobs.
+ /// GitLab revision that schedules jobs.
///
public string ServerRevision => EnvironmentInfo.GetVariable("CI_SERVER_REVISION");
///
- /// GitLab version that is used to schedule jobs.
+ /// The full version of the GitLab instance.
///
public string ServerVersion => EnvironmentInfo.GetVariable("CI_SERVER_VERSION");
///
- /// The id of the user who started the job.
+ /// The numeric ID of the user who started the pipeline, unless the job is a manual job.
+ /// In manual jobs, the value is the ID of the user who started the job.
///
public long GitLabUserId => EnvironmentInfo.GetVariable("GITLAB_USER_ID");
///
- /// The email of the user who started the job.
+ /// The email of the user who started the pipeline, unless the job is a manual job.
+ /// In manual jobs, the value is the email of the user who started the job.
///
public string GitLabUserEmail => EnvironmentInfo.GetVariable("GITLAB_USER_EMAIL");
///
- /// The login username of the user who started the job.
+ /// The username of the user who started the pipeline, unless the job is a manual job.
+ /// In manual jobs, the value is the username of the user who started the job.
///
public string GitLabUserLogin => EnvironmentInfo.GetVariable("GITLAB_USER_LOGIN");
@@ -249,4 +276,678 @@ private string GetSectionId(string text)
/// The real name of the user who started the job.
///
public string GitLabUserName => EnvironmentInfo.GetVariable("GITLAB_USER_NAME");
+
+ /// ---- ///
+ ///
+ /// The Source chat channel that triggered the ChatOps command.
+ ///
+ public string ChatChannel => EnvironmentInfo.GetVariable("CHAT_CHANNEL");
+
+ ///
+ /// The additional arguments passed with the ChatOps command.
+ ///
+ public string ChatInput => EnvironmentInfo.GetVariable("CHAT_INPUT");
+
+ ///
+ /// The chat service's user ID of the user who triggered the ChatOps command.
+ ///
+ public string ChatUserId => EnvironmentInfo.GetVariable("CHAT_USER_ID");
+
+ ///
+ /// The GitLab API v4 root URL.
+ ///
+ public string ApiV4Url => EnvironmentInfo.GetVariable("CI_API_V4_URL");
+
+ ///
+ /// The GitLab API GraphQL root URL.
+ ///
+ public string ApiGraphqlUrl => EnvironmentInfo.GetVariable("CI_API_GRAPHQL_URL");
+
+ ///
+ /// The top-level directory where builds are executed.
+ ///
+ public string BuildsDir => EnvironmentInfo.GetVariable("CI_BUILDS_DIR");
+
+ ///
+ /// The author of the commit in Name <email> format.
+ ///
+ public string CommitAuthor => EnvironmentInfo.GetVariable("CI_COMMIT_AUTHOR");
+
+ ///
+ /// The previous latest commit present on a branch or tag.
+ /// Is always 0000000000000000000000000000000000000000 for merge request pipelines, the first commit in pipelines for branches or tags, or when manually running a pipeline.
+ ///
+ public string CommitBeforeSha => EnvironmentInfo.GetVariable("CI_COMMIT_BEFORE_SHA");
+
+ ///
+ /// The commit branch name.
+ /// Available in branch pipelines, including pipelines for the default branch.
+ /// Not available in merge request pipelines or tag pipelines.
+ ///
+ public string CommitBranch => EnvironmentInfo.GetVariable("CI_COMMIT_BRANCH");
+
+ ///
+ /// The description of the commit.
+ /// If the title is shorter than 100 characters, the message without the first line.
+ ///
+ public string CommitDescription => EnvironmentInfo.GetVariable("CI_COMMIT_DESCRIPTION");
+
+ ///
+ /// The full commit message.
+ ///
+ public string CommitMessage => EnvironmentInfo.GetVariable("CI_COMMIT_MESSAGE");
+
+ ///
+ /// true if the job is running for a protected reference, false otherwise.
+ ///
+ public bool CommitRefProtected => EnvironmentInfo.GetVariable("CI_COMMIT_REF_PROTECTED");
+
+ ///
+ /// The first eight characters of $CI_COMMIT_SHA.
+ ///
+ public string CommitShortSha => EnvironmentInfo.GetVariable("CI_COMMIT_SHORT_SHA");
+
+ ///
+ /// The commit tag message.
+ /// Available only in pipelines for tags.
+ ///
+ public string CommitTagMessage => EnvironmentInfo.GetVariable("CI_COMMIT_TAG_MESSAGE");
+
+ ///
+ /// The timestamp of the commit in the ISO 8601 format.
+ /// For example, 2022-01-31T16:47:55Z.
+ /// UTC by default.
+ ///
+ public string CommitTimestamp => EnvironmentInfo.GetVariable("CI_COMMIT_TIMESTAMP");
+
+ ///
+ /// The title of the commit.
+ /// The full first line of the message.
+ ///
+ public string CommitTitle => EnvironmentInfo.GetVariable("CI_COMMIT_TITLE");
+
+ ///
+ /// The unique ID of build execution in a single executor.
+ ///
+ public string ConcurrentId => EnvironmentInfo.GetVariable("CI_CONCURRENT_ID");
+
+ ///
+ /// The unique ID of build execution in a single executor and project.
+ ///
+ public string ConcurrentProjectId => EnvironmentInfo.GetVariable("CI_CONCURRENT_PROJECT_ID");
+
+ ///
+ /// true if debug logging (tracing) is enabled.
+ ///
+ public bool DebugTrace => EnvironmentInfo.GetVariable("CI_DEBUG_TRACE");
+
+ ///
+ /// true if service container logging is enabled.
+ ///
+ public bool DebugServices => EnvironmentInfo.GetVariable("CI_DEBUG_SERVICES");
+
+ ///
+ /// The name of the project's default branch.
+ ///
+ public string DefaultBranch => EnvironmentInfo.GetVariable("CI_DEFAULT_BRANCH");
+
+ ///
+ /// The direct group image prefix for pulling images through the Dependency Proxy.
+ ///
+ public string DependencyProxyDirectGroupImagePrefix => EnvironmentInfo.GetVariable("CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX");
+
+ ///
+ /// The top-level group image prefix for pulling images through the Dependency Proxy.
+ ///
+ public string DependencyProxyGroupImagePrefix => EnvironmentInfo.GetVariable("CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX");
+
+ ///
+ /// The password to pull images through the Dependency Proxy.
+ ///
+ public string DependencyProxyPassword => EnvironmentInfo.GetVariable("CI_DEPENDENCY_PROXY_PASSWORD");
+
+ ///
+ /// The server for logging in to the Dependency Proxy.
+ /// This is equivalent to $CI_SERVER_HOST:$CI_SERVER_PORT.
+ ///
+ public string DependencyProxyServer => EnvironmentInfo.GetVariable("CI_DEPENDENCY_PROXY_SERVER");
+
+ ///
+ /// The username to pull images through the Dependency Proxy.
+ ///
+ public string DependencyProxyUser => EnvironmentInfo.GetVariable("CI_DEPENDENCY_PROXY_USER");
+
+ ///
+ /// Only available if the pipeline runs during a deploy freeze window.
+ /// true when available.
+ ///
+ public bool DeployFreeze => EnvironmentInfo.GetVariable("CI_DEPLOY_FREEZE");
+
+ ///
+ /// The authentication password of the GitLab Deploy Token, if the project has one.
+ ///
+ public string DeployPassword => EnvironmentInfo.GetVariable("CI_DEPLOY_PASSWORD");
+
+ ///
+ /// The authentication username of the GitLab Deploy Token, if the project has one.
+ ///
+ public string DeployUser => EnvironmentInfo.GetVariable("CI_DEPLOY_USER");
+
+ ///
+ /// The name of the environment for this job.
+ /// Available if environment:name is set.
+ ///
+ public string EnvironmentName => EnvironmentInfo.GetVariable("CI_ENVIRONMENT_NAME");
+
+ ///
+ /// The simplified version of the environment name, suitable for inclusion in DNS, URLs, Kubernetes labels, and so on.
+ /// Available if environment:name is set.
+ /// The slug is truncated to 24 characters.
+ /// A random suffix is automatically added to uppercase environment names.
+ ///
+ public string EnvironmentSlug => EnvironmentInfo.GetVariable("CI_ENVIRONMENT_SLUG");
+
+ ///
+ /// The URL of the environment for this job.
+ /// Available if environment:url is set.
+ ///
+ public string EnvironmentUrl => EnvironmentInfo.GetVariable("CI_ENVIRONMENT_URL");
+
+ ///
+ /// The action annotation specified for this job's environment.
+ /// Available if environment:action is set.
+ /// Can be start, prepare, or stop.
+ ///
+ public string EnvironmentAction => EnvironmentInfo.GetVariable("CI_ENVIRONMENT_ACTION");
+
+ ///
+ /// The deployment tier of the environment for this job.
+ ///
+ public string EnvironmentTier => EnvironmentInfo.GetVariable("CI_ENVIRONMENT_TIER");
+
+ ///
+ /// The description of the release.
+ /// Available only on pipelines for tags.
+ /// Description length is limited to first 1024 characters.
+ ///
+ public string ReleaseDescription => EnvironmentInfo.GetVariable("CI_RELEASE_DESCRIPTION");
+
+ ///
+ /// Only available if FIPS mode is enabled in the GitLab instance.
+ /// true when available.
+ ///
+ public bool GitLabFipsMode => EnvironmentInfo.GetVariable("CI_GITLAB_FIPS_MODE");
+
+ ///
+ /// Only available if the pipeline's project has an open requirement.
+ /// true when available.
+ ///
+ public bool HasOpenRequirements => EnvironmentInfo.GetVariable("CI_HAS_OPEN_REQUIREMENTS");
+
+ ///
+ /// The name of the Docker image running the job.
+ ///
+ public string JobImage => EnvironmentInfo.GetVariable("CI_JOB_IMAGE");
+
+ ///
+ /// A RS256 JSON web token to authenticate with third party systems that support JWT authentication, for example HashiCorp's Vault.
+ /// Deprecated in GitLab 15.9 and scheduled to be removed in GitLab 17.0.
+ /// Use ID tokens instead.
+ ///
+ [Obsolete] public string JobJwt => EnvironmentInfo.GetVariable("CI_JOB_JWT");
+
+ ///
+ /// The same value as $CI_JOB_JWT.
+ /// Deprecated in GitLab 15.9 and scheduled to be removed in GitLab 17.0.
+ /// Use ID tokens instead.
+ ///
+ [Obsolete] public string JobJwtV1 => EnvironmentInfo.GetVariable("CI_JOB_JWT_V1");
+
+ ///
+ /// A newly formatted RS256 JSON web token to increase compatibility.
+ /// Similar to $CI_JOB_JWT, except the issuer (iss) claim is changed from gitlab.com to https://gitlab.com, sub has changed from job_id to a string that contains the project path, and an aud claim is added.
+ /// The aud field is a constant value.
+ /// Trusting JWTs in multiple relying parties can lead to one RP sending a JWT to another one and acting maliciously as a job.
+ /// Deprecated in GitLab 15.9 and scheduled to be removed in GitLab 17.0.
+ /// Use ID tokens instead.
+ ///
+ [Obsolete] public string JobJwtV2 => EnvironmentInfo.GetVariable("CI_JOB_JWT_V2");
+
+ ///
+ /// $CI_JOB_NAME in lowercase, shortened to 63 bytes, and with everything except 0-9 and a-z replaced with -.
+ /// No leading / trailing -.
+ /// Use in paths.
+ ///
+ public string JobNameSlug => EnvironmentInfo.GetVariable("CI_JOB_NAME_SLUG");
+
+ ///
+ /// The status of the job as each runner stage is executed.
+ /// Use with after_script.
+ /// Can be success, failed, or canceled.
+ ///
+ public string JobStatus => EnvironmentInfo.GetVariable("CI_JOB_STATUS");
+
+ ///
+ /// The job timeout, in seconds.
+ ///
+ public string JobTimeout => EnvironmentInfo.GetVariable("CI_JOB_TIMEOUT");
+
+ ///
+ /// The job details URL.
+ ///
+ public string JobUrl => EnvironmentInfo.GetVariable("CI_JOB_URL");
+
+ ///
+ /// The date and time when a job started, in ISO 8601 format.
+ /// For example, 2022-01-31T16:47:55Z.
+ /// UTC by default.
+ ///
+ public string JobStartedAt => EnvironmentInfo.GetVariable("CI_JOB_STARTED_AT");
+
+ ///
+ /// Only available if the pipeline has a Kubernetes cluster available for deployments.
+ /// true when available.
+ ///
+ public bool KubernetesActive => EnvironmentInfo.GetVariable("CI_KUBERNETES_ACTIVE");
+
+ ///
+ /// The index of the job in the job set.
+ /// Only available if the job uses parallel.
+ ///
+ public string NodeIndex => EnvironmentInfo.GetVariable("CI_NODE_INDEX");
+
+ ///
+ /// The total number of instances of this job running in parallel.
+ /// Set to 1 if the job does not use parallel.
+ ///
+ public string NodeTotal => EnvironmentInfo.GetVariable("CI_NODE_TOTAL");
+
+ ///
+ /// A comma-separated list of up to four merge requests that use the current branch and project as the merge request source.
+ /// Only available in branch and merge request pipelines if the branch has an associated merge request.
+ /// For example, gitlab-org/gitlab!333,gitlab-org/gitlab-foss!11.
+ ///
+ public string OpenMergeRequests => EnvironmentInfo.GetVariable("CI_OPEN_MERGE_REQUESTS");
+
+ ///
+ /// The configured domain that hosts GitLab Pages.
+ ///
+ public string PagesDomain => EnvironmentInfo.GetVariable("CI_PAGES_DOMAIN");
+
+ ///
+ /// The URL for a GitLab Pages site.
+ /// Always a subdomain of $CI_PAGES_DOMAIN.
+ ///
+ public string PagesUrl => EnvironmentInfo.GetVariable("CI_PAGES_URL");
+
+ ///
+ /// The project-level IID (internal ID) of the current pipeline.
+ /// This ID is unique only within the current project.
+ ///
+ public string PipelineIid => EnvironmentInfo.GetVariable("CI_PIPELINE_IID");
+
+ ///
+ /// The URL for the pipeline details.
+ ///
+ public string PipelineUrl => EnvironmentInfo.GetVariable("CI_PIPELINE_URL");
+
+ ///
+ /// The date and time when the pipeline was created, in ISO 8601 format.
+ /// For example, 2022-01-31T16:47:55Z.
+ /// UTC by default.
+ ///
+ public string PipelineCreatedAt => EnvironmentInfo.GetVariable("CI_PIPELINE_CREATED_AT");
+
+ ///
+ /// The pipeline name defined in workflow:name
+ ///
+ public string PipelineName => EnvironmentInfo.GetVariable("CI_PIPELINE_NAME");
+
+ ///
+ /// The full path the repository is cloned to, and where the job runs from.
+ /// If the GitLab Runner builds_dir parameter is set, this variable is set relative to the value of builds_dir.
+ /// For more information, see the Advanced GitLab Runner configuration.
+ ///
+ public string ProjectDir => EnvironmentInfo.GetVariable("CI_PROJECT_DIR");
+
+ ///
+ /// The project namespace ID of the job.
+ ///
+ public string ProjectNamespaceId => EnvironmentInfo.GetVariable("CI_PROJECT_NAMESPACE_ID");
+
+ ///
+ /// A comma-separated, lowercase list of the languages used in the repository.
+ /// For example ruby,javascript,html,css.
+ /// The maximum number of languages is limited to 5.
+ /// An issue proposes to increase the limit.
+ ///
+ public string ProjectRepositoryLanguages => EnvironmentInfo.GetVariable("CI_PROJECT_REPOSITORY_LANGUAGES");
+
+ ///
+ /// The root project namespace (username or group name) of the job.
+ /// For example, if $CI_PROJECT_NAMESPACE is root-group/child-group/grandchild-group, $CI_PROJECT_ROOT_NAMESPACE is root-group.
+ ///
+ public string ProjectRootNamespace => EnvironmentInfo.GetVariable("CI_PROJECT_ROOT_NAMESPACE");
+
+ ///
+ /// The human-readable project name as displayed in the GitLab web interface.
+ ///
+ public string ProjectTitle => EnvironmentInfo.GetVariable("CI_PROJECT_TITLE");
+
+ ///
+ /// The project description as displayed in the GitLab web interface.
+ ///
+ public string ProjectDescription => EnvironmentInfo.GetVariable("CI_PROJECT_DESCRIPTION");
+
+ ///
+ /// The project external authorization classification label.
+ ///
+ public string ProjectClassificationLabel => EnvironmentInfo.GetVariable("CI_PROJECT_CLASSIFICATION_LABEL");
+
+ ///
+ /// The OS/architecture of the GitLab Runner executable.
+ /// Might not be the same as the environment of the executor.
+ ///
+ public string RunnerExecutableArch => EnvironmentInfo.GetVariable("CI_RUNNER_EXECUTABLE_ARCH");
+
+ ///
+ /// The revision of the runner running the job.
+ ///
+ public string RunnerRevision => EnvironmentInfo.GetVariable("CI_RUNNER_REVISION");
+
+ ///
+ /// The runner's unique ID, used to authenticate new job requests.
+ /// In GitLab 14.9 and later, the token contains a prefix, and the first 17 characters are used.
+ /// Prior to 14.9, the first eight characters are used.
+ ///
+ public string RunnerShortToken => EnvironmentInfo.GetVariable("CI_RUNNER_SHORT_TOKEN");
+
+ ///
+ /// The version of the GitLab Runner running the job.
+ ///
+ public string RunnerVersion => EnvironmentInfo.GetVariable("CI_RUNNER_VERSION");
+
+ ///
+ /// The host of the GitLab instance URL, without protocol or port.
+ /// For example gitlab.example.com.
+ ///
+ public string ServerHost => EnvironmentInfo.GetVariable("CI_SERVER_HOST");
+
+ ///
+ /// The port of the GitLab instance URL, without host or protocol.
+ /// For example 8080.
+ ///
+ public string ServerPort => EnvironmentInfo.GetVariable("CI_SERVER_PORT");
+
+ ///
+ /// The protocol of the GitLab instance URL, without host or port.
+ /// For example https.
+ ///
+ public string ServerProtocol => EnvironmentInfo.GetVariable("CI_SERVER_PROTOCOL");
+
+ ///
+ /// The SSH host of the GitLab instance, used for access to Git repositories via SSH.
+ /// For example gitlab.com.
+ ///
+ public string ServerShellSshHost => EnvironmentInfo.GetVariable("CI_SERVER_SHELL_SSH_HOST");
+
+ ///
+ /// The SSH port of the GitLab instance, used for access to Git repositories via SSH.
+ /// For example 22.
+ ///
+ public string ServerShellSshPort => EnvironmentInfo.GetVariable("CI_SERVER_SHELL_SSH_PORT");
+
+ ///
+ /// File containing the TLS CA certificate to verify the GitLab server when tls-ca-file set in runner settings.
+ ///
+ public string ServerTlsCaFile => EnvironmentInfo.GetVariable("CI_SERVER_TLS_CA_FILE");
+
+ ///
+ /// File containing the TLS certificate to verify the GitLab server when tls-cert-file set in runner settings.
+ ///
+ public string ServerTlsCertFile => EnvironmentInfo.GetVariable("CI_SERVER_TLS_CERT_FILE");
+
+ ///
+ /// File containing the TLS key to verify the GitLab server when tls-key-file set in runner settings.
+ ///
+ public string ServerTlsKeyFile => EnvironmentInfo.GetVariable("CI_SERVER_TLS_KEY_FILE");
+
+ ///
+ /// The base URL of the GitLab instance, including protocol and port.
+ /// For example https://gitlab.example.com:8080.
+ ///
+ public string ServerUrl => EnvironmentInfo.GetVariable("CI_SERVER_URL");
+
+ ///
+ /// The major version of the GitLab instance.
+ /// For example, if the GitLab version is 13.6.1, the $CI_SERVER_VERSION_MAJOR is 13.
+ ///
+ public string ServerVersionMajor => EnvironmentInfo.GetVariable("CI_SERVER_VERSION_MAJOR");
+
+ ///
+ /// The minor version of the GitLab instance.
+ /// For example, if the GitLab version is 13.6.1, the $CI_SERVER_VERSION_MINOR is 6.
+ ///
+ public string ServerVersionMinor => EnvironmentInfo.GetVariable("CI_SERVER_VERSION_MINOR");
+
+ ///
+ /// The patch version of the GitLab instance.
+ /// For example, if the GitLab version is 13.6.1, the $CI_SERVER_VERSION_PATCH is 1.
+ ///
+ public string ServerVersionPatch => EnvironmentInfo.GetVariable("CI_SERVER_VERSION_PATCH");
+
+ ///
+ /// Available for all jobs executed in CI/CD. yes when available.
+ ///
+ public string Server => EnvironmentInfo.GetVariable("CI_SERVER");
+
+ ///
+ /// Only available if the job is executed in a shared environment (something that is persisted across CI/CD invocations, like the shell or ssh executor).
+ /// true when available.
+ ///
+ public bool SharedEnvironment => EnvironmentInfo.GetVariable("CI_SHARED_ENVIRONMENT");
+
+ ///
+ /// The host of the registry used by CI/CD templates.
+ /// Defaults to registry.gitlab.com.
+ ///
+ public string TemplateRegistryHost => EnvironmentInfo.GetVariable("CI_TEMPLATE_REGISTRY_HOST");
+
+ ///
+ /// Available for all jobs executed in CI/CD. true when available.
+ ///
+ public bool GitLabCi => EnvironmentInfo.GetVariable("GITLAB_CI");
+
+ ///
+ /// The comma-separated list of licensed features available for the GitLab instance and license.
+ ///
+ public string GitLabFeatures => EnvironmentInfo.GetVariable("GITLAB_FEATURES");
+
+ ///
+ /// The path to the kubeconfig file with contexts for every shared agent connection.
+ /// Only available when a GitLab agent is authorized to access the project.
+ ///
+ public string Kubeconfig => EnvironmentInfo.GetVariable("KUBECONFIG");
+
+ ///
+ /// The webhook payload.
+ /// Only available when a pipeline is triggered with a webhook.
+ ///
+ public string TriggerPayload => EnvironmentInfo.GetVariable("TRIGGER_PAYLOAD");
+
+ ///
+ /// Approval status of the merge request. true when merge request approvals is available and the merge request has been approved.
+ ///
+ public bool MergeRequestApproved => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_APPROVED");
+
+ ///
+ /// Comma-separated list of usernames of assignees for the merge request.
+ ///
+ public string MergeRequestAssignees => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_ASSIGNEES");
+
+ ///
+ /// The base SHA of the merge request diff.
+ ///
+ public string MergeRequestDiffBaseSha => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_DIFF_BASE_SHA");
+
+ ///
+ /// The version of the merge request diff.
+ ///
+ public string MergeRequestDiffId => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_DIFF_ID");
+
+ ///
+ /// The event type of the merge request.
+ /// Can be detached, merged_result or merge_train.
+ ///
+ public string MergeRequestEventType => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_EVENT_TYPE");
+
+ ///
+ /// The description of the merge request.
+ /// If the description is more than 2700 characters long, only the first 2700 characters are stored in the variable.
+ ///
+ public string MergeRequestDescription => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_DESCRIPTION");
+
+ ///
+ /// true if $CI_MERGE_REQUEST_DESCRIPTION is truncated down to 2700 characters because the description of the merge request is too long.
+ ///
+ public bool MergeRequestDescriptionIsTruncated => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_DESCRIPTION_IS_TRUNCATED");
+
+ ///
+ /// The instance-level ID of the merge request.
+ /// This is a unique ID across all projects on the GitLab instance.
+ ///
+ public string MergeRequestId => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_ID");
+
+ ///
+ /// The project-level IID (internal ID) of the merge request.
+ /// This ID is unique for the current project, and is the number used in the merge request URL, page title, and other visible locations.
+ ///
+ public string MergeRequestIid => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_IID");
+
+ ///
+ /// Comma-separated label names of the merge request.
+ ///
+ public string MergeRequestLabels => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_LABELS");
+
+ ///
+ /// The milestone title of the merge request.
+ ///
+ public string MergeRequestMilestone => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_MILESTONE");
+
+ ///
+ /// The ID of the project of the merge request.
+ ///
+ public string MergeRequestProjectId => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_PROJECT_ID");
+
+ ///
+ /// The path of the project of the merge request.
+ /// For example namespace/awesome-project.
+ ///
+ public string MergeRequestProjectPath => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_PROJECT_PATH");
+
+ ///
+ /// The URL of the project of the merge request.
+ /// For example, http://192.168.10.15:3000/namespace/awesome-project.
+ ///
+ public string MergeRequestProjectUrl => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_PROJECT_URL");
+
+ ///
+ /// The ref path of the merge request.
+ /// For example, refs/merge-requests/1/head.
+ ///
+ public string MergeRequestRefPath => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_REF_PATH");
+
+ ///
+ /// The source branch name of the merge request.
+ ///
+ public string MergeRequestSourceBranchName => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_SOURCE_BRANCH_NAME");
+
+ ///
+ /// true when the source branch of the merge request is protected.
+ ///
+ public bool MergeRequestSourceBranchProtected => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_SOURCE_BRANCH_PROTECTED");
+
+ ///
+ /// The HEAD SHA of the source branch of the merge request.
+ /// The variable is empty in merge request pipelines.
+ /// The SHA is present only in merged results pipelines.
+ ///
+ public string MergeRequestSourceBranchSha => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_SOURCE_BRANCH_SHA");
+
+ ///
+ /// The ID of the source project of the merge request.
+ ///
+ public string MergeRequestSourceProjectId => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_SOURCE_PROJECT_ID");
+
+ ///
+ /// The path of the source project of the merge request.
+ ///
+ public string MergeRequestSourceProjectPath => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_SOURCE_PROJECT_PATH");
+
+ ///
+ /// The URL of the source project of the merge request.
+ ///
+ public string MergeRequestSourceProjectUrl => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_SOURCE_PROJECT_URL");
+
+ ///
+ /// true when the squash on merge option is set.
+ ///
+ public bool MergeRequestSquashOnMerge => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_SQUASH_ON_MERGE");
+
+ ///
+ /// The target branch name of the merge request.
+ ///
+ public string MergeRequestTargetBranchName => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_TARGET_BRANCH_NAME");
+
+ ///
+ /// true when the target branch of the merge request is protected.
+ ///
+ public bool MergeRequestTargetBranchProtected => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_TARGET_BRANCH_PROTECTED");
+
+ ///
+ /// The HEAD SHA of the target branch of the merge request.
+ /// The variable is empty in merge request pipelines.
+ /// The SHA is present only in merged results pipelines.
+ ///
+ public string MergeRequestTargetBranchSha => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_TARGET_BRANCH_SHA");
+
+ ///
+ /// The title of the merge request.
+ ///
+ public string MergeRequestTitle => EnvironmentInfo.GetVariable("CI_MERGE_REQUEST_TITLE");
+
+ ///
+ /// Pull request ID from GitHub.
+ ///
+ public string ExternalPullRequestIid => EnvironmentInfo.GetVariable("CI_EXTERNAL_PULL_REQUEST_IID");
+
+ ///
+ /// The source repository name of the pull request.
+ ///
+ public string ExternalPullRequestSourceRepository => EnvironmentInfo.GetVariable("CI_EXTERNAL_PULL_REQUEST_SOURCE_REPOSITORY");
+
+ ///
+ /// The target repository name of the pull request.
+ ///
+ public string ExternalPullRequestTargetRepository => EnvironmentInfo.GetVariable("CI_EXTERNAL_PULL_REQUEST_TARGET_REPOSITORY");
+
+ ///
+ /// The source branch name of the pull request.
+ ///
+ public string ExternalPullRequestSourceBranchName => EnvironmentInfo.GetVariable("CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME");
+
+ ///
+ /// The HEAD SHA of the source branch of the pull request.
+ ///
+ public string ExternalPullRequestSourceBranchSha => EnvironmentInfo.GetVariable("CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_SHA");
+
+ ///
+ /// The target branch name of the pull request.
+ ///
+ public string ExternalPullRequestTargetBranchName => EnvironmentInfo.GetVariable("CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME");
+
+ ///
+ /// The HEAD SHA of the target branch of the pull request.
+ ///
+ public string ExternalPullRequestTargetBranchSha => EnvironmentInfo.GetVariable("CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_SHA");
}
From c5f62500d6bc6bd7d788b5b8f276be6b3c14fb47 Mon Sep 17 00:00:00 2001
From: Sam13
Date: Wed, 20 Mar 2024 02:32:02 +0100
Subject: [PATCH 08/56] fix(tools): tool path for DotCoverTasks on Unix (#1347)
---
source/Nuke.Common/Tools/DotCover/DotCoverTasks.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source/Nuke.Common/Tools/DotCover/DotCoverTasks.cs b/source/Nuke.Common/Tools/DotCover/DotCoverTasks.cs
index 3f20ecbe0..60a7d2aab 100644
--- a/source/Nuke.Common/Tools/DotCover/DotCoverTasks.cs
+++ b/source/Nuke.Common/Tools/DotCover/DotCoverTasks.cs
@@ -12,6 +12,6 @@ internal static string GetToolPath()
{
return NuGetToolPathResolver.GetPackageExecutable(
"JetBrains.dotCover.DotNetCliTool|JetBrains.dotCover.CommandLineTools",
- EnvironmentInfo.IsWin ? "dotCover.exe" : "dotCover.sh|dotCover.exe");
+ EnvironmentInfo.IsWin ? "dotCover.exe" : "dotCover.sh|dotCover.dll");
}
}
From 1f2031d927fbcec8ce4b10aba3b5e8bab59e94cc Mon Sep 17 00:00:00 2001
From: Marko Lahma
Date: Wed, 20 Mar 2024 03:35:36 +0200
Subject: [PATCH 09/56] feat(cicd): update actions/cache and
actions/upload-artifact to v4 (#1335)
---
.github/workflows/alpha-deployment.yml | 2 +-
.github/workflows/macos-latest.yml | 2 +-
.github/workflows/ubuntu-latest.yml | 2 +-
.github/workflows/windows-latest.yml | 2 +-
...ribute=GitHubActionsAttribute.verified.txt | 24 +++++++++----------
...ribute=GitHubActionsAttribute.verified.txt | 24 +++++++++----------
.../GitHubActionsArtifactStep.cs | 2 +-
.../Configuration/GitHubActionsCacheStep.cs | 2 +-
8 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/.github/workflows/alpha-deployment.yml b/.github/workflows/alpha-deployment.yml
index db618b266..69b7d54e5 100644
--- a/.github/workflows/alpha-deployment.yml
+++ b/.github/workflows/alpha-deployment.yml
@@ -30,7 +30,7 @@ jobs:
with:
fetch-depth: 0
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: |
.nuke/temp
diff --git a/.github/workflows/macos-latest.yml b/.github/workflows/macos-latest.yml
index 4eaebdbca..9db41a37b 100644
--- a/.github/workflows/macos-latest.yml
+++ b/.github/workflows/macos-latest.yml
@@ -34,7 +34,7 @@ jobs:
with:
fetch-depth: 0
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: |
.nuke/temp
diff --git a/.github/workflows/ubuntu-latest.yml b/.github/workflows/ubuntu-latest.yml
index 96b5f5199..06b3edcd3 100644
--- a/.github/workflows/ubuntu-latest.yml
+++ b/.github/workflows/ubuntu-latest.yml
@@ -34,7 +34,7 @@ jobs:
with:
fetch-depth: 0
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: |
.nuke/temp
diff --git a/.github/workflows/windows-latest.yml b/.github/workflows/windows-latest.yml
index e42daf33b..b8b183eeb 100644
--- a/.github/workflows/windows-latest.yml
+++ b/.github/workflows/windows-latest.yml
@@ -34,7 +34,7 @@ jobs:
with:
fetch-depth: 0
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: |
.nuke/temp
diff --git a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt
index 09545feca..baa10b88e 100644
--- a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt
+++ b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt
@@ -59,7 +59,7 @@ jobs:
lfs: true
fetch-depth: 2
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: |
.nuke/temp
@@ -71,19 +71,19 @@ jobs:
OptionalInput: ${{ github.event.inputs.OptionalInput }}
RequiredInput: ${{ github.event.inputs.RequiredInput }}
- name: 'Publish: src'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: src
path: src
- name: 'Publish: test-results'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-results
path: output/test-results
- name: 'Publish: coverage-report.zip'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: coverage-report.zip
@@ -102,7 +102,7 @@ jobs:
lfs: true
fetch-depth: 2
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: |
.nuke/temp
@@ -114,19 +114,19 @@ jobs:
OptionalInput: ${{ github.event.inputs.OptionalInput }}
RequiredInput: ${{ github.event.inputs.RequiredInput }}
- name: 'Publish: src'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: src
path: src
- name: 'Publish: test-results'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-results
path: output/test-results
- name: 'Publish: coverage-report.zip'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: coverage-report.zip
@@ -145,7 +145,7 @@ jobs:
lfs: true
fetch-depth: 2
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: |
.nuke/temp
@@ -157,19 +157,19 @@ jobs:
OptionalInput: ${{ github.event.inputs.OptionalInput }}
RequiredInput: ${{ github.event.inputs.RequiredInput }}
- name: 'Publish: src'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: src
path: src
- name: 'Publish: test-results'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-results
path: output/test-results
- name: 'Publish: coverage-report.zip'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: coverage-report.zip
diff --git a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=simple-triggers_attribute=GitHubActionsAttribute.verified.txt b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=simple-triggers_attribute=GitHubActionsAttribute.verified.txt
index 17617c171..740323d94 100644
--- a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=simple-triggers_attribute=GitHubActionsAttribute.verified.txt
+++ b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=simple-triggers_attribute=GitHubActionsAttribute.verified.txt
@@ -29,7 +29,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: |
.nuke/temp
@@ -41,17 +41,17 @@ jobs:
ApiKey: ${{ secrets.API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Publish: src'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: src
path: src
- name: 'Publish: test-results'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: test-results
path: output/test-results
- name: 'Publish: coverage-report.zip'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: coverage-report.zip
path: output/coverage-report.zip
@@ -61,7 +61,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: |
.nuke/temp
@@ -73,17 +73,17 @@ jobs:
ApiKey: ${{ secrets.API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Publish: src'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: src
path: src
- name: 'Publish: test-results'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: test-results
path: output/test-results
- name: 'Publish: coverage-report.zip'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: coverage-report.zip
path: output/coverage-report.zip
@@ -93,7 +93,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: |
.nuke/temp
@@ -105,17 +105,17 @@ jobs:
ApiKey: ${{ secrets.API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Publish: src'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: src
path: src
- name: 'Publish: test-results'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: test-results
path: output/test-results
- name: 'Publish: coverage-report.zip'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: coverage-report.zip
path: output/coverage-report.zip
diff --git a/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsArtifactStep.cs b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsArtifactStep.cs
index 74b3f8f60..4cde5be24 100644
--- a/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsArtifactStep.cs
+++ b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsArtifactStep.cs
@@ -17,7 +17,7 @@ public class GitHubActionsArtifactStep : GitHubActionsStep
public override void Write(CustomFileWriter writer)
{
writer.WriteLine("- name: " + $"Publish: {Name}".SingleQuote());
- writer.WriteLine(" uses: actions/upload-artifact@v3");
+ writer.WriteLine(" uses: actions/upload-artifact@v4");
using (writer.Indent())
{
diff --git a/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsCacheStep.cs b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsCacheStep.cs
index bf93df153..744461d8e 100644
--- a/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsCacheStep.cs
+++ b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsCacheStep.cs
@@ -23,7 +23,7 @@ public override void Write(CustomFileWriter writer)
writer.WriteLine("- name: " + $"Cache: {IncludePatterns.JoinCommaSpace()}".SingleQuote());
using (writer.Indent())
{
- writer.WriteLine("uses: actions/cache@v3");
+ writer.WriteLine("uses: actions/cache@v4");
writer.WriteLine("with:");
using (writer.Indent())
{
From e43f15dee4854218a493e98bbbea8d323e1ce348 Mon Sep 17 00:00:00 2001
From: Marko Lahma
Date: Wed, 20 Mar 2024 03:40:04 +0200
Subject: [PATCH 10/56] chore: upgrade NuGet.Packaging to v6.9.1 (#1334)
---
source/Nuke.MSBuildTasks/Nuke.MSBuildTasks.csproj | 2 +-
source/Nuke.Tooling/Nuke.Tooling.csproj | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/source/Nuke.MSBuildTasks/Nuke.MSBuildTasks.csproj b/source/Nuke.MSBuildTasks/Nuke.MSBuildTasks.csproj
index 071f0d270..57c0b11f8 100644
--- a/source/Nuke.MSBuildTasks/Nuke.MSBuildTasks.csproj
+++ b/source/Nuke.MSBuildTasks/Nuke.MSBuildTasks.csproj
@@ -11,7 +11,7 @@
-
+
diff --git a/source/Nuke.Tooling/Nuke.Tooling.csproj b/source/Nuke.Tooling/Nuke.Tooling.csproj
index 2cf6a0ba7..bc0de0ef9 100644
--- a/source/Nuke.Tooling/Nuke.Tooling.csproj
+++ b/source/Nuke.Tooling/Nuke.Tooling.csproj
@@ -10,7 +10,7 @@
-
+
From a130e1bcd979c7cda16870a27168dfb3948fe8a8 Mon Sep 17 00:00:00 2001
From: Marko Lahma
Date: Wed, 20 Mar 2024 03:42:06 +0200
Subject: [PATCH 11/56] chore: upgrade Microsoft.Build to v17.9.5 (#1333)
---
source/Nuke.ProjectModel/Nuke.ProjectModel.csproj | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/source/Nuke.ProjectModel/Nuke.ProjectModel.csproj b/source/Nuke.ProjectModel/Nuke.ProjectModel.csproj
index 923c081a6..cf7b4233b 100644
--- a/source/Nuke.ProjectModel/Nuke.ProjectModel.csproj
+++ b/source/Nuke.ProjectModel/Nuke.ProjectModel.csproj
@@ -15,10 +15,10 @@
-
-
-
-
+
+
+
+
From be14f9e88a5ee72f96f719bc5427a701508a1c29 Mon Sep 17 00:00:00 2001
From: Marko Lahma
Date: Wed, 20 Mar 2024 03:47:15 +0200
Subject: [PATCH 12/56] fix(tools): tool path for EntityFrameworkTasks (#1332)
---
.../EntityFramework/EntityFramework.json | 20 ++++++++++++++++---
.../EntityFrameworkSettings.cs | 20 +++++++++++++++++++
.../EntityFramework/EntityFrameworkTasks.cs | 20 +++++++++++++++++++
3 files changed, 57 insertions(+), 3 deletions(-)
create mode 100644 source/Nuke.Common/Tools/EntityFramework/EntityFrameworkSettings.cs
create mode 100644 source/Nuke.Common/Tools/EntityFramework/EntityFrameworkTasks.cs
diff --git a/source/Nuke.Common/Tools/EntityFramework/EntityFramework.json b/source/Nuke.Common/Tools/EntityFramework/EntityFramework.json
index 499090b5d..99d9b81be 100644
--- a/source/Nuke.Common/Tools/EntityFramework/EntityFramework.json
+++ b/source/Nuke.Common/Tools/EntityFramework/EntityFramework.json
@@ -6,13 +6,15 @@
"name": "EntityFramework",
"officialUrl": "https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet",
"help": "The command-line interface (CLI) tools for Entity Framework Core perform design-time development tasks. For example, they create migrations, apply migrations, and generate code for a model based on an existing database. The commands are an extension to the cross-platform dotnet command, which is part of the .NET Core SDK. These tools work with .NET Core projects.If you're using Visual Studio, we recommend the Package Manager Console tools instead:
They automatically work with the current project selected in the Package Manager Console without requiring that you manually switch directories.
They automatically open files generated by a command after the command is completed.
",
- "pathExecutable": "dotnet",
+ "nugetPackageId": "dotnet-ef",
+ "customExecutable": true,
"tasks": [
{
"help": "The dotnet ef database drop command is used to drop the database.",
"postfix": "DatabaseDrop",
"definiteArgument": "ef database drop",
"settingsClass": {
+ "baseClass": "EntityFrameworkSettings",
"properties": [
{
"name": "Force",
@@ -34,6 +36,7 @@
"postfix": "DatabaseUpdate",
"definiteArgument": "ef database update",
"settingsClass": {
+ "baseClass": "EntityFrameworkSettings",
"properties": [
{
"name": "Migration",
@@ -54,19 +57,24 @@
"help": "The dotnet ef dbcontext info command is used to get information about a DbContext type.",
"postfix": "DbContextInfo",
"definiteArgument": "ef dbcontext info",
- "settingsClass": {}
+ "settingsClass": {
+ "baseClass": "EntityFrameworkSettings"
+ }
},
{
"help": "The dotnet ef dbcontext list command is used to list available DbContext types.",
"postfix": "DbContextList",
"definiteArgument": "ef dbcontext list",
- "settingsClass": {}
+ "settingsClass": {
+ "baseClass": "EntityFrameworkSettings"
+ }
},
{
"help": "The dotnet ef dbcontext scaffold command is used to generate code for a DbContext and entity types for a database. In order for this command to generate an entity type, the database table must have a primary key.",
"postfix": "DbContextScaffold",
"definiteArgument": "ef dbcontext scaffold",
"settingsClass": {
+ "baseClass": "EntityFrameworkSettings",
"properties": [
{
"name": "Connection",
@@ -160,6 +168,7 @@
"postfix": "DbContextScript",
"definiteArgument": "ef dbcontext script",
"settingsClass": {
+ "baseClass": "EntityFrameworkSettings",
"properties": [
{
"name": "Output",
@@ -175,6 +184,7 @@
"postfix": "MigrationsAdd",
"definiteArgument": "ef migrations add",
"settingsClass": {
+ "baseClass": "EntityFrameworkSettings",
"properties": [
{
"name": "Name",
@@ -202,6 +212,7 @@
"postfix": "MigrationsList",
"definiteArgument": "ef migrations list",
"settingsClass": {
+ "baseClass": "EntityFrameworkSettings",
"properties": [
{
"name": "Connection",
@@ -223,6 +234,7 @@
"postfix": "MigrationsRemove",
"definiteArgument": "ef migrations remove",
"settingsClass": {
+ "baseClass": "EntityFrameworkSettings",
"properties": [
{
"name": "Force",
@@ -238,6 +250,7 @@
"postfix": "MigrationsBundle",
"definiteArgument": "ef migrations bundle",
"settingsClass": {
+ "baseClass": "EntityFrameworkSettings",
"properties": [
{
"name": "Output",
@@ -271,6 +284,7 @@
"postfix": "MigrationsScript",
"definiteArgument": "ef migrations script",
"settingsClass": {
+ "baseClass": "EntityFrameworkSettings",
"properties": [
{
"name": "From",
diff --git a/source/Nuke.Common/Tools/EntityFramework/EntityFrameworkSettings.cs b/source/Nuke.Common/Tools/EntityFramework/EntityFrameworkSettings.cs
new file mode 100644
index 000000000..a88d2becd
--- /dev/null
+++ b/source/Nuke.Common/Tools/EntityFramework/EntityFrameworkSettings.cs
@@ -0,0 +1,20 @@
+// Copyright 2024 Maintainers of NUKE.
+// Distributed under the MIT License.
+// https://github.com/nuke-build/nuke/blob/master/LICENSE
+
+using System;
+using System.Linq;
+using JetBrains.Annotations;
+using Nuke.Common.Tooling;
+
+namespace Nuke.Common.Tools.EntityFramework;
+
+[PublicAPI]
+[Serializable]
+public abstract class EntityFrameworkSettings : ToolSettings
+{
+ protected string GetProcessToolPath()
+ {
+ return EntityFrameworkTasks.GetToolPath();
+ }
+}
diff --git a/source/Nuke.Common/Tools/EntityFramework/EntityFrameworkTasks.cs b/source/Nuke.Common/Tools/EntityFramework/EntityFrameworkTasks.cs
new file mode 100644
index 000000000..fd72b2310
--- /dev/null
+++ b/source/Nuke.Common/Tools/EntityFramework/EntityFrameworkTasks.cs
@@ -0,0 +1,20 @@
+// Copyright 2024 Maintainers of NUKE.
+// Distributed under the MIT License.
+// https://github.com/nuke-build/nuke/blob/master/LICENSE
+
+using System;
+using System.Linq;
+using Nuke.Common.Tooling;
+
+namespace Nuke.Common.Tools.EntityFramework;
+
+partial class EntityFrameworkTasks
+{
+ internal static string GetToolPath(string framework = null)
+ {
+ return NuGetToolPathResolver.GetPackageExecutable(
+ packageId: "dotnet-ef",
+ packageExecutable: "dotnet-ef.dll|dotnet-ef.exe",
+ framework: framework);
+ }
+}
From 6d21f4303d7aa304b937ac5156d1784d8149e17a Mon Sep 17 00:00:00 2001
From: Marko Lahma
Date: Wed, 20 Mar 2024 03:50:31 +0200
Subject: [PATCH 13/56] feat(cicd): update GitHubActionsImage enum (#1325)
---
source/Nuke.Common/CI/GitHubActions/GitHubActionsImage.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/source/Nuke.Common/CI/GitHubActions/GitHubActionsImage.cs b/source/Nuke.Common/CI/GitHubActions/GitHubActionsImage.cs
index a0705dec8..03ae3cc74 100644
--- a/source/Nuke.Common/CI/GitHubActions/GitHubActionsImage.cs
+++ b/source/Nuke.Common/CI/GitHubActions/GitHubActionsImage.cs
@@ -20,6 +20,7 @@ public enum GitHubActionsImage
[EnumValue("ubuntu-22.04")] Ubuntu2204,
[EnumValue("ubuntu-20.04")] Ubuntu2004,
[EnumValue("ubuntu-18.04")] Ubuntu1804,
+ [EnumValue("macos-14")] MacOs14,
[EnumValue("macos-12")] MacOs12,
[EnumValue("macos-11")] MacOs11,
[EnumValue("macos-10.15")] MacOs1015,
From d87fc6b8839270085b2db4065d06d4e3ae8c2c6e Mon Sep 17 00:00:00 2001
From: Amadeusz Sadowski
Date: Wed, 20 Mar 2024 02:52:20 +0100
Subject: [PATCH 14/56] chore: upgrade Octokit to v9.1.1 (#1318)
---
source/Nuke.Common/Nuke.Common.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source/Nuke.Common/Nuke.Common.csproj b/source/Nuke.Common/Nuke.Common.csproj
index a1a6a9c52..0a45af6b9 100644
--- a/source/Nuke.Common/Nuke.Common.csproj
+++ b/source/Nuke.Common/Nuke.Common.csproj
@@ -27,7 +27,7 @@
-
+
From 91516c1e62bdee7fe78c06bec204cb834e5af2ae Mon Sep 17 00:00:00 2001
From: Christian Klemm
Date: Wed, 20 Mar 2024 02:54:10 +0100
Subject: [PATCH 15/56] fix(cicd): missing parameters for
AzurePipelines.SetVariable (#1316)
---
source/Nuke.Common/CI/AzurePipelines/AzurePipelines.cs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/source/Nuke.Common/CI/AzurePipelines/AzurePipelines.cs b/source/Nuke.Common/CI/AzurePipelines/AzurePipelines.cs
index 4701a441d..e82cd11c9 100644
--- a/source/Nuke.Common/CI/AzurePipelines/AzurePipelines.cs
+++ b/source/Nuke.Common/CI/AzurePipelines/AzurePipelines.cs
@@ -205,14 +205,16 @@ public void LogIssue(
.AddPairWhenValueNotNull("code", code));
}
- public void SetVariable(string name, string value, bool? isSecret = null)
+ public void SetVariable(string name, string value, bool? isSecret = null, bool? isOutput = null, bool? isReadOnly = null)
{
WriteCommand(
"task.setvariable",
value,
dictionaryConfigurator: x => x
.AddPair("variable", name)
- .AddPairWhenValueNotNull("issecret", isSecret));
+ .AddPairWhenValueNotNull("issecret", isSecret)
+ .AddPairWhenValueNotNull("isoutput", isOutput)
+ .AddPairWhenValueNotNull("isreadonly", isReadOnly));
}
private string GetText(AzurePipelinesIssueType type)
From 85655ddf8f2060c71a8e4a8b06bb5b0fda621e28 Mon Sep 17 00:00:00 2001
From: ITaluone <44049228+ITaluone@users.noreply.github.com>
Date: Wed, 20 Mar 2024 03:04:57 +0100
Subject: [PATCH 16/56] feat(tooling): add AddUnixSymlink extension (#1309)
---
source/Nuke.Tooling/ToolingExtensions.cs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/source/Nuke.Tooling/ToolingExtensions.cs b/source/Nuke.Tooling/ToolingExtensions.cs
index 86ae0f568..5a976b291 100644
--- a/source/Nuke.Tooling/ToolingExtensions.cs
+++ b/source/Nuke.Tooling/ToolingExtensions.cs
@@ -32,6 +32,14 @@ public static AbsolutePath SetExecutable(this AbsolutePath path, bool updateVcsI
return path;
}
+ public static AbsolutePath AddUnixSymlink(this AbsolutePath path, AbsolutePath linkPath, bool force = false)
+ {
+ if (EnvironmentInfo.IsUnix)
+ ProcessTasks.StartProcess("ln", $"-s{(force ? "f" : "")} {path} {linkPath}", logInvocation: false, logOutput: false);
+
+ return path;
+ }
+
public static AbsolutePath SetUnixPermissions(this AbsolutePath path, string permissions)
{
if (EnvironmentInfo.IsUnix)
From b74711517e3e063fc2471e335c65b5e665f5b2a9 Mon Sep 17 00:00:00 2001
From: ITaluone <44049228+ITaluone@users.noreply.github.com>
Date: Wed, 20 Mar 2024 03:14:56 +0100
Subject: [PATCH 17/56] fix(tools): missing DotNetTasks arguments (#1314)
---
source/Nuke.Common/Tools/DotNet/DotNet.json | 24 +++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/source/Nuke.Common/Tools/DotNet/DotNet.json b/source/Nuke.Common/Tools/DotNet/DotNet.json
index 0442d6fea..e59216b7c 100644
--- a/source/Nuke.Common/Tools/DotNet/DotNet.json
+++ b/source/Nuke.Common/Tools/DotNet/DotNet.json
@@ -1202,6 +1202,12 @@
"format": "--skip-manifest-update",
"help": "Skip updating the workload manifests. The workload manifests define what assets and versions need to be installed for each workload."
},
+ {
+ "name": "SkipSignCheck",
+ "type": "bool",
+ "format": "--skip-sign-check",
+ "help": "Skipping the nuget package signature verification."
+ },
{
"name": "Source",
"type": "string",
@@ -1294,6 +1300,12 @@
"format": "--skip-manifest-update",
"help": "Skip updating the workload manifests. The workload manifests define what assets and versions need to be installed for each workload."
},
+ {
+ "name": "SkipSignCheck",
+ "type": "bool",
+ "format": "--skip-sign-check",
+ "help": "Skipping the nuget package signature verification."
+ },
{
"name": "Source",
"type": "string",
@@ -1370,6 +1382,12 @@
"format": "--no-cache",
"help": "Prevents caching of packages and http requests."
},
+ {
+ "name": "SkipSignCheck",
+ "type": "bool",
+ "format": "--skip-sign-check",
+ "help": "Skipping the nuget package signature verification."
+ },
{
"name": "Source",
"type": "string",
@@ -1434,6 +1452,12 @@
"format": "--no-cache",
"help": "Prevents caching of packages and http requests."
},
+ {
+ "name": "SkipSignCheck",
+ "type": "bool",
+ "format": "--skip-sign-check",
+ "help": "Skipping the nuget package signature verification."
+ },
{
"name": "Source",
"type": "string",
From b081057dd69add2992b4cc7a729e045b48ca672d Mon Sep 17 00:00:00 2001
From: Matthias Koch
Date: Thu, 21 Mar 2024 08:26:50 +0100
Subject: [PATCH 18/56] Update CONTRIBUTING.md
---
CONTRIBUTING.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 561e2cc95..dfa69c59d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -54,6 +54,7 @@ Evaluate whether your topic is going to be a valid issue:
- Have you checked the [FAQ](https://nuke.build/faq/)?
- Is your issue more of a question? Ask on [GitHub discussions](https://github.com/nuke-build/nuke/discussions), [Slack](https://nuke.build/slack), or [Discord](https://nuke.build/discord)!
- Have you checked existing/closed issues? Is your version behind?
+- Have you read the relevant [changelog notes](https://github.com/nuke-build/nuke/blob/develop/CHANGELOG.md)?
- Have you verified it's not an external tool issue? Invoke the command manually!
- Don't file issues for tool wrappers. Send a pull request instead!
- Refrain from debating the governance or state of the project out of your own interests (see [consumer expectations](#consumer-expectations) & [sustainability contributions](#sustainability-contributions))
From 540c5aac79321ee708bee3fa6e1242651ab840f9 Mon Sep 17 00:00:00 2001
From: Matthias Koch
Date: Sun, 31 Mar 2024 04:10:42 +0200
Subject: [PATCH 19/56] feat(utilities): implement AbsolutePath copy/move
---
source/Nuke.Common/IO/FileSystemTasks.cs | 9 +
.../IO/FileSystemDependentTest.cs | 2 +-
.../Nuke.Utilities.Tests/IO/MoveCopyTest.cs | 135 +++++++++++
.../Collections/Enumerable.WhereNotNull.cs | 9 +
.../IO/AbsolutePath.MoveCopy.cs | 226 ++++++++++++++++--
5 files changed, 359 insertions(+), 22 deletions(-)
create mode 100644 source/Nuke.Utilities.Tests/IO/MoveCopyTest.cs
diff --git a/source/Nuke.Common/IO/FileSystemTasks.cs b/source/Nuke.Common/IO/FileSystemTasks.cs
index 48e9c24d4..a2062784f 100644
--- a/source/Nuke.Common/IO/FileSystemTasks.cs
+++ b/source/Nuke.Common/IO/FileSystemTasks.cs
@@ -188,6 +188,7 @@ public static void DeleteFile(string file)
File.Delete(file);
}
+ [Obsolete($"Use {nameof(AbsolutePath)}.{nameof(AbsolutePathExtensions.Copy)}")]
public static void CopyFile(AbsolutePath source, AbsolutePath target, FileExistsPolicy policy = FileExistsPolicy.Fail, bool createDirectories = true)
{
if (!ShouldCopyFile(source, target, policy))
@@ -200,6 +201,7 @@ public static void CopyFile(AbsolutePath source, AbsolutePath target, FileExists
File.Copy(source, target, overwrite: true);
}
+ [Obsolete($"Use {nameof(AbsolutePath)}.{nameof(AbsolutePathExtensions.CopyToDirectory)}")]
public static void CopyFileToDirectory(
AbsolutePath source,
AbsolutePath targetDirectory,
@@ -209,6 +211,7 @@ public static void CopyFileToDirectory(
CopyFile(source, Path.Combine(targetDirectory, Path.GetFileName(source).NotNull()), policy, createDirectories);
}
+ [Obsolete($"Use {nameof(AbsolutePath)}.{nameof(AbsolutePathExtensions.Move)}")]
public static void MoveFile(AbsolutePath source, AbsolutePath target, FileExistsPolicy policy = FileExistsPolicy.Fail, bool createDirectories = true)
{
if (!ShouldCopyFile(source, target, policy))
@@ -224,6 +227,7 @@ public static void MoveFile(AbsolutePath source, AbsolutePath target, FileExists
File.Move(source, target);
}
+ [Obsolete($"Use {nameof(AbsolutePath)}.{nameof(AbsolutePathExtensions.MoveToDirectory)}")]
public static void MoveFileToDirectory(
AbsolutePath source,
AbsolutePath targetDirectory,
@@ -233,6 +237,7 @@ public static void MoveFileToDirectory(
MoveFile(source, Path.Combine(targetDirectory, Path.GetFileName(source).NotNull()), policy, createDirectories);
}
+ [Obsolete($"Use {nameof(AbsolutePath)}.{nameof(AbsolutePathExtensions.Rename)}")]
public static void RenameFile(AbsolutePath file, string newName, FileExistsPolicy policy = FileExistsPolicy.Fail)
{
if (Path.GetFileName(file) == newName)
@@ -241,6 +246,7 @@ public static void RenameFile(AbsolutePath file, string newName, FileExistsPolic
MoveFile(file, Path.Combine(Path.GetDirectoryName(file).NotNull(), newName), policy);
}
+ [Obsolete($"Use {nameof(AbsolutePath)}.{nameof(AbsolutePathExtensions.Move)}")]
public static void MoveDirectory(
AbsolutePath source,
AbsolutePath target,
@@ -264,6 +270,7 @@ public static void MoveDirectory(
}
}
+ [Obsolete($"Use {nameof(AbsolutePath)}.{nameof(AbsolutePathExtensions.MoveToDirectory)}")]
public static void MoveDirectoryToDirectory(
AbsolutePath source,
AbsolutePath targetDirectory,
@@ -273,6 +280,7 @@ public static void MoveDirectoryToDirectory(
MoveDirectory(source, Path.Combine(targetDirectory, new DirectoryInfo(source).Name), directoryPolicy, filePolicy);
}
+ [Obsolete($"Use {nameof(AbsolutePath)}.{nameof(AbsolutePathExtensions.Rename)}")]
public static void RenameDirectory(
string directory,
string newName,
@@ -282,6 +290,7 @@ public static void RenameDirectory(
MoveDirectory(directory, Path.Combine(Path.GetDirectoryName(directory).NotNull(), newName), directoryPolicy, filePolicy);
}
+ [Obsolete($"Use {nameof(AbsolutePath)}.{nameof(AbsolutePathExtensions.Copy)}")]
public static void CopyDirectoryRecursively(
AbsolutePath source,
AbsolutePath target,
diff --git a/source/Nuke.Utilities.Tests/IO/FileSystemDependentTest.cs b/source/Nuke.Utilities.Tests/IO/FileSystemDependentTest.cs
index 927d2dce1..8e721a507 100644
--- a/source/Nuke.Utilities.Tests/IO/FileSystemDependentTest.cs
+++ b/source/Nuke.Utilities.Tests/IO/FileSystemDependentTest.cs
@@ -32,7 +32,7 @@ protected FileSystemDependentTest(ITestOutputHelper testOutputHelper)
ExecutionDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location).NotNull();
RootDirectory = Constants.TryGetRootDirectoryFrom(EnvironmentInfo.WorkingDirectory);
TestProjectDirectory = ExecutionDirectory.FindParentOrSelf(x => x.ContainsFile("*.csproj"));
- TestTempDirectory = ExecutionDirectory / "temp" / $"{GetType().Name}.{TestName}";
+ TestTempDirectory = ExecutionDirectory / "temp" / $"{GetType().Name}.{TestName}";
TestTempDirectory.CreateOrCleanDirectory();
}
diff --git a/source/Nuke.Utilities.Tests/IO/MoveCopyTest.cs b/source/Nuke.Utilities.Tests/IO/MoveCopyTest.cs
new file mode 100644
index 000000000..85f1c74b2
--- /dev/null
+++ b/source/Nuke.Utilities.Tests/IO/MoveCopyTest.cs
@@ -0,0 +1,135 @@
+// Copyright 2024 Maintainers of NUKE.
+// Distributed under the MIT License.
+// https://github.com/nuke-build/nuke/blob/master/LICENSE
+
+using System;
+using System.Linq;
+using FluentAssertions;
+using Nuke.Common.IO;
+using Nuke.Common.Utilities.Collections;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace Nuke.Common.Tests;
+
+public class MoveCopyTest : FileSystemDependentTest
+{
+ public MoveCopyTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
+ {
+ AbsolutePathExtensions.DefaultEofLineBreak = false;
+ }
+
+ [Fact]
+ public void TestCopyFile()
+ {
+ var source = TestTempDirectory / "source.txt";
+ source.WriteAllText("foobar");
+
+ var target = TestTempDirectory / "target.txt";
+ source.Copy(target);
+
+ target.FileExists().Should().BeTrue();
+
+ new Action(() => source.Copy(target))
+ .Should().Throw().WithMessage("* already exists");
+
+ new Action(() => source.Copy(target, policy: ExistsPolicy.FileFail | ExistsPolicy.FileOverwrite))
+ .Should().Throw().WithMessage("Multiple file policies *");
+
+ source.WriteAllText("fizzbuzz");
+ source.Copy(target, policy: ExistsPolicy.FileOverwrite)
+ .Should().Be(target);
+ target.ReadAllText().Should().Be("fizzbuzz");
+ }
+
+ [Fact]
+ public void TestMoveFile()
+ {
+ var source1 = (TestTempDirectory / "source1.txt").TouchFile();
+ var source2 = (TestTempDirectory / "source2.txt").TouchFile();
+ var source3 = (TestTempDirectory / "source3.txt").TouchFile();
+
+ var target = TestTempDirectory / "target.txt";
+ source2.Move(target);
+
+ target.FileExists().Should().BeTrue();
+ source2.FileExists().Should().BeFalse();
+
+ new Action(() => source1.Move(target, policy: ExistsPolicy.FileFail))
+ .Should().Throw().WithMessage("* already exists");
+
+ source1.Move(target, policy: ExistsPolicy.FileSkip).Should().Be(source1);
+ source1.Move(target, policy: ExistsPolicy.FileOverwriteIfNewer).Should().Be(source1);
+
+ source3.TouchFile();
+ source3.Move(target, policy: ExistsPolicy.FileOverwriteIfNewer).Should().Be(target);
+ }
+
+ [Fact]
+ public void TestCopyDirectory()
+ {
+ var source = TestTempDirectory / "source";
+ var sourceFiles = new[]
+ {
+ source / "source1.txt",
+ source / "source2.txt",
+ source / "sub" / "source3.txt",
+ source / "sub" / "source4.txt",
+ };
+ sourceFiles.ForEach(x => x.WriteAllText("source"));
+
+ var target = TestTempDirectory / "target";
+ source.Copy(target);
+ target.GetFiles(depth: int.MaxValue).Select(x => target.GetRelativePathTo(x).ToString())
+ .Should().BeEquivalentTo(sourceFiles.Select(x => source.GetRelativePathTo(x).ToString()));
+
+ target.CreateOrCleanDirectory();
+ var target0 = (target / "source0.txt").TouchFile();
+ var target3 = (target / "sub" / "source3.txt").WriteAllText("target");
+ var target4 = (target / "sub" / "source4.txt").WriteAllText("target");
+ (source / target.GetRelativePathTo(target4)).TouchFile();
+
+ new Action(() => source.Copy(target, ExistsPolicy.DirectoryFail))
+ .Should().Throw().WithMessage("Policy disallows merging directories");
+ target.GetFiles(depth: int.MaxValue).Should().HaveCount(3);
+
+ source.Copy(target, ExistsPolicy.MergeAndSkip);
+ target0.FileExists().Should().BeTrue();
+ target3.ReadAllText().Should().Be("target");
+ target4.ReadAllText().Should().Be("target");
+
+ source.Copy(target, ExistsPolicy.MergeAndOverwriteIfNewer);
+ target3.ReadAllText().Should().Be("target");
+ target4.ReadAllText().Should().Be("source");
+
+ source.Copy(target, ExistsPolicy.MergeAndOverwrite);
+ target3.ReadAllText().Should().Be("source");
+ }
+
+ [Fact]
+ public void TestMoveDirectory()
+ {
+ var source = TestTempDirectory / "source";
+ var sourceFiles = new[]
+ {
+ source / "source1.txt",
+ source / "source2.txt",
+ source / "sub" / "source3.txt",
+ source / "sub" / "source4.txt",
+ };
+ sourceFiles.ForEach(x => x.WriteAllText("source"));
+
+ var target = TestTempDirectory / "target";
+ (target / "source1.txt").TouchFile();
+ (target / "sub" / "source3.txt").TouchFile();
+
+ new Action(() => source.Move(target)).Should().Throw();
+
+ source.Move(target, ExistsPolicy.MergeAndSkip);
+ source.GetFiles(depth: int.MaxValue).Should().HaveCount(2);
+
+ source.Move(target, ExistsPolicy.MergeAndSkip, deleteRemainingFiles: true)
+ .Should().Be(target);
+ source.DirectoryExists().Should().BeFalse();
+ }
+}
diff --git a/source/Nuke.Utilities/Collections/Enumerable.WhereNotNull.cs b/source/Nuke.Utilities/Collections/Enumerable.WhereNotNull.cs
index 7e480da59..4ee4180ae 100644
--- a/source/Nuke.Utilities/Collections/Enumerable.WhereNotNull.cs
+++ b/source/Nuke.Utilities/Collections/Enumerable.WhereNotNull.cs
@@ -18,4 +18,13 @@ public static IEnumerable WhereNotNull(this IEnumerable enumerable)
{
return enumerable.Where(x => x != null);
}
+
+ ///
+ /// Filters the collection to elements that don't meet the condition.
+ ///
+ public static IEnumerable WhereNot(this IEnumerable enumerable, Func condition)
+ where T : class
+ {
+ return enumerable.Where(x => condition == null || !condition(x));
+ }
}
diff --git a/source/Nuke.Utilities/IO/AbsolutePath.MoveCopy.cs b/source/Nuke.Utilities/IO/AbsolutePath.MoveCopy.cs
index 7535a7a54..f7fb7c9f8 100644
--- a/source/Nuke.Utilities/IO/AbsolutePath.MoveCopy.cs
+++ b/source/Nuke.Utilities/IO/AbsolutePath.MoveCopy.cs
@@ -4,73 +4,257 @@
using System;
using System.IO;
+using System.Linq;
+using Nuke.Common.Utilities.Collections;
namespace Nuke.Common.IO;
+[Flags]
+public enum ExistsPolicy
+{
+ DirectoryFail = 1,
+ DirectoryMerge = 2,
+ FileFail = 4,
+ FileSkip = 8,
+ FileOverwrite = 16,
+ FileOverwriteIfNewer = 32,
+
+ Fail = DirectoryFail | FileFail,
+ MergeAndSkip = DirectoryMerge | FileSkip,
+ MergeAndOverwrite = DirectoryMerge | FileOverwrite,
+ MergeAndOverwriteIfNewer = DirectoryMerge | FileOverwriteIfNewer
+}
+
partial class AbsolutePathExtensions
{
///
/// Renames the file or directory.
///
- public static AbsolutePath Rename(this AbsolutePath path, string newName)
+ public static AbsolutePath Rename(
+ this AbsolutePath source,
+ string newName,
+ ExistsPolicy policy = ExistsPolicy.Fail)
{
- return path.Move(path.Parent / newName);
+ return source.Move(source.Parent / newName, policy);
}
///
/// Renames the file or directory.
///
- public static AbsolutePath Rename(this AbsolutePath path, Func newName)
+ public static AbsolutePath Rename(
+ this AbsolutePath source,
+ Func newName,
+ ExistsPolicy policy = ExistsPolicy.Fail)
{
- return path.Rename(newName.Invoke(path));
+ return source.Rename(newName.Invoke(source), policy);
}
///
/// Renames the file without changing the extension.
///
- public static AbsolutePath RenameWithoutExtension(this AbsolutePath path, string newName)
+ public static AbsolutePath RenameWithoutExtension(
+ this AbsolutePath source,
+ string newName,
+ ExistsPolicy policy = ExistsPolicy.Fail)
{
- Assert.True(path.FileExists());
- return path.Move(path.Parent / newName + path.Extension);
+ return source.Move(source.Parent / newName + source.Extension, policy);
}
///
/// Renames the file without changing the extension.
///
- public static AbsolutePath RenameWithoutExtension(this AbsolutePath path, Func newName)
+ public static AbsolutePath RenameWithoutExtension(
+ this AbsolutePath source,
+ Func newName,
+ ExistsPolicy policy = ExistsPolicy.Fail)
{
- return path.RenameWithoutExtension(newName.Invoke(path));
+ return source.RenameWithoutExtension(newName.Invoke(source), policy);
}
///
/// Moves the file or directory to another directory.
///
- public static AbsolutePath MoveToDirectory(this AbsolutePath path, AbsolutePath directory)
+ public static AbsolutePath MoveToDirectory(
+ this AbsolutePath source,
+ AbsolutePath target,
+ ExistsPolicy policy = ExistsPolicy.Fail,
+ bool createDirectories = true)
{
- Assert.True(directory.Exists());
- return path.Move(directory / path.Name);
+ return source.Move(target / source.Name, policy, createDirectories);
+ }
+
+ ///
+ /// Copies the file or directory to another directory.
+ ///
+ public static AbsolutePath CopyToDirectory(
+ this AbsolutePath source,
+ AbsolutePath target,
+ ExistsPolicy policy = ExistsPolicy.Fail,
+ Func excludeDirectory = null,
+ Func excludeFile = null,
+ bool createDirectories = true)
+ {
+ return source.Copy(target / source.Name, policy, excludeDirectory, excludeFile, createDirectories);
}
///
/// Moves the file or directory.
///
- public static AbsolutePath Move(this AbsolutePath path, Func newPath)
+ public static AbsolutePath Move(
+ this AbsolutePath source,
+ Func newPath,
+ ExistsPolicy policy = ExistsPolicy.Fail,
+ bool createDirectories = true)
{
- return path.Move(newPath.Invoke(path));
+ return source.Move(newPath.Invoke(source), policy, createDirectories);
}
///
/// Moves the file or directory.
///
- public static AbsolutePath Move(this AbsolutePath path, AbsolutePath newPath)
+ public static AbsolutePath Move(
+ this AbsolutePath source,
+ AbsolutePath target,
+ ExistsPolicy policy = ExistsPolicy.Fail,
+ bool createDirectories = true,
+ bool deleteRemainingFiles = false)
+ {
+ Assert.True(source.DirectoryExists() || source.FileExists());
+
+ if (source.DirectoryExists())
+ return MoveDirectory(source, target, policy, createDirectories, deleteRemainingFiles);
+
+ if (source.FileExists())
+ return MoveFile(source, target, policy, createDirectories);
+
+ throw new Exception("Unreachable");
+ }
+
+ ///
+ /// Copies the file or directory.
+ ///
+ public static AbsolutePath Copy(
+ this AbsolutePath source,
+ AbsolutePath target,
+ ExistsPolicy policy = ExistsPolicy.Fail,
+ Func excludeDirectory = null,
+ Func excludeFile = null,
+ bool createDirectories = true)
+ {
+ Assert.True(source.DirectoryExists() || source.FileExists());
+
+ if (source.DirectoryExists())
+ return CopyDirectory(source, target, policy, excludeDirectory, excludeFile, createDirectories);
+
+ if (source.FileExists())
+ return CopyFile(source, target, policy, createDirectories);
+
+ throw new Exception("Unreachable");
+ }
+
+ private static AbsolutePath MoveFile(
+ this AbsolutePath source,
+ AbsolutePath target,
+ ExistsPolicy policy = ExistsPolicy.Fail,
+ bool createDirectories = true)
+ {
+ return HandleFile(source, target, policy, createDirectories, () =>
+ {
+ target.DeleteFile();
+ File.Move(source, target);
+ });
+ }
+
+ private static AbsolutePath CopyFile(
+ this AbsolutePath source,
+ AbsolutePath target,
+ ExistsPolicy policy = ExistsPolicy.Fail,
+ bool createDirectories = true)
+ {
+ return HandleFile(source, target, policy, createDirectories, () =>
+ {
+ File.Copy(source, target, overwrite: true);
+ });
+ }
+
+ private static AbsolutePath HandleFile(
+ AbsolutePath source,
+ AbsolutePath target,
+ ExistsPolicy policy,
+ bool createDirectories,
+ Action action)
+ {
+ if (File.Exists(target) && !Permitted())
+ return source;
+
+ if (createDirectories)
+ target.Parent.CreateDirectory();
+
+ action.Invoke();
+ return target;
+
+ bool Permitted()
+ {
+ var filePolicies = ExistsPolicy.FileFail | ExistsPolicy.FileSkip | ExistsPolicy.FileOverwrite | ExistsPolicy.FileOverwriteIfNewer;
+ return (policy & filePolicies) switch
+ {
+ ExistsPolicy.FileFail => throw new Exception($"File '{target}' already exists"),
+ ExistsPolicy.FileSkip => false,
+ ExistsPolicy.FileOverwrite => true,
+ ExistsPolicy.FileOverwriteIfNewer => File.GetLastWriteTimeUtc(target) < File.GetLastWriteTimeUtc(source),
+ _ => throw new ArgumentOutOfRangeException(nameof(policy), policy, message: "Multiple file policies set")
+ };
+ }
+ }
+
+ private static AbsolutePath MoveDirectory(
+ this AbsolutePath source,
+ AbsolutePath target,
+ ExistsPolicy policy = ExistsPolicy.Fail,
+ bool createDirectories = true,
+ bool deleteRemainingFiles = false)
+ {
+ return HandleDirectory(source, target, policy, createDirectories, () =>
+ {
+ source.GetDirectories().ForEach(x => x.MoveDirectory(target / source.GetRelativePathTo(x), policy));
+ source.GetFiles().ForEach(x => x.MoveFile(target / source.GetRelativePathTo(x), policy));
+
+ if (!source.ToDirectoryInfo().EnumerateFileSystemInfos().Any() || deleteRemainingFiles)
+ source.DeleteDirectory();
+ });
+ }
+
+ private static AbsolutePath CopyDirectory(
+ this AbsolutePath source,
+ AbsolutePath target,
+ ExistsPolicy policy = ExistsPolicy.Fail,
+ Func excludeDirectory = null,
+ Func excludeFile = null,
+ bool createDirectories = true)
+ {
+ return HandleDirectory(source, target, policy, createDirectories, () =>
+ {
+ source.GetDirectories().WhereNot(excludeDirectory).ForEach(x => x.CopyDirectory(target / source.GetRelativePathTo(x), policy, excludeDirectory, excludeFile));
+ source.GetFiles().WhereNot(excludeFile).ForEach(x => x.CopyFile(target / source.GetRelativePathTo(x), policy));
+ });
+ }
+
+ private static AbsolutePath HandleDirectory(
+ AbsolutePath source,
+ AbsolutePath target,
+ ExistsPolicy policy,
+ bool createDirectories,
+ Action action)
{
- Assert.True(path.DirectoryExists() || path.FileExists());
+ Assert.DirectoryExists(source);
+ Assert.False(source.Contains(target), $"Target directory '{target}' must not be in source directory '{source}'");
+ Assert.True(!Directory.Exists(target) || (policy.HasFlag(ExistsPolicy.DirectoryMerge) && !policy.HasFlag(ExistsPolicy.DirectoryFail)),
+ "Policy disallows merging directories");
- if (path.DirectoryExists())
- Directory.Move(path, newPath);
- else if (path.FileExists())
- File.Move(path, newPath);
+ if (createDirectories)
+ target.CreateDirectory();
- return path;
+ action.Invoke();
+ return target;
}
}
From 86fc7ca2a81cd4934497c12e61e1b5422fcd1779 Mon Sep 17 00:00:00 2001
From: Matthias Koch
Date: Sun, 31 Mar 2024 04:18:21 +0200
Subject: [PATCH 20/56] chore: update FileSystemTasks usages
---
build/Build.GlobalSolution.cs | 11 ++++-------
source/Nuke.Common/Tools/ReSharper/ReSharperTasks.cs | 8 +++-----
source/Nuke.Common/Utilities/TemplateUtility.cs | 10 ++--------
3 files changed, 9 insertions(+), 20 deletions(-)
diff --git a/build/Build.GlobalSolution.cs b/build/Build.GlobalSolution.cs
index c601c8838..4e2107570 100644
--- a/build/Build.GlobalSolution.cs
+++ b/build/Build.GlobalSolution.cs
@@ -15,7 +15,6 @@
using Nuke.Common.Utilities;
using Nuke.Utilities.Text.Yaml;
using static Nuke.Common.ControlFlow;
-using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.ProjectModel.SolutionModelTasks;
using static Nuke.Common.Tools.Git.GitTasks;
@@ -67,18 +66,16 @@ IEnumerable ExternalRepositories
if ((RootDirectory / $"{Solution.FileName}.DotSettings").FileExists())
{
- CopyFile(
- source: RootDirectory / $"{Solution.FileName}.DotSettings",
+ (RootDirectory / $"{Solution.FileName}.DotSettings").Copy(
target: RootDirectory / $"{global.FileName}.DotSettings",
- FileExistsPolicy.Overwrite);
+ policy: ExistsPolicy.FileOverwrite);
}
if ((RootDirectory / $"{Solution.FileName}.DotSettings.user").FileExists())
{
- CopyFile(
- source: RootDirectory / $"{Solution.FileName}.DotSettings.user",
+ (RootDirectory / $"{Solution.FileName}.DotSettings.user").Copy(
target: RootDirectory / $"{global.FileName}.DotSettings.user",
- FileExistsPolicy.Overwrite);
+ policy: ExistsPolicy.FileOverwrite);
}
});
}
diff --git a/source/Nuke.Common/Tools/ReSharper/ReSharperTasks.cs b/source/Nuke.Common/Tools/ReSharper/ReSharperTasks.cs
index 67b246bf3..23f8375b8 100644
--- a/source/Nuke.Common/Tools/ReSharper/ReSharperTasks.cs
+++ b/source/Nuke.Common/Tools/ReSharper/ReSharperTasks.cs
@@ -26,11 +26,9 @@ private static void PreProcess(ref T toolSettings) where T : ReSharperSetting
var wave = GetWave(toolSettings).NotNull("wave != null");
var shadowDirectory = GetShadowDirectory(toolSettings, wave);
- FileSystemTasks.CopyDirectoryRecursively(
- Path.GetDirectoryName(toolSettings.ProcessToolPath).NotNull(),
- shadowDirectory,
- DirectoryExistsPolicy.Merge,
- FileExistsPolicy.OverwriteIfNewer);
+ ((AbsolutePath)toolSettings.ProcessToolPath.NotNull()).Copy(
+ target: shadowDirectory,
+ policy: ExistsPolicy.MergeAndOverwriteIfNewer);
toolSettings.Plugins
.Select(x => (Plugin: x.Key, Version: x.Value == ReSharperPluginLatest ? null : x.Value))
diff --git a/source/Nuke.Common/Utilities/TemplateUtility.cs b/source/Nuke.Common/Utilities/TemplateUtility.cs
index f8fc14758..7dc604d5c 100644
--- a/source/Nuke.Common/Utilities/TemplateUtility.cs
+++ b/source/Nuke.Common/Utilities/TemplateUtility.cs
@@ -88,20 +88,14 @@ private static void FillTemplateDirectoryRecursivelyInternal(
FillTemplateFile(file, tokens);
if (ShouldMove(file))
- FileSystemTasks.RenameFile(file, file.Name.Replace(tokens), FileExistsPolicy.OverwriteIfNewer);
+ file.Rename(file.Name.Replace(tokens), ExistsPolicy.FileOverwriteIfNewer);
}
directory.GetDirectories()
.ForEach(x => FillTemplateDirectoryRecursivelyInternal(x, tokens, excludeDirectory, excludeFile));
if (ShouldMove(directory))
- {
- FileSystemTasks.RenameDirectory(
- directory,
- directory.Name.Replace(tokens),
- DirectoryExistsPolicy.Merge,
- FileExistsPolicy.OverwriteIfNewer);
- }
+ directory.Rename(directory.Name.Replace(tokens), ExistsPolicy.MergeAndOverwriteIfNewer);
}
public static void FillTemplateFile(
From f7cb58b9ff332e88ad0de20ee985287edc871be2 Mon Sep 17 00:00:00 2001
From: Matthias Koch
Date: Thu, 13 Jun 2024 01:16:25 +0200
Subject: [PATCH 21/56] build: update dependencies
---
source/Directory.Build.props | 14 +++++++-------
source/Nuke.Build.Shared/Nuke.Build.Shared.csproj | 2 +-
source/Nuke.Build.Tests/SchemaUtilityTest.cs | 1 -
source/Nuke.Build/Nuke.Build.csproj | 6 +++---
.../CI/ConfigurationGenerationTest.cs | 1 -
source/Nuke.Common.Tests/ChangelogTasksTest.cs | 1 -
source/Nuke.Common/Nuke.Common.csproj | 10 +++++-----
source/Nuke.Components/ISignPackages.cs | 4 ++--
.../Nuke.GlobalTool.Tests/CakeConversionTests.cs | 1 -
.../Nuke.GlobalTool.Tests.csproj | 2 +-
.../UpdateSolutionFileContentTests.cs | 1 -
source/Nuke.GlobalTool/Nuke.GlobalTool.csproj | 8 ++++----
source/Nuke.MSBuildTasks/Nuke.MSBuildTasks.csproj | 6 +++---
source/Nuke.ProjectModel.Tests/ProjectModelTest.cs | 2 +-
source/Nuke.ProjectModel/Nuke.ProjectModel.csproj | 2 +-
.../Nuke.SourceGenerators.Tests.csproj | 6 +++---
.../StronglyTypedSolutionGeneratorTest.cs | 1 -
.../Nuke.Tooling.Generator.csproj | 4 ++--
source/Nuke.Tooling/Nuke.Tooling.csproj | 4 ++--
.../Nuke.Utilities.Text.Yaml.csproj | 2 +-
20 files changed, 36 insertions(+), 42 deletions(-)
diff --git a/source/Directory.Build.props b/source/Directory.Build.props
index 11a271277..c67af9847 100644
--- a/source/Directory.Build.props
+++ b/source/Directory.Build.props
@@ -40,15 +40,15 @@
-
+
-
-
-
-
+
+
+
+
-
-
+
+
diff --git a/source/Nuke.Build.Shared/Nuke.Build.Shared.csproj b/source/Nuke.Build.Shared/Nuke.Build.Shared.csproj
index 12264e3bb..360fe16cb 100644
--- a/source/Nuke.Build.Shared/Nuke.Build.Shared.csproj
+++ b/source/Nuke.Build.Shared/Nuke.Build.Shared.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/source/Nuke.Build.Tests/SchemaUtilityTest.cs b/source/Nuke.Build.Tests/SchemaUtilityTest.cs
index 8befcc066..cb29d2472 100644
--- a/source/Nuke.Build.Tests/SchemaUtilityTest.cs
+++ b/source/Nuke.Build.Tests/SchemaUtilityTest.cs
@@ -13,7 +13,6 @@
namespace Nuke.Common.Tests;
-[UsesVerify]
public class SchemaUtilityTest
{
[Fact]
diff --git a/source/Nuke.Build/Nuke.Build.csproj b/source/Nuke.Build/Nuke.Build.csproj
index e5cc4b115..f30534e9c 100644
--- a/source/Nuke.Build/Nuke.Build.csproj
+++ b/source/Nuke.Build/Nuke.Build.csproj
@@ -17,11 +17,11 @@
-
+
-
+
-
+
diff --git a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs
index 8d3ffbbca..77d15ef7a 100644
--- a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs
+++ b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs
@@ -21,7 +21,6 @@
namespace Nuke.Common.Tests.CI;
-[UsesVerify]
public class ConfigurationGenerationTest
{
[Theory]
diff --git a/source/Nuke.Common.Tests/ChangelogTasksTest.cs b/source/Nuke.Common.Tests/ChangelogTasksTest.cs
index d6632f85a..46c7eb2e5 100644
--- a/source/Nuke.Common.Tests/ChangelogTasksTest.cs
+++ b/source/Nuke.Common.Tests/ChangelogTasksTest.cs
@@ -17,7 +17,6 @@
namespace Nuke.Common.Tests;
-[UsesVerify]
public class ChangelogTasksTest
{
private static AbsolutePath RootDirectory => Constants.TryGetRootDirectoryFrom(EnvironmentInfo.WorkingDirectory).NotNull();
diff --git a/source/Nuke.Common/Nuke.Common.csproj b/source/Nuke.Common/Nuke.Common.csproj
index 0a45af6b9..006c19995 100644
--- a/source/Nuke.Common/Nuke.Common.csproj
+++ b/source/Nuke.Common/Nuke.Common.csproj
@@ -23,11 +23,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/source/Nuke.Components/ISignPackages.cs b/source/Nuke.Components/ISignPackages.cs
index 94e85dafc..c0d288579 100644
--- a/source/Nuke.Components/ISignPackages.cs
+++ b/source/Nuke.Components/ISignPackages.cs
@@ -79,7 +79,7 @@ public interface ISignPackages : INukeBuild
.Executes(async () =>
{
SignPathRequestDirectory.CreateOrCleanDirectory();
- SignPathPackages.ForEach(x => CopyFileToDirectory(x, SignPathRequestDirectory));
+ SignPathPackages.ForEach(x => x.CopyToDirectory(SignPathRequestDirectory));
SignPathRequestDirectory.ZipTo(SignPathRequestArchive);
AppVeyor.PushArtifact(SignPathRequestArchive);
@@ -114,7 +114,7 @@ await DownloadSignedArtifactFromUrl(
x => Path.GetFileName(x),
x => Path.GetFileName(x),
(x, y) => (SignedPackage: x, UnsignedPackage: y))
- .ForEach(x => CopyFile(x.SignedPackage, x.UnsignedPackage, FileExistsPolicy.Overwrite));
+ .ForEach(x => x.SignedPackage.Copy(x.UnsignedPackage, ExistsPolicy.FileOverwrite));
}
});
}
diff --git a/source/Nuke.GlobalTool.Tests/CakeConversionTests.cs b/source/Nuke.GlobalTool.Tests/CakeConversionTests.cs
index 662693a89..a9a56d9c5 100644
--- a/source/Nuke.GlobalTool.Tests/CakeConversionTests.cs
+++ b/source/Nuke.GlobalTool.Tests/CakeConversionTests.cs
@@ -14,7 +14,6 @@
namespace Nuke.GlobalTool.Tests;
-[UsesVerify]
public class CakeConversionTests
{
private static AbsolutePath RootDirectory => Constants.TryGetRootDirectoryFrom(EnvironmentInfo.WorkingDirectory);
diff --git a/source/Nuke.GlobalTool.Tests/Nuke.GlobalTool.Tests.csproj b/source/Nuke.GlobalTool.Tests/Nuke.GlobalTool.Tests.csproj
index 3bedbf6c9..e1f8b45f4 100644
--- a/source/Nuke.GlobalTool.Tests/Nuke.GlobalTool.Tests.csproj
+++ b/source/Nuke.GlobalTool.Tests/Nuke.GlobalTool.Tests.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net8.0
diff --git a/source/Nuke.GlobalTool.Tests/UpdateSolutionFileContentTests.cs b/source/Nuke.GlobalTool.Tests/UpdateSolutionFileContentTests.cs
index 44219354a..fd0b985dd 100644
--- a/source/Nuke.GlobalTool.Tests/UpdateSolutionFileContentTests.cs
+++ b/source/Nuke.GlobalTool.Tests/UpdateSolutionFileContentTests.cs
@@ -11,7 +11,6 @@
namespace Nuke.GlobalTool.Tests;
-[UsesVerify]
public class UpdateSolutionFileContentTests
{
[Theory]
diff --git a/source/Nuke.GlobalTool/Nuke.GlobalTool.csproj b/source/Nuke.GlobalTool/Nuke.GlobalTool.csproj
index 9eb34e78b..0ecfb735b 100644
--- a/source/Nuke.GlobalTool/Nuke.GlobalTool.csproj
+++ b/source/Nuke.GlobalTool/Nuke.GlobalTool.csproj
@@ -2,7 +2,7 @@
Exe
- net6.0
+ net8.0LatestMajortruenuke
@@ -15,9 +15,9 @@
-
-
-
+
+
+
diff --git a/source/Nuke.MSBuildTasks/Nuke.MSBuildTasks.csproj b/source/Nuke.MSBuildTasks/Nuke.MSBuildTasks.csproj
index 57c0b11f8..09e9ae94c 100644
--- a/source/Nuke.MSBuildTasks/Nuke.MSBuildTasks.csproj
+++ b/source/Nuke.MSBuildTasks/Nuke.MSBuildTasks.csproj
@@ -11,13 +11,13 @@
-
+
-
-
+
+
diff --git a/source/Nuke.ProjectModel.Tests/ProjectModelTest.cs b/source/Nuke.ProjectModel.Tests/ProjectModelTest.cs
index 11b67ba1b..f50dbda4a 100644
--- a/source/Nuke.ProjectModel.Tests/ProjectModelTest.cs
+++ b/source/Nuke.ProjectModel.Tests/ProjectModelTest.cs
@@ -28,7 +28,7 @@ public void ProjectTest()
project.GetTargetFrameworks().Should().Equal("net6.0", "net7.0", "net8.0");
project.HasPackageReference("Microsoft.Build.Locator").Should().BeTrue();
- project.GetPackageReferenceVersion("Microsoft.Build.Locator").Should().Be("1.6.10");
+ project.GetPackageReferenceVersion("Microsoft.Build.Locator").Should().Be("1.7.8");
}
[Fact]
diff --git a/source/Nuke.ProjectModel/Nuke.ProjectModel.csproj b/source/Nuke.ProjectModel/Nuke.ProjectModel.csproj
index cf7b4233b..d3875675f 100644
--- a/source/Nuke.ProjectModel/Nuke.ProjectModel.csproj
+++ b/source/Nuke.ProjectModel/Nuke.ProjectModel.csproj
@@ -11,7 +11,7 @@
-
+
diff --git a/source/Nuke.SourceGenerators.Tests/Nuke.SourceGenerators.Tests.csproj b/source/Nuke.SourceGenerators.Tests/Nuke.SourceGenerators.Tests.csproj
index be392715b..906167b4e 100644
--- a/source/Nuke.SourceGenerators.Tests/Nuke.SourceGenerators.Tests.csproj
+++ b/source/Nuke.SourceGenerators.Tests/Nuke.SourceGenerators.Tests.csproj
@@ -12,10 +12,10 @@
-
-
+
+
-
+
diff --git a/source/Nuke.SourceGenerators.Tests/StronglyTypedSolutionGeneratorTest.cs b/source/Nuke.SourceGenerators.Tests/StronglyTypedSolutionGeneratorTest.cs
index 8a494b83a..35117882f 100644
--- a/source/Nuke.SourceGenerators.Tests/StronglyTypedSolutionGeneratorTest.cs
+++ b/source/Nuke.SourceGenerators.Tests/StronglyTypedSolutionGeneratorTest.cs
@@ -15,7 +15,6 @@
namespace Nuke.SourceGenerators.Tests;
-[UsesVerify]
public class StronglyTypedSolutionGeneratorTest
{
[Fact]
diff --git a/source/Nuke.Tooling.Generator/Nuke.Tooling.Generator.csproj b/source/Nuke.Tooling.Generator/Nuke.Tooling.Generator.csproj
index c4f4f730f..713acf1db 100644
--- a/source/Nuke.Tooling.Generator/Nuke.Tooling.Generator.csproj
+++ b/source/Nuke.Tooling.Generator/Nuke.Tooling.Generator.csproj
@@ -6,10 +6,10 @@
-
+
-
+
diff --git a/source/Nuke.Tooling/Nuke.Tooling.csproj b/source/Nuke.Tooling/Nuke.Tooling.csproj
index bc0de0ef9..002f32571 100644
--- a/source/Nuke.Tooling/Nuke.Tooling.csproj
+++ b/source/Nuke.Tooling/Nuke.Tooling.csproj
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/source/Nuke.Utilities.Text.Yaml/Nuke.Utilities.Text.Yaml.csproj b/source/Nuke.Utilities.Text.Yaml/Nuke.Utilities.Text.Yaml.csproj
index bc6efbcc0..1cd42cb3d 100644
--- a/source/Nuke.Utilities.Text.Yaml/Nuke.Utilities.Text.Yaml.csproj
+++ b/source/Nuke.Utilities.Text.Yaml/Nuke.Utilities.Text.Yaml.csproj
@@ -9,7 +9,7 @@
-
+
From 18efbd9836eff6d514bf975e2da07f605fa5c5e9 Mon Sep 17 00:00:00 2001
From: Matthias Koch
Date: Thu, 13 Jun 2024 01:30:47 +0200
Subject: [PATCH 22/56] fix(tooling): unquoting of multiple quoted arguments
---
source/Nuke.Tooling.Tests/ArgumentStringHandlerTest.cs | 1 +
source/Nuke.Tooling/ArgumentStringHandler.cs | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/source/Nuke.Tooling.Tests/ArgumentStringHandlerTest.cs b/source/Nuke.Tooling.Tests/ArgumentStringHandlerTest.cs
index be61ff664..394cee0a5 100644
--- a/source/Nuke.Tooling.Tests/ArgumentStringHandlerTest.cs
+++ b/source/Nuke.Tooling.Tests/ArgumentStringHandlerTest.cs
@@ -83,6 +83,7 @@ public void TestUnquote()
ArgsToString($"{"start end"}").Should().Be("start end");
ArgsToString($"start {"spaced end"}").Should().Be("start \"spaced end\"");
ArgsToString($"{"spaced start"} end").Should().Be("\"spaced start\" end");
+ ArgsToString($"{"spaced start"} {"spaced end"}").Should().Be("\"spaced start\" \"spaced end\"");
}
[Fact]
diff --git a/source/Nuke.Tooling/ArgumentStringHandler.cs b/source/Nuke.Tooling/ArgumentStringHandler.cs
index c85f86fc0..19f134f0e 100644
--- a/source/Nuke.Tooling/ArgumentStringHandler.cs
+++ b/source/Nuke.Tooling/ArgumentStringHandler.cs
@@ -80,7 +80,10 @@ public void AppendFormatted(IEnumerable paths, int alignmen
public string ToStringAndClear()
{
- return _builder.ToStringAndClear().TrimMatchingDoubleQuotes();
+ var value = _builder.ToStringAndClear();
+ return value.IndexOf(value: '"', startIndex: 1) == value.Length - 1
+ ? value.TrimMatchingDoubleQuotes()
+ : value;
}
public Func GetFilter()
From 0c1e1604d3cd6df4fb7c61b89b0c1b34ded394c6 Mon Sep 17 00:00:00 2001
From: Matthias Koch
Date: Thu, 13 Jun 2024 02:47:59 +0200
Subject: [PATCH 23/56] docs: add note about PackageDownload in global builds
---
docs/04-sharing/01-global-builds.md | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/docs/04-sharing/01-global-builds.md b/docs/04-sharing/01-global-builds.md
index 332cdc5ca..959a43b11 100644
--- a/docs/04-sharing/01-global-builds.md
+++ b/docs/04-sharing/01-global-builds.md
@@ -23,7 +23,22 @@ As a first step, you need to extend the build project file with the [necessary i
```
-Afterwards, the project can be packaged and deployed as usual:
+:::warning
+Note that `PackageDownload` can only be used in the .NET global tool project directly, since they [do not work transitively](https://github.com/NuGet/Home/wiki/%5BSpec%5D-PackageDownload-support#package-declaration). Alternatively, you can reference tools the old way via `PackageReference` and set the `ExcludeAssets` property:
+
+```xml
+
+
+
+
+
+
+
+```
+
+:::
+
+Afterward, the project can be packaged and deployed as usual:
```powershell
# terminal-command
From 8df380db6491e441f11a746b654ce52a7893b0cd Mon Sep 17 00:00:00 2001
From: Matthias Koch
Date: Thu, 13 Jun 2024 23:07:08 +0200
Subject: [PATCH 24/56] feat(common): use regex pattern for
LatestGitHubReleaseAttribute
---
build/Build.ReleaseImage.cs | 2 +-
.../LatestGitHubReleaseAttribute.cs | 24 +++++++++++++++++--
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/build/Build.ReleaseImage.cs b/build/Build.ReleaseImage.cs
index 703dc60f7..02ea6ae6d 100644
--- a/build/Build.ReleaseImage.cs
+++ b/build/Build.ReleaseImage.cs
@@ -20,7 +20,7 @@
partial class Build
{
- [LatestGitHubRelease("JetBrains/JetBrainsMono", TrimPrefix = true)]
+ [LatestGitHubRelease("JetBrains/JetBrainsMono")]
readonly string JetBrainsMonoVersion;
string[] FontDownloadUrls =>
diff --git a/source/Nuke.Common/Attributes/LatestGitHubReleaseAttribute.cs b/source/Nuke.Common/Attributes/LatestGitHubReleaseAttribute.cs
index bd4d2b219..66dd5d9b7 100644
--- a/source/Nuke.Common/Attributes/LatestGitHubReleaseAttribute.cs
+++ b/source/Nuke.Common/Attributes/LatestGitHubReleaseAttribute.cs
@@ -5,9 +5,12 @@
using System;
using System.Linq;
using System.Reflection;
+using System.Text.RegularExpressions;
using JetBrains.Annotations;
+using NuGet.Versioning;
using Nuke.Common.Git;
using Nuke.Common.Tools.GitHub;
+using Nuke.Common.Utilities;
using Nuke.Common.ValueInjection;
namespace Nuke.Common.Tooling;
@@ -23,11 +26,28 @@ public LatestGitHubReleaseAttribute(string identifier)
}
public bool IncludePrerelease { get; set; }
- public bool TrimPrefix { get; set; }
+ public bool UseTagName { get; set; }
+
+ [RegexPattern]
+ public string Pattern { get; set; } = @"v?(?\d+\.\d+(?:\.\d+)?(?:\.\d+)?(?:-\w+)?)";
public override object GetValue(MemberInfo member, object instance)
{
var repository = GitRepository.FromUrl($"https://github.com/{_identifier}");
- return repository.GetLatestRelease(IncludePrerelease, TrimPrefix).GetAwaiter().GetResult();
+ var releases = GitHubTasks.GitHubClient.Repository.Release
+ .GetAll(repository.GetGitHubOwner(), repository.GetGitHubName()).GetAwaiter().GetResult();
+ var versions = releases
+ .Select(x => Regex.Match((!UseTagName ? x.Name : x.TagName).NotNullOrWhiteSpace(), Pattern))
+ .Select(x => x.Groups["version"].Value)
+ .Select(NuGetVersion.Parse)
+ .OrderByDescending(x => x);
+
+ if (member.GetMemberType() == typeof(NuGetVersion[]))
+ return versions.ToArray();
+
+ var latestVersion = versions.FirstOrDefault(x => !x.IsPrerelease || IncludePrerelease);
+ return member.GetMemberType() == typeof(NuGetVersion)
+ ? latestVersion
+ : latestVersion?.ToString();
}
}
From eddef5ec4def4e65e529e3cc6ba382ccf56631b4 Mon Sep 17 00:00:00 2001
From: Marko Lahma
Date: Wed, 3 Jul 2024 19:29:39 +0300
Subject: [PATCH 25/56] feat(cicd): add filter and progress to
GitHubActionsAttribute (#1298)
---
...tribute=GitHubActionsAttribute.verified.txt | 12 +++++++++---
...tribute=GitHubActionsAttribute.verified.txt | 6 +++---
.../CI/ConfigurationGenerationTest.cs | 2 ++
.../Configuration/GitHubActionsCheckoutStep.cs | 10 ++++++++--
.../CI/GitHubActions/GitHubActionsAttribute.cs | 18 +++++++++++++++++-
5 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt
index baa10b88e..cba457564 100644
--- a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt
+++ b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt
@@ -53,11 +53,13 @@ jobs:
group: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
submodules: recursive
lfs: true
fetch-depth: 2
+ progress: false
+ filter: tree:0
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v4
with:
@@ -96,11 +98,13 @@ jobs:
group: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
submodules: recursive
lfs: true
fetch-depth: 2
+ progress: false
+ filter: tree:0
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v4
with:
@@ -139,11 +143,13 @@ jobs:
group: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
submodules: recursive
lfs: true
fetch-depth: 2
+ progress: false
+ filter: tree:0
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v4
with:
diff --git a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=simple-triggers_attribute=GitHubActionsAttribute.verified.txt b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=simple-triggers_attribute=GitHubActionsAttribute.verified.txt
index 740323d94..81771b54a 100644
--- a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=simple-triggers_attribute=GitHubActionsAttribute.verified.txt
+++ b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=simple-triggers_attribute=GitHubActionsAttribute.verified.txt
@@ -27,7 +27,7 @@ jobs:
name: macos-latest
runs-on: macos-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v4
with:
@@ -59,7 +59,7 @@ jobs:
name: ubuntu-latest
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v4
with:
@@ -91,7 +91,7 @@ jobs:
name: windows-latest
runs-on: windows-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v4
with:
diff --git a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs
index 77d15ef7a..e9fd9704f 100644
--- a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs
+++ b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs
@@ -156,6 +156,8 @@ public class TestBuild : NukeBuild
Submodules = GitHubActionsSubmodules.Recursive,
Lfs = true,
FetchDepth = 2,
+ Progress = false,
+ Filter = "tree:0",
TimeoutMinutes = 30,
JobConcurrencyCancelInProgress = true
}
diff --git a/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsCheckoutStep.cs b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsCheckoutStep.cs
index 213acf17d..269c08e30 100644
--- a/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsCheckoutStep.cs
+++ b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsCheckoutStep.cs
@@ -15,12 +15,14 @@ public class GitHubActionsCheckoutStep : GitHubActionsStep
public GitHubActionsSubmodules? Submodules { get; set; }
public bool? Lfs { get; set; }
public uint? FetchDepth { get; set; }
+ public bool? Progress { get; set; }
+ public string Filter { get; set; }
public override void Write(CustomFileWriter writer)
{
- writer.WriteLine("- uses: actions/checkout@v3");
+ writer.WriteLine("- uses: actions/checkout@v4");
- if (Submodules.HasValue || Lfs.HasValue || FetchDepth.HasValue)
+ if (Submodules.HasValue || Lfs.HasValue || FetchDepth.HasValue || Progress.HasValue || !Filter.IsNullOrWhiteSpace())
{
using (writer.Indent())
{
@@ -33,6 +35,10 @@ public override void Write(CustomFileWriter writer)
writer.WriteLine($"lfs: {Lfs.ToString().ToLowerInvariant()}");
if (FetchDepth.HasValue)
writer.WriteLine($"fetch-depth: {FetchDepth}");
+ if (Progress.HasValue)
+ writer.WriteLine($"progress: {Progress.ToString().ToLowerInvariant()}");
+ if (!Filter.IsNullOrWhiteSpace())
+ writer.WriteLine($"filter: {Filter}");
}
}
}
diff --git a/source/Nuke.Common/CI/GitHubActions/GitHubActionsAttribute.cs b/source/Nuke.Common/CI/GitHubActions/GitHubActionsAttribute.cs
index 497702c69..90c0a8ef5 100644
--- a/source/Nuke.Common/CI/GitHubActions/GitHubActionsAttribute.cs
+++ b/source/Nuke.Common/CI/GitHubActions/GitHubActionsAttribute.cs
@@ -28,6 +28,8 @@ public class GitHubActionsAttribute : ConfigurationAttributeBase
private GitHubActionsSubmodules? _submodules;
private bool? _lfs;
private uint? _fetchDepth;
+ private bool? _progress;
+ private string _filter;
public GitHubActionsAttribute(
string name,
@@ -98,6 +100,18 @@ public uint FetchDepth
get => throw new NotSupportedException();
}
+ public bool Progress
+ {
+ set => _progress = value;
+ get => throw new NotSupportedException();
+ }
+
+ public string Filter
+ {
+ set => _filter = value;
+ get => throw new NotSupportedException();
+ }
+
public override CustomFileWriter CreateWriter(StreamWriter streamWriter)
{
return new CustomFileWriter(streamWriter, indentationFactor: 2, commentPrefix: "#");
@@ -142,7 +156,9 @@ private IEnumerable GetSteps(GitHubActionsImage image, IReadO
{
Submodules = _submodules,
Lfs = _lfs,
- FetchDepth = _fetchDepth
+ FetchDepth = _fetchDepth,
+ Progress = _progress,
+ Filter = _filter
};
if (CacheKeyFiles.Any())
From 82ebfc036d6eb2e599c52c2250528ba44e109fe8 Mon Sep 17 00:00:00 2001
From: Marko Lahma
Date: Wed, 3 Jul 2024 19:31:58 +0300
Subject: [PATCH 26/56] feat(cicd): add ConcurrencyGroup and
ConcurrencyCancelInProgress to GitHubActionsAttribute (#1299)
---
...ribute=GitHubActionsAttribute.verified.txt | 10 +++++---
.../CI/ConfigurationGenerationTest.cs | 4 +++-
.../GitHubActionsConfiguration.cs | 24 +++++++++++++++++++
.../GitHubActions/GitHubActionsAttribute.cs | 5 ++++
4 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt
index cba457564..b134fb2bf 100644
--- a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt
+++ b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt
@@ -44,13 +44,17 @@ on:
schedule:
- cron: '* 0 * * *'
+concurrency:
+ group: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }}
+ cancel-in-progress: true
+
jobs:
macos-latest:
name: macos-latest
runs-on: macos-latest
timeout-minutes: 30
concurrency:
- group: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }}
+ group: custom-job-group
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
@@ -95,7 +99,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
concurrency:
- group: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }}
+ group: custom-job-group
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
@@ -140,7 +144,7 @@ jobs:
runs-on: windows-latest
timeout-minutes: 30
concurrency:
- group: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }}
+ group: custom-job-group
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
diff --git a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs
index e9fd9704f..43776b80d 100644
--- a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs
+++ b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs
@@ -159,7 +159,9 @@ public class TestBuild : NukeBuild
Progress = false,
Filter = "tree:0",
TimeoutMinutes = 30,
- JobConcurrencyCancelInProgress = true
+ ConcurrencyCancelInProgress = true,
+ JobConcurrencyCancelInProgress = true,
+ JobConcurrencyGroup = "custom-job-group"
}
);
diff --git a/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsConfiguration.cs b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsConfiguration.cs
index bd1425827..72359ed6c 100644
--- a/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsConfiguration.cs
+++ b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsConfiguration.cs
@@ -18,6 +18,8 @@ public class GitHubActionsConfiguration : ConfigurationEntity
public GitHubActionsTrigger[] ShortTriggers { get; set; }
public GitHubActionsDetailedTrigger[] DetailedTriggers { get; set; }
public (GitHubActionsPermissions Type, string Permission)[] Permissions { get; set; }
+ public string ConcurrencyGroup { get; set; }
+ public bool ConcurrencyCancelInProgress { get; set; }
public GitHubActionsJob[] Jobs { get; set; }
public override void Write(CustomFileWriter writer)
@@ -46,6 +48,28 @@ public override void Write(CustomFileWriter writer)
}
}
+ if (!ConcurrencyGroup.IsNullOrWhiteSpace() || ConcurrencyCancelInProgress)
+ {
+ writer.WriteLine();
+ writer.WriteLine("concurrency:");
+ using (writer.Indent())
+ {
+ var group = ConcurrencyGroup;
+ if (group.IsNullOrWhiteSpace())
+ {
+ // create a default value that only cancels in-progress runs of the same workflow
+ // we don't fall back to github.ref which would disable multiple runs in main/master which is usually what is wanted
+ group = "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }}";
+ }
+
+ writer.WriteLine($"group: {group}");
+ if (ConcurrencyCancelInProgress)
+ {
+ writer.WriteLine("cancel-in-progress: true");
+ }
+ }
+ }
+
writer.WriteLine();
writer.WriteLine("jobs:");
diff --git a/source/Nuke.Common/CI/GitHubActions/GitHubActionsAttribute.cs b/source/Nuke.Common/CI/GitHubActions/GitHubActionsAttribute.cs
index 90c0a8ef5..8aef0f6fd 100644
--- a/source/Nuke.Common/CI/GitHubActions/GitHubActionsAttribute.cs
+++ b/source/Nuke.Common/CI/GitHubActions/GitHubActionsAttribute.cs
@@ -77,6 +77,9 @@ public GitHubActionsAttribute(
public int TimeoutMinutes { get; set; }
+ public string ConcurrencyGroup { get; set; }
+ public bool ConcurrencyCancelInProgress { get; set; }
+
public string JobConcurrencyGroup { get; set; }
public bool JobConcurrencyCancelInProgress { get; set; }
@@ -126,6 +129,8 @@ public override ConfigurationEntity GetConfiguration(IReadOnlyCollection (x, "write"))
.Concat(ReadPermissions.Select(x => (x, "read"))).ToArray(),
+ ConcurrencyGroup = ConcurrencyGroup,
+ ConcurrencyCancelInProgress = ConcurrencyCancelInProgress,
Jobs = _images.Select(x => GetJobs(x, relevantTargets)).ToArray()
};
From 5d6b5746d9772c4b462bf7630e7ebfcacb2f69f1 Mon Sep 17 00:00:00 2001
From: Marko Lahma
Date: Wed, 3 Jul 2024 19:33:16 +0300
Subject: [PATCH 27/56] fix(cicd): add ubuntu-24.04 image for GitHubActions
(#1381)
---
source/Nuke.Common/CI/GitHubActions/GitHubActionsImage.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/source/Nuke.Common/CI/GitHubActions/GitHubActionsImage.cs b/source/Nuke.Common/CI/GitHubActions/GitHubActionsImage.cs
index 03ae3cc74..bb4e6f278 100644
--- a/source/Nuke.Common/CI/GitHubActions/GitHubActionsImage.cs
+++ b/source/Nuke.Common/CI/GitHubActions/GitHubActionsImage.cs
@@ -17,6 +17,7 @@ public enum GitHubActionsImage
{
[EnumValue("windows-2022")] WindowsServer2022,
[EnumValue("windows-2019")] WindowsServer2019,
+ [EnumValue("ubuntu-24.04")] Ubuntu2404,
[EnumValue("ubuntu-22.04")] Ubuntu2204,
[EnumValue("ubuntu-20.04")] Ubuntu2004,
[EnumValue("ubuntu-18.04")] Ubuntu1804,
From 6947b540c019abb72f09de5d17b5ab041a2178d1 Mon Sep 17 00:00:00 2001
From: Emmanuel Ferdman
Date: Wed, 3 Jul 2024 19:34:20 +0300
Subject: [PATCH 28/56] docs: fix links to files (#1366)
---
docs/01-getting-started/07-telemetry.md | 4 ++--
docs/06-global-tool/02-secrets.md | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/01-getting-started/07-telemetry.md b/docs/01-getting-started/07-telemetry.md
index a04a9df4c..6a7eadec3 100644
--- a/docs/01-getting-started/07-telemetry.md
+++ b/docs/01-getting-started/07-telemetry.md
@@ -33,7 +33,7 @@ Once you confirm the notice, NUKE will either:
## Scope
-As a global tool and library, NUKE has [multiple events](https://github.com/nuke-build/nuke/blob/master/source/Nuke.Common/Execution/Telemetry.Events.cs) where telemetry is collected:
+As a global tool and library, NUKE has [multiple events](https://github.com/nuke-build/nuke/blob/master/source/Nuke.Build/Telemetry/Telemetry.Events.cs) where telemetry is collected:
- `BuildStarted` – when a build was started
- `TargetSucceeded` – when a target succeeded (only `Restore`, `Compile`, `Test`)
@@ -46,7 +46,7 @@ Data for `BuildStarted` and `TargetSucceeded` is only collected when `IsServerBu
## Data Points
-The [telemetry data points](https://github.com/nuke-build/nuke/blob/master/source/Nuke.Common/Execution/Telemetry.Properties.cs) do not collect personal data, such as usernames or email addresses. The data is sent securely to Microsoft servers using [Azure Monitor](https://azure.microsoft.com/services/monitor/) technology, held under restricted access, and published under strict security controls from secure [Azure Storage](https://azure.microsoft.com/services/storage/) systems.
+The [telemetry data points](https://github.com/nuke-build/nuke/blob/master/source/Nuke.Build/Telemetry/Telemetry.Properties.cs) do not collect personal data, such as usernames or email addresses. The data is sent securely to Microsoft servers using [Azure Monitor](https://azure.microsoft.com/services/monitor/) technology, held under restricted access, and published under strict security controls from secure [Azure Storage](https://azure.microsoft.com/services/storage/) systems.
Protecting your privacy is important to us. If you suspect the telemetry is collecting sensitive data or the data is being insecurely or inappropriately handled, file an issue in the [nuke-build/nuke](https://github.com/nuke-build/nuke) repository or [email us](mailto:info@nuke.build?subject=Telemetry) for investigation.
diff --git a/docs/06-global-tool/02-secrets.md b/docs/06-global-tool/02-secrets.md
index e4ede5e80..c364e4aee 100644
--- a/docs/06-global-tool/02-secrets.md
+++ b/docs/06-global-tool/02-secrets.md
@@ -7,7 +7,7 @@ import AsciinemaPlayer from '@site/src/components/AsciinemaPlayer';
Historically, secret values like passwords or auth-tokens are often saved as environment variables on local machines or CI/CD servers. This imposes both, security issues because other processes can access these environment variables and inconveniences when a build must be executed locally for emergency reasons (server downtime). NUKE has an integrated encryption utility, which can be used to save and load secret values to and from [parameter files](../02-fundamentals/06-parameters.md#passing-values-through-parameter-files).
:::danger
-Our [custom encryption utility](https://github.com/nuke-build/nuke/blob/develop/source/Nuke.Common/Utilities/EncryptionUtility.cs) is provided "AS IS" without warranty of any kind.
+Our [custom encryption utility](https://github.com/nuke-build/nuke/blob/develop/source/Nuke.Utilities/Security/EncryptionUtility.cs) is provided "AS IS" without warranty of any kind.
The implementation uses your password, a static salt, 10.000 iterations, and SHA256 to generate a [key-derivation function](https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.rfc2898derivebytes) ([RFC2898](https://datatracker.ietf.org/doc/html/rfc2898)), which is then used to create a crypto-stream to encrypt and decrypt values via [Advanced Encryption Standard (AES)](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard).
From 3400b014f7f10bc31f23adfcbf7e542340824dc9 Mon Sep 17 00:00:00 2001
From: Stefan de Vogelaere
Date: Wed, 3 Jul 2024 18:45:18 +0200
Subject: [PATCH 29/56] feat(cicd): add EnvironmentName and EnvironmentUrl to
GitHubActionsAttribute (#1389)
---
...ribute=GitHubActionsAttribute.verified.txt | 9 +++++++++
.../CI/ConfigurationGenerationTest.cs | 6 +++++-
.../Configuration/GitHubActionsJob.cs | 19 +++++++++++++++++++
.../GitHubActions/GitHubActionsAttribute.cs | 5 +++++
4 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt
index b134fb2bf..697dd6e7c 100644
--- a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt
+++ b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.Test_testName=detailed-triggers_attribute=GitHubActionsAttribute.verified.txt
@@ -56,6 +56,9 @@ jobs:
concurrency:
group: custom-job-group
cancel-in-progress: true
+ environment:
+ name: environment-name
+ url: environment-url
steps:
- uses: actions/checkout@v4
with:
@@ -101,6 +104,9 @@ jobs:
concurrency:
group: custom-job-group
cancel-in-progress: true
+ environment:
+ name: environment-name
+ url: environment-url
steps:
- uses: actions/checkout@v4
with:
@@ -146,6 +152,9 @@ jobs:
concurrency:
group: custom-job-group
cancel-in-progress: true
+ environment:
+ name: environment-name
+ url: environment-url
steps:
- uses: actions/checkout@v4
with:
diff --git a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs
index 43776b80d..c8f5c3146 100644
--- a/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs
+++ b/source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs
@@ -8,6 +8,7 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
+using JetBrains.Annotations;
using Nuke.Common.CI;
using Nuke.Common.CI.AppVeyor;
using Nuke.Common.CI.AzurePipelines;
@@ -48,6 +49,7 @@ public static IEnumerable
///
///
<project> via
+ ///
--arch via
///
--configuration via
///
--disable-parallel via
///
--force via
@@ -873,6 +874,7 @@ public static IReadOnlyCollection
///
public static IReadOnlyCollection DotNetPublish(DotNetPublishSettings toolSettings = null)
@@ -899,6 +902,7 @@ public static IReadOnlyCollection DotNetPublish(DotNetPublishSettings to
///
@@ -913,6 +917,7 @@ public static IReadOnlyCollection DotNetPublish(DotNetPublishSettings to
///
--no-dependencies via
///
--no-restore via
///
--nologo via
+ ///
--os via
///
--output via
///
--packages via
///
--runtime via
@@ -922,6 +927,7 @@ public static IReadOnlyCollection DotNetPublish(DotNetPublishSettings to
///
--verbosity via
///
--version-suffix via
///
/property via
+ ///
/t via
///
///
public static IReadOnlyCollection DotNetPublish(Configure configurator)
@@ -936,6 +942,7 @@ public static IReadOnlyCollection DotNetPublish(ConfigureThis is a CLI wrapper with fluent API that allows to modify the following arguments:
///
///
<project> via
+ ///
--arch via
///
--configuration via
///
--disable-parallel via
///
--force via
@@ -950,6 +957,7 @@ public static IReadOnlyCollection DotNetPublish(Configure--no-dependencies via
///
--no-restore via
///
--nologo via
+ ///
--os via
///
--output via
///
--packages via
///
--runtime via
@@ -959,6 +967,7 @@ public static IReadOnlyCollection DotNetPublish(Configure--verbosity via
///
--version-suffix via
///
/property via
+ ///
/t via
///
///
public static IEnumerable<(DotNetPublishSettings Settings, IReadOnlyCollection Output)> DotNetPublish(CombinatorialConfigure configurator, int degreeOfParallelism = 1, bool completeOnFailure = false)
@@ -1430,6 +1439,7 @@ public static IReadOnlyCollection DotNetToolUpdate(Configure--interactive via
///
--no-cache via
///
--skip-manifest-update via
+ ///
--skip-sign-check via
///
--source via
///
--temp-dir via
///
--verbosity via
@@ -1457,6 +1467,7 @@ public static IReadOnlyCollection DotNetWorkloadInstall(DotNetWorkloadIn
///
--interactive via
///
--no-cache via
///
--skip-manifest-update via
+ ///
--skip-sign-check via
///
--source via
///
--temp-dir via
///
--verbosity via
@@ -1481,6 +1492,7 @@ public static IReadOnlyCollection DotNetWorkloadInstall(Configure--interactive via
///
--no-cache via
///
--skip-manifest-update via
+ ///
--skip-sign-check via
///
--source via
///
--temp-dir via
///
--verbosity via
@@ -1550,6 +1562,7 @@ public static IReadOnlyCollection DotNetWorkloadUninstall(Configure--interactive via
///
--no-cache via
///
--skip-manifest-update via
+ ///
--skip-sign-check via
///
--source via
///
--temp-dir via
///
--verbosity via
@@ -1577,6 +1590,7 @@ public static IReadOnlyCollection DotNetWorkloadRestore(DotNetWorkloadRe
///
--interactive via
///
--no-cache via
///
--skip-manifest-update via
+ ///
--skip-sign-check via
///
--source via
///
--temp-dir via
///
--verbosity via
@@ -1601,6 +1615,7 @@ public static IReadOnlyCollection DotNetWorkloadRestore(Configure--interactive via
///
--no-cache via
///
--skip-manifest-update via
+ ///
--skip-sign-check via
///
--source via
///
--temp-dir via
///
--verbosity via
@@ -1625,6 +1640,7 @@ public static IReadOnlyCollection DotNetWorkloadRestore(Configure--include-previews via
///
--interactive via
///
--no-cache via
+ ///
--skip-sign-check via
///
--source via
///
--temp-dir via
///
--verbosity via
@@ -1652,6 +1668,7 @@ public static IReadOnlyCollection DotNetWorkloadUpdate(DotNetWorkloadUpd
///
--include-previews via
///
--interactive via
///
--no-cache via
+ ///
--skip-sign-check via
///
--source via
///
--temp-dir via
///
--verbosity via
@@ -1676,6 +1693,7 @@ public static IReadOnlyCollection DotNetWorkloadUpdate(Configure--include-previews via
///
--interactive via
///
--no-cache via
+ ///
--skip-sign-check via
///
--source via
///
--temp-dir via
///
--verbosity via
@@ -1698,6 +1716,7 @@ public static IReadOnlyCollection DotNetWorkloadUpdate(Configure--include-previews via
///
--interactive via
///
--no-cache via
+ ///
--skip-sign-check via
///
--source via
///
--temp-dir via
///
--verbosity via
@@ -1723,6 +1742,7 @@ public static IReadOnlyCollection DotNetWorkloadRepair(DotNetWorkloadRep
///
--include-previews via
///
--interactive via
///
--no-cache via
+ ///
--skip-sign-check via
///
--source via
///
--temp-dir via
///
--verbosity via
@@ -1745,6 +1765,7 @@ public static IReadOnlyCollection DotNetWorkloadRepair(Configure--include-previews via
///
--interactive via
///
--no-cache via
+ ///
--skip-sign-check via
///
--source via
///
--temp-dir via
///
--verbosity via
@@ -2761,6 +2782,10 @@ public partial class DotNetPublishSettings : ToolSettings
///
public virtual string Project { get; internal set; }
///
+ /// Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --arch x86 sets the RID to win-x86. If you use this option, don't use the -r|--runtime option. Available since .NET 6 Preview 7.
+ ///
+ public virtual string Architecture { get; internal set; }
+ ///
/// Defines the build configuration. The default value is Debug.
///
public virtual string Configuration { get; internal set; }
@@ -2785,6 +2810,10 @@ public partial class DotNetPublishSettings : ToolSettings
///
public virtual string Output { get; internal set; }
///
+ /// Specifies the target operating system (OS). This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --os linux sets the RID to linux-x64. If you use this option, don't use the -r|--runtime option. Available since .NET 6.
+ ///
+ public virtual string OperatingSystem { get; internal set; }
+ ///
/// Publishes the .NET Core runtime with your application so the runtime doesn't need to be installed on the target machine. If a runtime identifier is specified, its default value is true. For more information about the different deployment types, see .NET Core application deployment.
///
public virtual bool? SelfContained { get; internal set; }
@@ -2805,6 +2834,11 @@ public partial class DotNetPublishSettings : ToolSettings
///
public virtual bool? NoLogo { get; internal set; }
///
+ ///
Build the specified targets in the project. Specify each target separately, or use a semicolon or comma to separate multiple targets, as the following example shows: /target:Resources;Compile
A target is a group of tasks. For more information, see Targets.
+ ///
+ public virtual IReadOnlyList Targets => TargetsInternal.AsReadOnly();
+ internal List TargetsInternal { get; set; } = new List();
+ ///
/// Disables restoring multiple projects in parallel.
///
public virtual bool? DisableParallel { get; internal set; }
@@ -2859,17 +2893,20 @@ protected override Arguments ConfigureProcessArguments(Arguments arguments)
arguments
.Add("publish")
.Add("{value}", Project)
+ .Add("--arch {value}", Architecture)
.Add("--configuration {value}", Configuration)
.Add("--framework {value}", Framework)
.Add("--manifest {value}", Manifest)
.Add("--no-restore", NoRestore)
.Add("--no-build", NoBuild)
.Add("--output {value}", Output)
+ .Add("--os {value}", OperatingSystem)
.Add("--self-contained {value}", SelfContained)
.Add("--runtime {value}", Runtime)
.Add("--verbosity {value}", Verbosity)
.Add("--version-suffix {value}", VersionSuffix)
.Add("--nologo", NoLogo)
+ .Add("/t:{value}", Targets, separator: ';')
.Add("--disable-parallel", DisableParallel)
.Add("--force", Force)
.Add("--ignore-failed-sources", IgnoreFailedSources)
@@ -3361,6 +3398,10 @@ public partial class DotNetWorkloadInstallSettings : ToolSettings
///
public virtual bool? SkipManifestUpdate { get; internal set; }
///
+ /// Skipping the nuget package signature verification.
+ ///
+ public virtual bool? SkipSignCheck { get; internal set; }
+ ///
/// Specifies the URI of the NuGet package source to use. This setting overrides all of the sources specified in the nuget.config files. Multiple sources can be provided by specifying this option multiple times.
///
public virtual string Source { get; internal set; }
@@ -3384,6 +3425,7 @@ protected override Arguments ConfigureProcessArguments(Arguments arguments)
.Add("--interactive", Interactive)
.Add("--no-cache", NoCache)
.Add("--skip-manifest-update", SkipManifestUpdate)
+ .Add("--skip-sign-check", SkipSignCheck)
.Add("--source {value}", Source)
.Add("--temp-dir {value}", TempDir)
.Add("--verbosity {value}", Verbosity);
@@ -3468,6 +3510,10 @@ public partial class DotNetWorkloadRestoreSettings : ToolSettings
///
public virtual bool? SkipManifestUpdate { get; internal set; }
///
+ /// Skipping the nuget package signature verification.
+ ///
+ public virtual bool? SkipSignCheck { get; internal set; }
+ ///
/// Specifies the URI of the NuGet package source to use. This setting overrides all of the sources specified in the nuget.config files. Multiple sources can be provided by specifying this option multiple times.
///
public virtual string Source { get; internal set; }
@@ -3491,6 +3537,7 @@ protected override Arguments ConfigureProcessArguments(Arguments arguments)
.Add("--interactive", Interactive)
.Add("--no-cache", NoCache)
.Add("--skip-manifest-update", SkipManifestUpdate)
+ .Add("--skip-sign-check", SkipSignCheck)
.Add("--source {value}", Source)
.Add("--temp-dir {value}", TempDir)
.Add("--verbosity {value}", Verbosity);
@@ -3546,6 +3593,10 @@ public partial class DotNetWorkloadUpdateSettings : ToolSettings
///
public virtual bool? NoCache { get; internal set; }
///
+ /// Skipping the nuget package signature verification.
+ ///
+ public virtual bool? SkipSignCheck { get; internal set; }
+ ///
/// Specifies the URI of the NuGet package source to use. This setting overrides all of the sources specified in the nuget.config files. Multiple sources can be provided by specifying this option multiple times.
///
public virtual string Source { get; internal set; }
@@ -3569,6 +3620,7 @@ protected override Arguments ConfigureProcessArguments(Arguments arguments)
.Add("--include-previews", IncludePreviews)
.Add("--interactive", Interactive)
.Add("--no-cache", NoCache)
+ .Add("--skip-sign-check", SkipSignCheck)
.Add("--source {value}", Source)
.Add("--temp-dir {value}", TempDir)
.Add("--verbosity {value}", Verbosity);
@@ -3616,6 +3668,10 @@ public partial class DotNetWorkloadRepairSettings : ToolSettings
///
public virtual bool? NoCache { get; internal set; }
///
+ /// Skipping the nuget package signature verification.
+ ///
+ public virtual bool? SkipSignCheck { get; internal set; }
+ ///
/// Specifies the URI of the NuGet package source to use. This setting overrides all of the sources specified in the nuget.config files. Multiple sources can be provided by specifying this option multiple times.
///
public virtual string Source { get; internal set; }
@@ -3637,6 +3693,7 @@ protected override Arguments ConfigureProcessArguments(Arguments arguments)
.Add("--include-previews", IncludePreviews)
.Add("--interactive", Interactive)
.Add("--no-cache", NoCache)
+ .Add("--skip-sign-check", SkipSignCheck)
.Add("--source {value}", Source)
.Add("--temp-dir {value}", TempDir)
.Add("--verbosity {value}", Verbosity);
@@ -19814,6 +19871,30 @@ public static T ResetProject(this T toolSettings) where T : DotNetPublishSett
return toolSettings;
}
#endregion
+ #region Architecture
+ ///
+ ///
Sets
+ ///
Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --arch x86 sets the RID to win-x86. If you use this option, don't use the -r|--runtime option. Available since .NET 6 Preview 7.
+ ///
+ [Pure]
+ public static T SetArchitecture(this T toolSettings, string architecture) where T : DotNetPublishSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.Architecture = architecture;
+ return toolSettings;
+ }
+ ///
+ ///
Resets
+ ///
Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --arch x86 sets the RID to win-x86. If you use this option, don't use the -r|--runtime option. Available since .NET 6 Preview 7.
+ ///
+ [Pure]
+ public static T ResetArchitecture(this T toolSettings) where T : DotNetPublishSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.Architecture = null;
+ return toolSettings;
+ }
+ #endregion
#region Configuration
///
///
Sets
@@ -20024,6 +20105,30 @@ public static T ResetOutput(this T toolSettings) where T : DotNetPublishSetti
return toolSettings;
}
#endregion
+ #region OperatingSystem
+ ///
+ ///
Sets
+ ///
Specifies the target operating system (OS). This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --os linux sets the RID to linux-x64. If you use this option, don't use the -r|--runtime option. Available since .NET 6.
+ ///
+ [Pure]
+ public static T SetOperatingSystem(this T toolSettings, string operatingSystem) where T : DotNetPublishSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.OperatingSystem = operatingSystem;
+ return toolSettings;
+ }
+ ///
+ ///
Resets
+ ///
Specifies the target operating system (OS). This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --os linux sets the RID to linux-x64. If you use this option, don't use the -r|--runtime option. Available since .NET 6.
+ ///
+ [Pure]
+ public static T ResetOperatingSystem(this T toolSettings) where T : DotNetPublishSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.OperatingSystem = null;
+ return toolSettings;
+ }
+ #endregion
#region SelfContained
///
///
Sets
@@ -20210,6 +20315,87 @@ public static T ToggleNoLogo(this T toolSettings) where T : DotNetPublishSett
return toolSettings;
}
#endregion
+ #region Targets
+ ///
+ ///
Sets to a new list
+ ///
Build the specified targets in the project. Specify each target separately, or use a semicolon or comma to separate multiple targets, as the following example shows: /target:Resources;Compile
A target is a group of tasks. For more information, see Targets.
+ ///
+ [Pure]
+ public static T SetTargets(this T toolSettings, params string[] targets) where T : DotNetPublishSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.TargetsInternal = targets.ToList();
+ return toolSettings;
+ }
+ ///
+ ///
Sets to a new list
+ ///
Build the specified targets in the project. Specify each target separately, or use a semicolon or comma to separate multiple targets, as the following example shows: /target:Resources;Compile
A target is a group of tasks. For more information, see Targets.
+ ///
+ [Pure]
+ public static T SetTargets(this T toolSettings, IEnumerable targets) where T : DotNetPublishSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.TargetsInternal = targets.ToList();
+ return toolSettings;
+ }
+ ///
+ ///
Adds values to
+ ///
Build the specified targets in the project. Specify each target separately, or use a semicolon or comma to separate multiple targets, as the following example shows: /target:Resources;Compile
A target is a group of tasks. For more information, see Targets.
+ ///
+ [Pure]
+ public static T AddTargets(this T toolSettings, params string[] targets) where T : DotNetPublishSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.TargetsInternal.AddRange(targets);
+ return toolSettings;
+ }
+ ///
+ ///
Adds values to
+ ///
Build the specified targets in the project. Specify each target separately, or use a semicolon or comma to separate multiple targets, as the following example shows: /target:Resources;Compile
A target is a group of tasks. For more information, see Targets.
+ ///
+ [Pure]
+ public static T AddTargets(this T toolSettings, IEnumerable targets) where T : DotNetPublishSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.TargetsInternal.AddRange(targets);
+ return toolSettings;
+ }
+ ///
+ ///
Clears
+ ///
Build the specified targets in the project. Specify each target separately, or use a semicolon or comma to separate multiple targets, as the following example shows: /target:Resources;Compile
A target is a group of tasks. For more information, see Targets.
+ ///
+ [Pure]
+ public static T ClearTargets(this T toolSettings) where T : DotNetPublishSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.TargetsInternal.Clear();
+ return toolSettings;
+ }
+ ///
+ ///
Removes values from
+ ///
Build the specified targets in the project. Specify each target separately, or use a semicolon or comma to separate multiple targets, as the following example shows: /target:Resources;Compile
A target is a group of tasks. For more information, see Targets.
+ ///
+ [Pure]
+ public static T RemoveTargets(this T toolSettings, params string[] targets) where T : DotNetPublishSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ var hashSet = new HashSet(targets);
+ toolSettings.TargetsInternal.RemoveAll(x => hashSet.Contains(x));
+ return toolSettings;
+ }
+ ///
+ ///
Removes values from
+ ///
Build the specified targets in the project. Specify each target separately, or use a semicolon or comma to separate multiple targets, as the following example shows: /target:Resources;Compile
A target is a group of tasks. For more information, see Targets.
+ ///
+ [Pure]
+ public static T RemoveTargets(this T toolSettings, IEnumerable targets) where T : DotNetPublishSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ var hashSet = new HashSet(targets);
+ toolSettings.TargetsInternal.RemoveAll(x => hashSet.Contains(x));
+ return toolSettings;
+ }
+ #endregion
#region DisableParallel
///
///
Sets
@@ -24659,6 +24845,63 @@ public static T ToggleSkipManifestUpdate(this T toolSettings) where T : DotNe
return toolSettings;
}
#endregion
+ #region SkipSignCheck
+ ///
+ ///
Sets
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T SetSkipSignCheck(this T toolSettings, bool? skipSignCheck) where T : DotNetWorkloadInstallSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = skipSignCheck;
+ return toolSettings;
+ }
+ ///
+ ///
Resets
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T ResetSkipSignCheck(this T toolSettings) where T : DotNetWorkloadInstallSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = null;
+ return toolSettings;
+ }
+ ///
+ ///
Enables
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T EnableSkipSignCheck(this T toolSettings) where T : DotNetWorkloadInstallSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = true;
+ return toolSettings;
+ }
+ ///
+ ///
Disables
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T DisableSkipSignCheck(this T toolSettings) where T : DotNetWorkloadInstallSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = false;
+ return toolSettings;
+ }
+ ///
+ ///
Toggles
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T ToggleSkipSignCheck(this T toolSettings) where T : DotNetWorkloadInstallSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = !toolSettings.SkipSignCheck;
+ return toolSettings;
+ }
+ #endregion
#region Source
///
///
Sets
@@ -25222,6 +25465,63 @@ public static T ToggleSkipManifestUpdate(this T toolSettings) where T : DotNe
return toolSettings;
}
#endregion
+ #region SkipSignCheck
+ ///
+ ///
Sets
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T SetSkipSignCheck(this T toolSettings, bool? skipSignCheck) where T : DotNetWorkloadRestoreSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = skipSignCheck;
+ return toolSettings;
+ }
+ ///
+ ///
Resets
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T ResetSkipSignCheck(this T toolSettings) where T : DotNetWorkloadRestoreSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = null;
+ return toolSettings;
+ }
+ ///
+ ///
Enables
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T EnableSkipSignCheck(this T toolSettings) where T : DotNetWorkloadRestoreSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = true;
+ return toolSettings;
+ }
+ ///
+ ///
Disables
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T DisableSkipSignCheck(this T toolSettings) where T : DotNetWorkloadRestoreSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = false;
+ return toolSettings;
+ }
+ ///
+ ///
Toggles
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T ToggleSkipSignCheck(this T toolSettings) where T : DotNetWorkloadRestoreSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = !toolSettings.SkipSignCheck;
+ return toolSettings;
+ }
+ #endregion
#region Source
///
///
Sets
@@ -25727,6 +26027,63 @@ public static T ToggleNoCache(this T toolSettings) where T : DotNetWorkloadUp
return toolSettings;
}
#endregion
+ #region SkipSignCheck
+ ///
+ ///
Sets
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T SetSkipSignCheck(this T toolSettings, bool? skipSignCheck) where T : DotNetWorkloadUpdateSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = skipSignCheck;
+ return toolSettings;
+ }
+ ///
+ ///
Resets
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T ResetSkipSignCheck(this T toolSettings) where T : DotNetWorkloadUpdateSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = null;
+ return toolSettings;
+ }
+ ///
+ ///
Enables
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T EnableSkipSignCheck(this T toolSettings) where T : DotNetWorkloadUpdateSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = true;
+ return toolSettings;
+ }
+ ///
+ ///
Disables
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T DisableSkipSignCheck(this T toolSettings) where T : DotNetWorkloadUpdateSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = false;
+ return toolSettings;
+ }
+ ///
+ ///
Toggles
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T ToggleSkipSignCheck(this T toolSettings) where T : DotNetWorkloadUpdateSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = !toolSettings.SkipSignCheck;
+ return toolSettings;
+ }
+ #endregion
#region Source
///
///
Sets
@@ -26118,6 +26475,63 @@ public static T ToggleNoCache(this T toolSettings) where T : DotNetWorkloadRe
return toolSettings;
}
#endregion
+ #region SkipSignCheck
+ ///
+ ///
Sets
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T SetSkipSignCheck(this T toolSettings, bool? skipSignCheck) where T : DotNetWorkloadRepairSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = skipSignCheck;
+ return toolSettings;
+ }
+ ///
+ ///
Resets
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T ResetSkipSignCheck(this T toolSettings) where T : DotNetWorkloadRepairSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = null;
+ return toolSettings;
+ }
+ ///
+ ///
Enables
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T EnableSkipSignCheck(this T toolSettings) where T : DotNetWorkloadRepairSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = true;
+ return toolSettings;
+ }
+ ///
+ ///
Disables
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T DisableSkipSignCheck(this T toolSettings) where T : DotNetWorkloadRepairSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = false;
+ return toolSettings;
+ }
+ ///
+ ///
Toggles
+ ///
Skipping the nuget package signature verification.
+ ///
+ [Pure]
+ public static T ToggleSkipSignCheck(this T toolSettings) where T : DotNetWorkloadRepairSettings
+ {
+ toolSettings = toolSettings.NewInstance();
+ toolSettings.SkipSignCheck = !toolSettings.SkipSignCheck;
+ return toolSettings;
+ }
+ #endregion
#region Source
///
///