com.danielsomerfield.cvecheck.gradle.DependencyCheckGradlePlugin.groovy Maven / Gradle / Ivy
package com.danielsomerfield.cvecheck.gradle
import com.danielsomerfield.cvecheck.GradleTaskConfigurator
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.slf4j.Logger
import org.slf4j.LoggerFactory
class DependencyCheckGradlePlugin implements Plugin {
private Logger logger = LoggerFactory.getLogger(getClass())
private CVECheckExtensionBootstrap bootstrap = new CVECheckExtensionBootstrap()
@Override
void apply(final Project project) {
logVersion()
GradleTaskConfigurator configurator = new GradleTaskConfigurator(project)
project.extensions.add("cvecheck", bootstrap.extension())
project.getTasks().create("scan") << {
configurator.scanTask().scan(project)
}
}
def logVersion() {
Properties properties = new Properties()
getClass().getResourceAsStream("/application.properties").withCloseable { InputStream i ->
properties.load(i)
}
logger.info("Running version ${properties.getProperty("application.version")}")
}
}