Skip to content

Commit

Permalink
Allow to use Action for configuration in extensions to better support…
Browse files Browse the repository at this point in the history
… non-Groovy consumers (#187) (#404)
  • Loading branch information
Vampire authored Aug 22, 2024
1 parent 54e4357 commit 1e36cdb
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.owasp.dependencycheck.gradle.extension

import org.gradle.api.Action
import org.gradle.api.Project

/**
Expand Down Expand Up @@ -211,44 +212,104 @@ class AnalyzerExtension {
* Allows programmatic configuration of the retirejs extension
* @param configClosure the closure to configure the retirejs extension
* @return the retirejs extension
* @deprecated Use the {@code Action} variant instead
*/
@Deprecated()
def retirejs(Closure configClosure) {
return project.configure(retirejs, configClosure)
}

/**
* Allows programmatic configuration of the retirejs extension
* @param config the action to configure the retirejs extension
* @return the retirejs extension
*/
def retirejs(Action<RetireJSExtension> config) {
config.execute(retirejs)
return retirejs
}

/**
* Allows programmatic configuration of the artifactory extension
* @param configClosure the closure to configure the artifactory extension
* @return the artifactory extension
* @deprecated Use the {@code Action} variant instead
*/
@Deprecated()
def artifactory(Closure configClosure) {
return project.configure(artifactory, configClosure)
}

/**
* Allows programmatic configuration of the artifactory extension
* @param config the action to configure the artifactory extension
* @return the artifactory extension
*/
def artifactory(Action<ArtifactoryExtension> config) {
config.execute(artifactory)
return artifactory
}

/**
* Allows programmatic configuration of the ossIndex extension
* @param configClosure the closure to configure the ossIndex extension
* @return the ossIndex extension
* @deprecated Use the {@code Action} variant instead
*/
@Deprecated()
def ossIndex(Closure configClosure) {
return project.configure(ossIndex, configClosure)
}

/**
* Allows programmatic configuration of the ossIndex extension
* @param config the action to configure the ossIndex extension
* @return the ossIndex extension
*/
def ossIndex(Action<OssIndexExtension> config) {
config.execute(ossIndex)
return ossIndex
}

/**
* Allows programmatic configuration of the nodeAudit extension
* @param configClosure the closure to configure the ossIndex extension
* @return the ossIndex extension
* @deprecated Use the {@code Action} variant instead
*/
@Deprecated()
def nodeAudit(Closure configClosure) {
return project.configure(nodeAudit, configClosure)
}

/**
* Allows programmatic configuration of the nodeAudit extension
* @param config the action to configure the ossIndex extension
* @return the ossIndex extension
*/
def nodeAudit(Action<NodeAuditExtension> config) {
config.execute(nodeAudit)
return nodeAudit
}

/**
* Allows programmatic configuration of the node package extension
* @param configClosure the closure to configure the node extension
* @return the node extension
* @deprecated Use the {@code Action} variant instead
*/
@Deprecated()
def nodePackage(Closure configClosure) {
return project.configure(nodePackage, configClosure)
}

/**
* Allows programmatic configuration of the node package extension
* @param config the action to configure the node extension
* @return the node extension
*/
def nodePackage(Action<NodePackageExtension> config) {
config.execute(nodePackage)
return nodePackage
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,65 +224,149 @@ class DependencyCheckExtension {
* Allows programmatic configuration of the proxy extension
* @param configClosure the closure to configure the proxy extension
* @return the proxy extension
* @deprecated Use the {@code Action} variant instead
*/
@Deprecated
def proxy(Closure configClosure) {
return project.configure(proxy, configClosure)
}

/**
* Allows programmatic configuration of the proxy extension
* @param config the action to configure the proxy extension
* @return the proxy extension
*/
def proxy(Action<ProxyExtension> config) {
config.execute(proxy)
return proxy
}

/**
* Allows programmatic configuration of the slack extension
* @param configClosure the closure to configure the slack extension
* @return the slack extension
* @deprecated Use the {@code Action} variant instead
*/
@Deprecated
def slack(Closure configClosure) {
return project.configure(slack, configClosure)
}

/**
* Allows programmatic configuration of the slack extension
* @param config the action to configure the slack extension
* @return the slack extension
*/
def slack(Action<SlackExtension> config) {
config.execute(slack)
return slack
}

/**
* Allows programmatic configuration of the nvd extension
* @param configClosure the closure to configure the nvd extension
* @return the nvd extension
* n @deprecated Use the {@code Action} variant instead
*/
@Deprecated
def nvd(Closure configClosure) {
return project.configure(nvd, configClosure)
}

/**
* Allows programmatic configuration of the nvd extension
* @param config the action to configure the nvd extension
* @return the nvd extension
*/
def nvd(Action<NvdExtension> config) {
config.execute(nvd)
return nvd
}

/**
* Allows programmatic configuration of the hostedSuppressions extension.
* @param configClosure the closure to configure the hostedSuppressions extension
* @return the hostedSuppressions extension
* n @deprecated Use the {@code Action} variant instead
*/
@Deprecated
def hostedSuppressions(Closure configClosure) {
return project.configure(hostedSuppressions, configClosure)
}

/**
* Allows programmatic configuration of the hostedSuppressions extension.
* @param config the action to configure the hostedSuppressions extension
* @return the hostedSuppressions extension
*/
def hostedSuppressions(Action<HostedSuppressionsExtension> config) {
config.execute(hostedSuppressions)
return hostedSuppressions
}

/**
* Allows programmatic configuration of the analyzer extension
* @param configClosure the closure to configure the analyzers extension
* @return the analyzers extension
* @deprecated Use the {@code Action} variant instead @deprecated Use the {@code Action} variant instead
*/
@Deprecated
def analyzers(Closure configClosure) {
return project.configure(analyzers, configClosure)
}

/**
* Allows programmatic configuration of the analyzer extension
* @param config the action to configure the analyzers extension
* @return the analyzers extension
*/
def analyzers(Action<AnalyzerExtension> config) {
config.execute(analyzers)
return analyzers
}

/**
* Allows programmatic configuration of the data extension
* @param configClosure the closure to configure the data extension
* @return the data extension
* @deprecated Use the {@code Action} variant instead
*/
@Deprecated
def data(Closure configClosure) {
return project.configure(data, configClosure)
}

/**
* Allows programmatic configuration of the data extension
* @param config the action to configure the data extension
* @return the data extension
*/
def data(Action<DataExtension> config) {
config.execute(data)
return data
}

/**
* Allows programmatic configuration of the cache extension
* @param configClosure the closure to configure the cache extension
* @return the cache extension
* @deprecated Use the {@code Action} variant instead
*/
@Deprecated
def cache(Closure configClosure) {
return project.configure(cache, configClosure)
}

/**
* Allows programmatic configuration of the cache extension
* @param config the action to configure the cache extension
* @return the cache extension
*/
def cache(Action<CacheExtension> config) {
config.execute(cache)
return cache
}

/**
* Allows programmatic configuration of additional CPEs to be analyzed
* @param action the action used to add entries to additional CPEs container.
Expand Down

0 comments on commit 1e36cdb

Please sign in to comment.