Skip to content

Commit

Permalink
fix: add collection setter for suppressionFiles (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylong authored Jan 28, 2023
2 parents fc27825 + 3107358 commit 9399c09
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,12 @@ jobs:
- name: Build
id: build
run: |
./gradlew build
./gradlew build
- name: Archive Test Report
id: archive-reports
if: always()
uses: actions/upload-artifact@v3
with:
name: it-test-logs
retention-days: 7
path: build/reports/tests/**
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ class DependencyCheckExtension {
suppressionFiles = Arrays.stream(files).map({ o -> o.toString() }).collect(Collectors.toSet())
}
}
public void setSuppressionFiles(Collection<String> files) {
if (files != null) {
suppressionFiles = files;
}
}
/**
* The username for downloading the suppression file(s)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,12 @@ abstract class ConfiguredTask extends DefaultTask {
private String[] determineSuppressions(Collection<String> suppressionFiles, String suppressionFile) {
List<String> files = []
if (suppressionFiles != null) {
files.addAll(suppressionFiles)
for (String sf : suppressionFiles) {
files.add(sf.toString())
}
}
if (suppressionFile != null) {
files << suppressionFile
files.add(suppressionFile)
}
return files.toArray(new String[0])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ class DependencyCheckGradlePluginSpec extends Specification {
project.dependencyCheck.skipGroups == ['b']
project.dependencyCheck.skipTestGroups == false
project.dependencyCheck.suppressionFile == './src/config/suppression.xml'
project.dependencyCheck.suppressionFiles.getAt(0) == './src/config/suppression2.xml'
project.dependencyCheck.suppressionFiles.getAt(1) == './src/config/suppression1.xml'
project.dependencyCheck.suppressionFiles.getAt(0) == './src/config/suppression1.xml'
project.dependencyCheck.suppressionFiles.getAt(1) == './src/config/suppression2.xml'
//project.dependencyCheck.suppressionFiles == ['./src/config/suppression1.xml', './src/config/suppression2.xml']
project.dependencyCheck.suppressionFileUser == 'suppressionFileUsername'
project.dependencyCheck.suppressionFilePassword == 'suppressionFilePassword'
Expand Down

0 comments on commit 9399c09

Please sign in to comment.