Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Coverlet tool execution #10

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 10 additions & 1 deletion src/Cake.Coverlet/CoverletAliases.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Cake.Core;
using Cake.Core;
using Cake.Core.Annotations;
using Cake.Core.IO;
using Cake.Common.Tools.DotNetCore;
Expand Down Expand Up @@ -36,6 +36,15 @@ public static void DotNetCoreTest(
context.DotNetCoreTest(project.FullPath, settings);
}

public static void DotNetCoreTool(this ICakeContext context, IEnumerable<FilePath> 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,
Expand Down
52 changes: 52 additions & 0 deletions src/Cake.Coverlet/CoverletTool.cs
Original file line number Diff line number Diff line change
@@ -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<CoverletToolSettings>
{
private readonly ICakeEnvironment _environment;

/// <summary>
/// Initializes a new instance of the <see cref="T:Cake.Common.Tools.DotNetCore.VSTest.DotNetCoreVSTester" /> class.
/// </summary>
/// <param name="fileSystem">The file system.</param>
/// <param name="environment">The environment.</param>
/// <param name="processRunner">The process runner.</param>
/// <param name="tools">The tool locator.</param>
public CoverletTool(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools)
: base(fileSystem, environment, processRunner, tools)
{
this._environment = environment;
}

public void Run(IEnumerable<FilePath> testFiles, CoverletToolSettings settings)
{
if (settings == null)
throw new ArgumentNullException(nameof(settings));
if (testFiles == null || !testFiles.Any<FilePath>())
throw new ArgumentNullException(nameof(testFiles));
this.RunCommand(settings, this.GetArguments(testFiles, settings));
}

private ProcessArgumentBuilder GetArguments(IEnumerable<FilePath> testFiles, CoverletToolSettings settings)
{
var argumentBuilder = this.CreateArgumentBuilder(settings);

throw new NotImplementedException();

return argumentBuilder;
}
}

public class CoverletToolSettings : DotNetCoreSettings
{
public CoverletSettings CoverletSettings { get; set; }
}
}