Skip to content

Commit

Permalink
Copy dependency attributes for dynamic query (fixes #334)
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Sep 8, 2020
1 parent ce34c21 commit 11b6f75
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,16 @@ class Resolver {
// query (see issue #97). Otherwise if its a file then use 'none' to pass it through.
String version = (dependency.version == null) ? (dependency.artifacts.empty ? '+' : 'none') : '+'

return project.dependencies.create("${dependency.group}:${dependency.name}:${version}") {
def latest = project.dependencies.create("${dependency.group}:${dependency.name}:${version}") {
transitive = false
}
latest.attributes { container ->
for (def key : dependency.attributes.keySet()) {
def value = dependency.attributes.getAttribute(key)
container.attribute(key, value)
}
}
return latest
}

/** Returns a variant of the provided dependency used for querying the latest version. */
Expand Down

0 comments on commit 11b6f75

Please sign in to comment.