Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ class DependencyCheckExtension {
private final ListProperty<String> skipGroups
private final ListProperty<String> analyzedTypes
private final Property<Boolean> skip

private final ConfigurableFileCollection scanSet
private boolean scanSetConfigured = false

/**
* The configuration extension for proxy settings.
Expand Down Expand Up @@ -386,8 +388,8 @@ class DependencyCheckExtension {
}

void setFailBuildOnCVSS(Number value) {
failBuildOnCVSS.set(value?.floatValue())
}
failBuildOnCVSS.set(value?.floatValue())
}

/**
* Specifies the CVSS score that should be considered a failure when generating a JUNIT formatted report. The default
Expand All @@ -400,8 +402,8 @@ class DependencyCheckExtension {
}

void setJunitFailOnCVSS(Number value) {
junitFailOnCVSS.set(value?.floatValue())
}
junitFailOnCVSS.set(value?.floatValue())
}

/**
* Specifies that if any unused suppression rule is found, the build will fail.
Expand Down Expand Up @@ -540,13 +542,18 @@ class DependencyCheckExtension {
}

void setScanSet(List<File> files) {
scanSetConfigured = true
scanSet.setFrom(files)
}

void setScanSet(File... files) {
scanSetConfigured = true
scanSet.setFrom(files)
}

boolean isScanSetConfigured() {
scanSetConfigured
}

/**
* Allows programmatic configuration of the proxy extension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ abstract class AbstractAnalyze extends ConfiguredTask {
/**
* Determines if the configuration should be considered a test configuration.
* @param configuration the configuration to insepct
* @return true if the configuration is considered a tet configuration; otherwise false
* @return true if the configuration is considered a test configuration; otherwise false
*/
@groovy.transform.CompileStatic
boolean isTestConfiguration(Configuration configuration) {
Expand Down Expand Up @@ -503,7 +503,7 @@ abstract class AbstractAnalyze extends ConfiguredTask {
processConfigV4 project, configuration, engine
}
}
if (config.scanSet == null) {
if (!config.isScanSetConfigured()) {
List<String> toScan = ['src/main/resources', 'src/main/webapp',
'./package.json', './package-lock.json',
'./npm-shrinkwrap.json', './yarn.lock',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ class Aggregate extends AbstractAnalyze {
private def scanProject(Set<Project> projects, Engine engine) {
projects.each { Project project ->
if (shouldBeScanned(project) && !shouldBeSkipped(project)) {
if (this.config.scanDependencies) {
if (this.config.scanDependencies.get()) {
processConfigurations(project, engine)
}
if (this.config.scanBuildEnv) {
if (this.config.scanBuildEnv.get()) {
processBuildEnvironment(project, engine)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class Analyze extends AbstractAnalyze {
def scanDependencies(Engine engine) {
if (shouldBeScanned(project) && !shouldBeSkipped(project)) {
logger.lifecycle("Verifying dependencies for project ${currentProjectName}")
if (this.config.scanDependencies) {
if (this.config.scanDependencies.get()) {
processConfigurations(project, engine)
}
if (this.config.scanBuildEnv) {
if (this.config.scanBuildEnv.get()) {
processBuildEnvironment(project, engine)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ class Update extends ConfiguredTask {
engine.doUpdates()
} catch (DatabaseException ex) {
String msg = "Unable to connect to the dependency-check database"
if (config.failOnError) {
if (config.failOnError.get()) {
throw new GradleException(msg, ex)
} else {
logger.error(msg)
}
} catch (UpdateException ex) {
if (config.failOnError) {
if (config.failOnError.get()) {
throw new GradleException(ex.getMessage(), ex)
} else {
logger.error(ex.getMessage())
Expand Down
Loading