Skip to content

Commit

Permalink
Use Configuration#withDependencies
Browse files Browse the repository at this point in the history
Add reason to dependency

#148
  • Loading branch information
sghill committed May 27, 2020
1 parent d3295c8 commit 0a22f8b
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ package org.jenkinsci.gradle.plugins.jpi
import hudson.util.VersionNumber
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.DependencySet
import org.gradle.api.model.ReplacedBy
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.provider.Property
Expand Down Expand Up @@ -150,8 +153,15 @@ class JpiExtension {
jenkinsWarCoordinates = [group: 'org.jenkins-ci.main', name: 'jenkins-war', version: v]
def lookup = new DependencyLookup()
for (String config : lookup.configurations()) {
lookup.find(config, this.coreVersion).each {
project.dependencies.add(config, it)
def toAdd = lookup.find(config, coreVersion).collect {
project.dependencies.create(it) { Dependency d ->
d.because('Added by org.jenkins-ci.jpi plugin')
}
}
project.configurations.getByName(config) { Configuration c ->
c.withDependencies { DependencySet deps ->
deps.addAll(toAdd)
}
}
}
}
Expand Down

0 comments on commit 0a22f8b

Please sign in to comment.