Created
January 10, 2018 12:47
-
-
Save jbrestan/d124d7aa326b00d95ab8936b0287a28d to your computer and use it in GitHub Desktop.
Finds all Paket DLL dependencies and builds a CLI exclusion filter for dotTrace
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
let filesToExcludeFromTestCoverage rootDir projectExcludes = | |
rootDir</>"paket.lock" | |
|> File.ReadLines | |
|> Seq.choose (fun line -> | |
// Expecting paket.lock line format for dependencies and transitive dependencies, e.g.: | |
// xunit (2.3) | |
// xunit.analyzers (>= 0.7) | |
// We'll use the version to recognize it from `remote: <url>` definitions, but take just the package name. | |
match Regex.Match(line,"^[ ]{4,6}([^ ]+) \((.+)\)") with | |
| m when m.Success && m.Groups.Count = 3 -> Some m.Groups.[1].Value | |
| _ -> None) | |
|> Seq.distinct | |
|> Seq.collect (fun packageName -> | |
!! (rootDir</>"packages"</>packageName</>"**/*.dll") | |
|> Seq.map FileHelper.fileNameWithoutExt) | |
|> Seq.distinct | |
|> Seq.append projectExcludes | |
|> Seq.append ["*Tests"] | |
|> Seq.map (sprintf "-:%s") | |
|> String.concat ";" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: