mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-12-26 07:47:56 +01:00
Remove Spectre.Console.Cli from repository
* Move Spectre.Console.Cli to its own repository * Update build script to use Cake.Sdk and .NET Make * Remove StyleCop (unmaintained) * Add linting using dotnet format * Fix generator which was broken * Update dependencies
This commit is contained in:
committed by
Patrik Svensson
parent
1ec7b8ae8f
commit
45799107a3
111
build.cs
Normal file
111
build.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
#:sdk Cake.Sdk@5.1.25296.94-beta
|
||||
|
||||
var solution = "./src/Spectre.Console.slnx";
|
||||
var generatorSolution = "./resources/scripts/Generator/Generator.slnx";
|
||||
var testProject = "./src/Spectre.Console.Tests/Spectre.Console.Tests.csproj";
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Arguments
|
||||
|
||||
var target = Argument("target", "Default");
|
||||
var configuration = Argument("configuration", "Release");
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Tasks
|
||||
|
||||
Task("Clean")
|
||||
.Does(ctx =>
|
||||
{
|
||||
ctx.CleanDirectory("./.artifacts");
|
||||
});
|
||||
|
||||
Task("Lint")
|
||||
.Does(ctx =>
|
||||
{
|
||||
ctx.DotNetFormat(solution, new DotNetFormatSettings
|
||||
{
|
||||
VerifyNoChanges = true,
|
||||
});
|
||||
});
|
||||
|
||||
Task("Build")
|
||||
.IsDependentOn("Clean")
|
||||
.IsDependentOn("Lint")
|
||||
.Does(ctx =>
|
||||
{
|
||||
ctx.DotNetBuild(solution, new DotNetBuildSettings
|
||||
{
|
||||
Configuration = configuration,
|
||||
Verbosity = DotNetVerbosity.Minimal,
|
||||
NoLogo = true,
|
||||
NoIncremental = ctx.HasArgument("rebuild"),
|
||||
MSBuildSettings = new DotNetMSBuildSettings()
|
||||
.TreatAllWarningsAs(MSBuildTreatAllWarningsAs.Error)
|
||||
});
|
||||
});
|
||||
|
||||
Task("Test")
|
||||
.IsDependentOn("Build")
|
||||
.Does(ctx =>
|
||||
{
|
||||
ctx.DotNetTest(testProject, new DotNetTestSettings {
|
||||
Configuration = configuration,
|
||||
Verbosity = DotNetVerbosity.Minimal,
|
||||
NoLogo = true,
|
||||
NoRestore = true,
|
||||
NoBuild = true,
|
||||
});
|
||||
});
|
||||
|
||||
Task("Package")
|
||||
.IsDependentOn("Test")
|
||||
.Does(ctx =>
|
||||
{
|
||||
ctx.DotNetPack(solution, new DotNetPackSettings
|
||||
{
|
||||
Configuration = configuration,
|
||||
Verbosity = DotNetVerbosity.Minimal,
|
||||
NoLogo = true,
|
||||
NoRestore = true,
|
||||
NoBuild = true,
|
||||
OutputDirectory = "./.artifacts",
|
||||
MSBuildSettings = new DotNetMSBuildSettings()
|
||||
.TreatAllWarningsAs(MSBuildTreatAllWarningsAs.Error)
|
||||
});
|
||||
});
|
||||
|
||||
Task("Publish-NuGet")
|
||||
.WithCriteria(ctx => BuildSystem.IsRunningOnGitHubActions, "Not running on GitHub Actions")
|
||||
.IsDependentOn("Package")
|
||||
.Does(ctx =>
|
||||
{
|
||||
var apiKey = Argument<string?>("nuget-key", null);
|
||||
if(string.IsNullOrWhiteSpace(apiKey)) {
|
||||
throw new CakeException("No NuGet API key was provided.");
|
||||
}
|
||||
|
||||
// Publish to GitHub Packages
|
||||
foreach(var file in ctx.GetFiles("./.artifacts/*.nupkg"))
|
||||
{
|
||||
ctx.Information("Publishing {0}...", file.GetFilename().FullPath);
|
||||
DotNetNuGetPush(file.FullPath, new DotNetNuGetPushSettings
|
||||
{
|
||||
Source = "https://api.nuget.org/v3/index.json",
|
||||
ApiKey = apiKey,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Targets
|
||||
|
||||
Task("Publish")
|
||||
.IsDependentOn("Publish-NuGet");
|
||||
|
||||
Task("Default")
|
||||
.IsDependentOn("Package");
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Execution
|
||||
|
||||
RunTarget(target);
|
||||
Reference in New Issue
Block a user