-
-
Notifications
You must be signed in to change notification settings - Fork 726
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Contains some unavoidable breaking changes.
- Loading branch information
1 parent
ce4895b
commit a1cbb58
Showing
172 changed files
with
2,612 additions
and
4,411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<AssemblyName>Cake.Cli</AssemblyName> | ||
<TargetFrameworks>netstandard2.0;net5.0</TargetFrameworks> | ||
<OutputType>Library</OutputType> | ||
<PlatformTarget>AnyCpu</PlatformTarget> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
</PropertyGroup> | ||
|
||
<!-- Package specific metadata --> | ||
<PropertyGroup> | ||
<Description>The Cake CLI library.</Description> | ||
</PropertyGroup> | ||
|
||
<!-- Import shared functionality --> | ||
<Import Project="..\Shared.msbuild" /> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Cake.Core\Cake.Core.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Autofac" Version="6.0.0" /> | ||
<PackageReference Include="Spectre.Cli" Version="0.46.0" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Cake.Core; | ||
|
||
namespace Cake.Cli | ||
{ | ||
/// <summary> | ||
/// Represents a feature that writes information about Cake to the console. | ||
/// </summary> | ||
public interface ICakeInfoFeature | ||
{ | ||
/// <summary> | ||
/// Runs the feature. | ||
/// </summary> | ||
/// <param name="console">The console to write to.</param> | ||
void Run(IConsole console); | ||
} | ||
|
||
/// <summary> | ||
/// Writes information about Cake to the console. | ||
/// </summary> | ||
public sealed class InfoFeature : ICakeInfoFeature | ||
{ | ||
private readonly IVersionResolver _resolver; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="InfoFeature"/> class. | ||
/// </summary> | ||
/// <param name="resolver">The version resolver.</param> | ||
public InfoFeature(IVersionResolver resolver) | ||
{ | ||
_resolver = resolver; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public void Run(IConsole console) | ||
{ | ||
var version = _resolver.GetVersion(); | ||
var product = _resolver.GetProductVersion(); | ||
|
||
console.WriteLine(); | ||
console.WriteLine(@" +## #;;'"); | ||
console.WriteLine(@" #;;# .+;;;;+,"); | ||
console.WriteLine(@" '+;;#;,+';;;;;'#."); | ||
console.WriteLine(@" ++'''';;;;;;;;;;# ;#;"); | ||
console.WriteLine(@" ##';;;;++'+#;;;;;'. `#:"); | ||
console.WriteLine(@" ;# '+'';;;;;;;;;'#` #."); | ||
console.WriteLine(@" `#, .'++;;;;;':..........#"); | ||
console.WriteLine(@" '+ `.........';;;;':.........#"); | ||
console.WriteLine(@" #..................+;;;;;':........#"); | ||
console.WriteLine(@" #..................#';;;;;'+''''''.#"); | ||
console.WriteLine(@" #.......,:;''''''''##';;;;;'+'''''#,"); | ||
console.WriteLine(@" #''''''''''''''''''###';;;;;;+''''#"); | ||
console.WriteLine(@" #''''''''''''''''''####';;;;;;#'''#"); | ||
console.WriteLine(@" #''''''''''''''''''#####';;;;;;#''#"); | ||
console.WriteLine(@" #''''''''''''''''''######';;;;;;#'#"); | ||
console.WriteLine(@" #''''''''''''''''''#######';;;;;;##"); | ||
console.WriteLine(@" #''''''''''''''''''########';;;;;;#"); | ||
console.WriteLine(@" #''''''''''''++####+;#######';;;;;;#"); | ||
console.WriteLine(@" #+####':,` ,#####';;;;;;'"); | ||
console.WriteLine(@" +##'''''+."); | ||
|
||
console.ForegroundColor = System.ConsoleColor.Yellow; | ||
console.WriteLine(@" ___ _ ___ _ _ _ "); | ||
console.WriteLine(@" / __\__ _| | _____ / __\_ _(_) | __| |"); | ||
console.WriteLine(@" / / / _` | |/ / _ \/__\// | | | | |/ _` |"); | ||
console.WriteLine(@"/ /___ (_| | < __/ \/ \ |_| | | | (_| |"); | ||
console.WriteLine(@"\____/\__,_|_|\_\___\_____/\__,_|_|_|\__,_|"); | ||
console.ResetColor(); | ||
|
||
console.WriteLine(); | ||
console.WriteLine(@"Version: {0}", version); | ||
console.WriteLine(@"Details: {0}", string.Join("\n ", product.Split('/'))); | ||
console.WriteLine(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using Cake.Core; | ||
|
||
namespace Cake.Cli | ||
{ | ||
/// <summary> | ||
/// Represents a feature that writes the Cake version to the console. | ||
/// </summary> | ||
public interface ICakeVersionFeature | ||
{ | ||
/// <summary> | ||
/// Writes the Cake version to the console. | ||
/// </summary> | ||
/// <param name="console">The console to write to.</param> | ||
void Run(IConsole console); | ||
} | ||
|
||
/// <summary> | ||
/// Writes the Cake version to the console. | ||
/// </summary> | ||
public sealed class VersionFeature : ICakeVersionFeature | ||
{ | ||
private readonly IVersionResolver _resolver; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="VersionFeature"/> class. | ||
/// </summary> | ||
/// <param name="resolver">The version resolver.</param> | ||
public VersionFeature(IVersionResolver resolver) | ||
{ | ||
_resolver = resolver; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public void Run(IConsole console) | ||
{ | ||
if (console is null) | ||
{ | ||
throw new ArgumentNullException(nameof(console)); | ||
} | ||
|
||
console.WriteLine(_resolver.GetVersion()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Threading.Tasks; | ||
using Cake.Core; | ||
using Cake.Core.Diagnostics; | ||
using Cake.Core.Scripting; | ||
|
||
namespace Cake.Cli | ||
{ | ||
/// <summary> | ||
/// The script host used to execute Cake scripts. | ||
/// </summary> | ||
public sealed class BuildScriptHost : BuildScriptHost<ICakeContext> | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BuildScriptHost"/> class. | ||
/// </summary> | ||
/// <param name="engine">The engine.</param> | ||
/// <param name="executionStrategy">The execution strategy.</param> | ||
/// <param name="context">The context.</param> | ||
/// <param name="reportPrinter">The report printer.</param> | ||
/// <param name="log">The log.</param> | ||
public BuildScriptHost( | ||
ICakeEngine engine, | ||
IExecutionStrategy executionStrategy, | ||
ICakeContext context, | ||
ICakeReportPrinter reportPrinter, | ||
ICakeLog log) : base(engine, executionStrategy, context, reportPrinter, log) | ||
{ | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// The script host used to execute Cake scripts. | ||
/// </summary> | ||
/// <typeparam name="TContext">The context type.</typeparam> | ||
public class BuildScriptHost<TContext> : ScriptHost | ||
where TContext : ICakeContext | ||
{ | ||
private readonly ICakeReportPrinter _reportPrinter; | ||
private readonly ICakeLog _log; | ||
private readonly IExecutionStrategy _executionStrategy; | ||
private readonly TContext _context; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BuildScriptHost{TContext}"/> class. | ||
/// </summary> | ||
/// <param name="engine">The engine.</param> | ||
/// <param name="executionStrategy">The execution strategy.</param> | ||
/// <param name="context">The context.</param> | ||
/// <param name="reportPrinter">The report printer.</param> | ||
/// <param name="log">The log.</param> | ||
public BuildScriptHost( | ||
ICakeEngine engine, | ||
IExecutionStrategy executionStrategy, | ||
TContext context, | ||
ICakeReportPrinter reportPrinter, | ||
ICakeLog log) : base(engine, context) | ||
{ | ||
_executionStrategy = executionStrategy; | ||
_context = context; | ||
_reportPrinter = reportPrinter; | ||
_log = log; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override async Task<CakeReport> RunTargetAsync(string target) | ||
{ | ||
Settings.SetTarget(target); | ||
|
||
var report = await Engine.RunTargetAsync(_context, _executionStrategy, Settings).ConfigureAwait(false); | ||
if (report != null && !report.IsEmpty) | ||
{ | ||
_reportPrinter.Write(report); | ||
} | ||
|
||
return report; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.