forked from lucaslorentz/minicover
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle duplicated assemblies as same assembly
- Loading branch information
1 parent
1bde5e8
commit f4d5435
Showing
14 changed files
with
250 additions
and
174 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
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,12 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace MiniCover.Model | ||
{ | ||
public class AssemblyLocation | ||
{ | ||
public string File { get; set; } | ||
public string BackupFile { get; set; } | ||
public string PdbFile { get; set; } | ||
public string BackupPdbFile { get; set; } | ||
} | ||
} |
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 |
---|---|---|
@@ -1,43 +1,59 @@ | ||
using Newtonsoft.Json; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System; | ||
|
||
namespace MiniCover.Model | ||
{ | ||
public class InstrumentationResult | ||
{ | ||
private Dictionary<string, InstrumentedAssembly> _assemblies; | ||
|
||
public InstrumentationResult() | ||
{ | ||
_assemblies = new Dictionary<string, InstrumentedAssembly>(); | ||
} | ||
|
||
[JsonConstructor] | ||
public InstrumentationResult(IEnumerable<InstrumentedAssembly> assemblies) | ||
{ | ||
_assemblies = assemblies.ToDictionary(a => a.Hash); | ||
} | ||
|
||
[JsonProperty(Order = -2)] | ||
public string SourcePath { get; set; } | ||
|
||
[JsonProperty(Order = -2)] | ||
public string HitsFile { get; set; } | ||
|
||
public List<string> ExtraAssemblies = new List<string>(); | ||
public Dictionary<string, InstrumentedAssembly> Assemblies = new Dictionary<string, InstrumentedAssembly>(); | ||
public HashSet<string> ExtraAssemblies = new HashSet<string>(); | ||
|
||
public InstrumentedAssembly AddInstrumentedAssembly(string name, string backupFile, string file, string backupPdbFile, string pdbFile) | ||
public IEnumerable<InstrumentedAssembly> Assemblies => _assemblies.Values; | ||
|
||
public InstrumentedAssembly GetInstrumentedAssembly(string hash) | ||
{ | ||
if (Assemblies.ContainsKey(name)) | ||
{ | ||
return Assemblies[name]; | ||
} | ||
if (!_assemblies.TryGetValue(hash, out var instrumentedAssembly)) | ||
return null; | ||
|
||
return instrumentedAssembly; | ||
} | ||
|
||
public InstrumentedAssembly AddInstrumentedAssembly(string hash, string name) | ||
{ | ||
var instrumentedAssembly = new InstrumentedAssembly | ||
{ | ||
BackupFile = backupFile, | ||
File = file, | ||
BackupPdbFile = backupPdbFile, | ||
PdbFile = pdbFile | ||
Hash = hash, | ||
Name = name | ||
}; | ||
|
||
Assemblies.Add(name, instrumentedAssembly); | ||
_assemblies.Add(hash, instrumentedAssembly); | ||
|
||
return instrumentedAssembly; | ||
} | ||
|
||
public void AddExtraAssembly(string file) | ||
{ | ||
if (!ExtraAssemblies.Contains(file)) | ||
ExtraAssemblies.Add(file); | ||
ExtraAssemblies.Add(file); | ||
} | ||
} | ||
} |
Oops, something went wrong.