Skip to content

Commit

Permalink
Release 1.5.0 (#29)
Browse files Browse the repository at this point in the history
- Removed BuildSolution config value
- Updated Microsoft.CodeAnalysis to 3.4.0
- Changed from MsBuilderWorkspace to AdhocWorkspace for console
  • Loading branch information
MilleBo authored Feb 10, 2020
1 parent 35cf63d commit 2281a78
Show file tree
Hide file tree
Showing 31 changed files with 548 additions and 287 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public CreateMutationsCommandHandler(MutationDocumentCreator mutationsCreator)

public Task<IList<MutationDocument>> Handle(CreateMutationsCommand command, CancellationToken cancellationToken)
{
return _mutationsCreator.CreateMutationsAsync(command.Config, cancellationToken);
return Task.FromResult(_mutationsCreator.CreateMutations(command.Config, cancellationToken));
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,28 @@ public OpenProjectWorkspaceHandler(BaselineCreator baselineCreator, ISolutionOpe
{
cancellationToken.ThrowIfCancellationRequested();

var solution = await _solutionOpener.GetSolutionAsync(applicationConfig);
applicationConfig.Solution = await _solutionOpener.GetSolutionAsync(fileConfig.SolutionPath);

InitializeTestProjects(fileConfig, applicationConfig, solution);
InitializeMutationProjects(fileConfig, applicationConfig, solution);
InitializeTestProjects(fileConfig, applicationConfig);
InitializeMutationProjects(fileConfig, applicationConfig);

if (fileConfig.CreateBaseline)
{
applicationConfig.BaselineInfos = new List<BaselineInfo>(await _baselineCreator.CreateBaselineAsync(applicationConfig, solution, cancellationToken));
applicationConfig.BaselineInfos = new List<BaselineInfo>(await _baselineCreator.CreateBaselineAsync(applicationConfig, cancellationToken));
}

await base.HandleAsync(fileConfig, applicationConfig, cancellationToken);
}

private void InitializeMutationProjects(MutationFileConfig fileConfig, MutationConfig config, Microsoft.CodeAnalysis.Solution solution)
private void InitializeMutationProjects(MutationFileConfig fileConfig, MutationConfig config)
{
if (fileConfig.IgnoredProjects == null)
{
fileConfig.IgnoredProjects = new List<string>();
}

LogTo.Info("Setting up mutation projects.");
foreach (var solutionProject in solution.Projects)
foreach (var solutionProject in config.Solution.Projects)
{
if (
IsIgnored(solutionProject.Name, fileConfig.IgnoredProjects) ||
Expand Down Expand Up @@ -88,7 +88,7 @@ private bool WeTargetSpecificFrameworkThatThisProjectDontSupport(string projectF
return !content.ToLower().Contains(targetFramework.Name.ToLower());
}

private void InitializeTestProjects(MutationFileConfig fileConfig, MutationConfig config, Solution solution)
private void InitializeTestProjects(MutationFileConfig fileConfig, MutationConfig config)
{
if (fileConfig.TestProjects == null || !fileConfig.TestProjects.Any())
{
Expand All @@ -99,11 +99,11 @@ private void InitializeTestProjects(MutationFileConfig fileConfig, MutationConfi
LogTo.Info("Setting up test projects.");
foreach (var testProjectName in fileConfig.TestProjects)
{
var testProjects = solution.Projects.Where(p => Regex.IsMatch(p.Name, FormattedProjectName(testProjectName), RegexOptions.IgnoreCase));
var testProjects = config.Solution.Projects.Where(p => Regex.IsMatch(p.Name, FormattedProjectName(testProjectName), RegexOptions.IgnoreCase));

if (!testProjects.Any())
{
throw new ProjectSetUpException($"Could not find any project with the name {testProjectName} in the solution. List of project names: {string.Join(", ", solution.Projects.Select(p => p.Name))}");
throw new ProjectSetUpException($"Could not find any project with the name {testProjectName} in the solution. List of project names: {string.Join(", ", config.Solution.Projects.Select(p => p.Name))}");
}

foreach (var testProject in testProjects)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public async Task<MutationConfig> Handle(OpenProjectCommand command, Cancellatio
var handler = new OpenProjectExistHandler(_gitCloner);

handler
.SetNext(new OpenProjectBuildHandler(_solutionBuilder))
.SetNext(new OpenProjectMutatorsHandler())
.SetNext(new OpenProjectGitFilterHandler(_diffCreator))
.SetNext(new OpenProjectWorkspaceHandler(_baselineCreator, _solutionOpener));
Expand Down Expand Up @@ -92,7 +91,6 @@ public async Task<MutationConfig> Handle(OpenProjectCommand command, Cancellatio

var config = new MutationConfig
{
SolutionPath = fileConfig.SolutionPath,
Filter = fileConfig.Filter,
NumberOfTestRunInstances = fileConfig.NumberOfTestRunInstances,
BuildConfiguration = fileConfig.BuildConfiguration,
Expand Down
3 changes: 0 additions & 3 deletions src/Testura.Mutation.Application/Models/MutationFileConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public MutationFileConfig()
CreateBaseline = true;
Mutators = new List<string>();
Filter = new MutationDocumentFilter();
BuildSolution = true;
ProjectMappings = new List<ProjectMapping>();
}

Expand Down Expand Up @@ -48,7 +47,5 @@ public MutationFileConfig()
public TargetFramework TargetFramework { get; set; }

public bool CreateBaseline { get; set; }

public bool BuildSolution { get; set; }
}
}
Loading

0 comments on commit 2281a78

Please sign in to comment.