Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .config/dotnet-tools.json

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
37 changes: 0 additions & 37 deletions build/helpers.cake

This file was deleted.

40 changes: 40 additions & 0 deletions build/helpers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
public static partial class Program
{
static List<NuSpecContent> GetContent(IEnumerable<string> frameworks, ProjectCollection projects, string configuration, Func<SolutionProject, bool>? projectFilter = null) {
projectFilter = projectFilter ?? (p => true);
var content = new List<NuSpecContent>();
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<SolutionProject> SourceProjects { get; set;}
public IEnumerable<DirectoryPath> SourceProjectPaths {get { return SourceProjects.Select(p => p.Path.GetDirectory()); } }
public IEnumerable<SolutionProject> TestProjects {get;set;}
public IEnumerable<DirectoryPath> TestProjectPaths { get { return TestProjects.Select(p => p.Path.GetDirectory()); } }
public IEnumerable<SolutionProject> AllProjects { get { return SourceProjects.Concat(TestProjects); } }
public IEnumerable<DirectoryPath> AllProjectPaths { get { return AllProjects.Select(p => p.Path.GetDirectory()); } }
}
26 changes: 0 additions & 26 deletions build/version.cake

This file was deleted.

26 changes: 26 additions & 0 deletions build/version.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
public static partial class Program
{
private static string? fallbackVersion = Argument<string?>("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;
}
}
9 changes: 6 additions & 3 deletions build.cake → cake.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#module nuget:?package=Cake.BuildSystems.Module&version=8.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


///////////////////////////////////////////////////////////////////////////////
Expand All @@ -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);
Expand Down