From 101f7b40a74038890ab3e010e96dafe9ff87f9a4 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 1 Dec 2025 03:35:47 +0000 Subject: [PATCH 1/2] chore(deps): update dependency cake.buildsystems.module to v9 --- build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 40661e6..ff17c13 100644 --- a/build.cake +++ b/build.cake @@ -1,4 +1,4 @@ -#module nuget:?package=Cake.BuildSystems.Module&version=8.0.0 +#module nuget:?package=Cake.BuildSystems.Module&version=9.0.0 #load "build/helpers.cake" #load "build/version.cake" From 78f271f67052239f52447fafe6a585e01def54d3 Mon Sep 17 00:00:00 2001 From: Mattias Karlsson Date: Thu, 4 Dec 2025 19:42:49 +0100 Subject: [PATCH 2/2] Migrate build scripts from Cake script to C# syntax Convert all .cake files to .cs files using Cake SDK 6.0.0. Remove dotnet-tools.json as tools are now managed by Cake SDK. Update GitHub workflow to use cake.cs instead of build.cake. --- .config/dotnet-tools.json | 20 ------------------- .github/workflows/build.yml | 1 + build/helpers.cake | 37 ---------------------------------- build/helpers.cs | 40 +++++++++++++++++++++++++++++++++++++ build/version.cake | 26 ------------------------ build/version.cs | 26 ++++++++++++++++++++++++ build.cake => cake.cs | 9 ++++++--- 7 files changed, 73 insertions(+), 86 deletions(-) delete mode 100644 .config/dotnet-tools.json delete mode 100644 build/helpers.cake create mode 100644 build/helpers.cs delete mode 100644 build/version.cake create mode 100644 build/version.cs rename build.cake => cake.cs (92%) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json deleted file mode 100644 index 79c4028..0000000 --- a/.config/dotnet-tools.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "version": 1, - "isRoot": true, - "tools": { - "cake.tool": { - "version": "6.0.0", - "commands": [ - "dotnet-cake" - ], - "rollForward": false - }, - "minver-cli": { - "version": "6.0.0", - "commands": [ - "minver" - ], - "rollForward": false - } - } -} \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d2d5e3..ad3af51 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,6 +52,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NUGET_TOKEN: ${{steps.login.outputs.NUGET_API_KEY}} with: + file-path: cake.cs cake-version: tool-manifest target: Release diff --git a/build/helpers.cake b/build/helpers.cake deleted file mode 100644 index abff77b..0000000 --- a/build/helpers.cake +++ /dev/null @@ -1,37 +0,0 @@ -List GetContent(IEnumerable frameworks, ProjectCollection projects, string configuration, Func projectFilter = null) { - projectFilter = projectFilter ?? (p => true); - var content = new List(); - foreach (var framework in frameworks) { - foreach (var project in projects.SourceProjects.Where(projectFilter)) { - Verbose("Loading package files for " + project.Name); - var match = GetFiles(project.Path.GetDirectory() + "/bin/" + configuration + "/" + framework + "/" + project.Name +".*"); - var libFiles = match - .Where(f => f.GetExtension() != ".pdb") - .Select(f => new NuSpecContent { Source = f.FullPath, Target = $"lib/{framework}"}); - content.AddRange(libFiles); - } - } - return content; -} - -public class ProjectCollection { - public ConvertableFilePath SolutionPath {get;set;} - public IEnumerable SourceProjects {get;set;} - public IEnumerable SourceProjectPaths {get { return SourceProjects.Select(p => p.Path.GetDirectory()); } } - public IEnumerable TestProjects {get;set;} - public IEnumerable TestProjectPaths { get { return TestProjects.Select(p => p.Path.GetDirectory()); } } - public IEnumerable AllProjects { get { return SourceProjects.Concat(TestProjects); } } - public IEnumerable AllProjectPaths { get { return AllProjects.Select(p => p.Path.GetDirectory()); } } -} - -ProjectCollection GetProjects(ConvertableFilePath slnPath, string configuration) { - var solution = ParseSolution(slnPath); - var projects = solution.Projects.Where(p => p.Type != "{2150E333-8FDC-42A3-9474-1A3956D46DE8}"); - var testAssemblies = projects.Where(p => p.Name.Contains(".Tests")).Select(p => p.Path.GetDirectory() + "/bin/" + configuration + "/" + p.Name + ".dll"); - return new ProjectCollection { - SolutionPath = slnPath, - SourceProjects = projects.Where(p => !p.Name.Contains(".Tests")), - TestProjects = projects.Where(p => p.Name.Contains(".Tests")) - }; - -} \ No newline at end of file diff --git a/build/helpers.cs b/build/helpers.cs new file mode 100644 index 0000000..091c621 --- /dev/null +++ b/build/helpers.cs @@ -0,0 +1,40 @@ +public static partial class Program +{ + static List GetContent(IEnumerable frameworks, ProjectCollection projects, string configuration, Func? projectFilter = null) { + projectFilter = projectFilter ?? (p => true); + var content = new List(); + foreach (var framework in frameworks) { + foreach (var project in projects.SourceProjects.Where(projectFilter)) { + Verbose("Loading package files for " + project.Name); + var match = GetFiles(project.Path.GetDirectory() + "/bin/" + configuration + "/" + framework + "/" + project.Name +".*"); + var libFiles = match + .Where(f => f.GetExtension() != ".pdb") + .Select(f => new NuSpecContent { Source = f.FullPath, Target = $"lib/{framework}"}); + content.AddRange(libFiles); + } + } + return content; + } + + static ProjectCollection GetProjects(ConvertableFilePath slnPath, string configuration) { + var solution = ParseSolution(slnPath); + var projects = solution.Projects.Where(p => p.Type != "{2150E333-8FDC-42A3-9474-1A3956D46DE8}"); + var testAssemblies = projects.Where(p => p.Name.Contains(".Tests")).Select(p => p.Path.GetDirectory() + "/bin/" + configuration + "/" + p.Name + ".dll"); + return new ProjectCollection { + SolutionPath = slnPath, + SourceProjects = projects.Where(p => !p.Name.Contains(".Tests")), + TestProjects = projects.Where(p => p.Name.Contains(".Tests")) + }; + + } +} + +public class ProjectCollection { + public ConvertableFilePath SolutionPath { get; set;} + public IEnumerable SourceProjects { get; set;} + public IEnumerable SourceProjectPaths {get { return SourceProjects.Select(p => p.Path.GetDirectory()); } } + public IEnumerable TestProjects {get;set;} + public IEnumerable TestProjectPaths { get { return TestProjects.Select(p => p.Path.GetDirectory()); } } + public IEnumerable AllProjects { get { return SourceProjects.Concat(TestProjects); } } + public IEnumerable AllProjectPaths { get { return AllProjects.Select(p => p.Path.GetDirectory()); } } +} \ No newline at end of file diff --git a/build/version.cake b/build/version.cake deleted file mode 100644 index 60092c8..0000000 --- a/build/version.cake +++ /dev/null @@ -1,26 +0,0 @@ -#tool dotnet:?package=minver-cli&version=6.0.0 -#addin nuget:?package=Cake.MinVer&version=4.0.0 - -var fallbackVersion = Argument("force-version", EnvironmentVariable("FALLBACK_VERSION") ?? "0.1.0"); - -string BuildVersion(string fallbackVersion) { - var PackageVersion = string.Empty; - try { - Information("Attempting MinVer..."); - var settings = new MinVerSettings() - { - //AutoIncrement = MinVerAutoIncrement.Minor, - DefaultPreReleasePhase = "preview", - TagPrefix = "v" - }; - var version = MinVer(settings); - PackageVersion = version.PackageVersion; - } catch (Exception ex) { - Warning($"Error when getting version {ex.Message}"); - Information($"Falling back to version: {fallbackVersion}"); - PackageVersion = fallbackVersion; - } finally { - Information($"Building for version '{PackageVersion}'"); - } - return PackageVersion; -} \ No newline at end of file diff --git a/build/version.cs b/build/version.cs new file mode 100644 index 0000000..89aaf32 --- /dev/null +++ b/build/version.cs @@ -0,0 +1,26 @@ +public static partial class Program +{ + private static string? fallbackVersion = Argument("force-version", EnvironmentVariable("FALLBACK_VERSION") ?? "0.1.0"); + + static string BuildVersion(string fallbackVersion) { + var PackageVersion = string.Empty; + try { + Information("Attempting MinVer..."); + var settings = new MinVerSettings() + { + //AutoIncrement = MinVerAutoIncrement.Minor, + DefaultPreReleasePhase = "preview", + TagPrefix = "v" + }; + var version = MinVer(settings); + PackageVersion = version.PackageVersion; + } catch (Exception ex) { + Warning($"Error when getting version {ex.Message}"); + Information($"Falling back to version: {fallbackVersion}"); + PackageVersion = fallbackVersion; + } finally { + Information($"Building for version '{PackageVersion}'"); + } + return PackageVersion; + } +} \ No newline at end of file diff --git a/build.cake b/cake.cs similarity index 92% rename from build.cake rename to cake.cs index ff17c13..6b9abb6 100644 --- a/build.cake +++ b/cake.cs @@ -1,6 +1,7 @@ -#module nuget:?package=Cake.BuildSystems.Module&version=9.0.0 -#load "build/helpers.cake" -#load "build/version.cake" +#:sdk Cake.Sdk@6.0.0 +#:package Cake.BuildSystems.Module@9.0.0 +#:package Cake.MinVer@4.0.0 +#:property IncludeAdditionalFiles=./build/*.cs /////////////////////////////////////////////////////////////////////////////// @@ -25,6 +26,8 @@ Setup(ctx => { + InstallTool("dotnet:?package=minver-cli&version=6.0.0"); + // Executed BEFORE the first task. Information("Running tasks..."); CreateDirectory(artifacts);