diff --git a/src/Cake.Coverlet/CoverletAliases.cs b/src/Cake.Coverlet/CoverletAliases.cs index a4a1f98..c4fc50d 100644 --- a/src/Cake.Coverlet/CoverletAliases.cs +++ b/src/Cake.Coverlet/CoverletAliases.cs @@ -1,4 +1,4 @@ -using Cake.Core; +using Cake.Core; using Cake.Core.Annotations; using Cake.Core.IO; using Cake.Common.Tools.DotNetCore; @@ -36,6 +36,15 @@ public static void DotNetCoreTest( context.DotNetCoreTest(project.FullPath, settings); } + public static void DotNetCoreTool(this ICakeContext context, IEnumerable testFiles, CoverletToolSettings settings) + { + if (context == null) + throw new ArgumentNullException(nameof(context)); + if (settings == null) + settings = new CoverletToolSettings(); + new CoverletTool(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools).Run(testFiles, settings); + } + private static ProcessArgumentBuilder ProcessArguments( ICakeContext cakeContext, ProcessArgumentBuilder builder, diff --git a/src/Cake.Coverlet/CoverletTool.cs b/src/Cake.Coverlet/CoverletTool.cs new file mode 100644 index 0000000..a41dc02 --- /dev/null +++ b/src/Cake.Coverlet/CoverletTool.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Cake.Common.Tools.DotNetCore; +using Cake.Core; +using Cake.Core.IO; +using Cake.Core.Tooling; + +namespace Cake.Coverlet +{ + public sealed class CoverletTool : DotNetCoreTool + { + private readonly ICakeEnvironment _environment; + + /// + /// Initializes a new instance of the class. + /// + /// The file system. + /// The environment. + /// The process runner. + /// The tool locator. + public CoverletTool(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools) + : base(fileSystem, environment, processRunner, tools) + { + this._environment = environment; + } + + public void Run(IEnumerable testFiles, CoverletToolSettings settings) + { + if (settings == null) + throw new ArgumentNullException(nameof(settings)); + if (testFiles == null || !testFiles.Any()) + throw new ArgumentNullException(nameof(testFiles)); + this.RunCommand(settings, this.GetArguments(testFiles, settings)); + } + + private ProcessArgumentBuilder GetArguments(IEnumerable testFiles, CoverletToolSettings settings) + { + var argumentBuilder = this.CreateArgumentBuilder(settings); + + throw new NotImplementedException(); + + return argumentBuilder; + } + } + + public class CoverletToolSettings : DotNetCoreSettings + { + public CoverletSettings CoverletSettings { get; set; } + } +}