Skip to content

Commit

Permalink
Merge pull request #16 from adrianrus/master
Browse files Browse the repository at this point in the history
Add exclusion parameters for opencover
  • Loading branch information
muryoh authored Nov 29, 2016
2 parents 74622a5 + 197a125 commit 849d755
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
### Fixed
* Escape double quotes in filters

### Added
* Exclusion parameters for OpenCover (excludebyfile, excludebyattribute, skipautoprops, hideskipped and skipautoprops)
[usage](https://github.com/OpenCover/opencover/wiki/Usage)

## 1.6
### Fixed
* Do not use relocated artifact for commons-io
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ the OpenCover.exe file of the associated OpenCover version. That task may be con
ignoreFailures
// optional - defaults to user. Specifies opencover's profile register mode (user, path32, path64, null). More details in https://github.com/OpenCover/opencover/wiki/Usage
registerMode
// optional - Exclude a class (or methods) by filter(s) that match the filenames
// More details in https://github.com/OpenCover/opencover/wiki/Usage
excludeByFile
// optional - Exclude a class or method by filter(s) that match attributes that have been applied.
// More details in https://github.com/OpenCover/opencover/wiki/Usage
excludeByAttribute
// optional - defaults to FALSE. Neither track nor record auto-implemented properties.
skipAutoProps
// optional - Remove information from output file that relates to classes/modules that have been skipped.
// Possible values: File;Filter;Attribute;MissingPdb;All
hideSkipped
}

#opencover-nunit plugin
Expand Down
8 changes: 8 additions & 0 deletions src/main/groovy/com/ullink/gradle/opencover/OpenCover.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ class OpenCover extends ConventionTask {
def targetExecArgs
def registerMode
List targetAssemblies
def excludeByFile
def excludeByAttribute
def hideSkipped

boolean returnTargetCode = true
boolean ignoreFailures = false
boolean mergeOutput = false
boolean skipAutoProps = false

OpenCover() {
conventionMapping.map 'registerMode', { 'user' }
Expand Down Expand Up @@ -71,6 +75,10 @@ class OpenCover extends ConventionTask {
if (getRegisterMode()) commandLineArgs += '-register:' + getRegisterMode()
if (returnTargetCode) commandLineArgs += '-returntargetcode'
if (mergeOutput) commandLineArgs += '-mergeoutput'
if (excludeByFile) commandLineArgs += '-excludebyfile:' + excludeByFile
if (excludeByAttribute) commandLineArgs += '-excludebyattribute:' + excludeByAttribute
if (skipAutoProps) commandLineArgs += '-skipautoprops'
if (hideSkipped) commandLineArgs += '-hideskipped:' + hideSkipped

commandLineArgs += ["-target:${getTargetExec()}", "\"-targetargs:${getTargetExecArgs().collect({escapeArg(it)}).join(' ')}\"", "-targetdir:${project.buildDir}"]
def filters = getTargetAssemblies().collect { "+[${FilenameUtils.getBaseName(project.file(it).name)}]*" }
Expand Down

0 comments on commit 849d755

Please # to comment.