Skip to content

Commit

Permalink
Filter external dependencies (lost in refactoring)
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Jun 24, 2015
1 parent adc7cc6 commit 91ce2b1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {
}
dependencies {
classpath 'com.github.ben-manes:gradle-versions-plugin:0.11'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.1'
// classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5' // uncomment if you're using Gradle 1.x
}
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'nexus'
apply plugin: 'codenarc'

group = 'com.github.ben-manes'
version = '0.12-SNAPSHOT'
version = '0.11.1'

sourceCompatibility = '1.6'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.gradle.api.artifacts.ComponentSelection
import org.gradle.api.artifacts.ComponentSelectionRules
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.ExternalDependency
import org.gradle.api.artifacts.LenientConfiguration
import org.gradle.api.artifacts.ResolutionStrategy
import org.gradle.api.artifacts.ResolvedDependency
Expand Down Expand Up @@ -83,10 +84,13 @@ class Resolver {

/** Returns a copy of the configuration where dependencies will be resolved up to the revision. */
private Configuration createLatestConfiguration(Configuration configuration, String revision) {
List<Dependency> latest = configuration.dependencies.collect { depenency ->
String version = (depenency.version == null) ? 'none' : '+'
project.dependencies.create("${depenency.group}:${depenency.name}:${version}")
List<Dependency> latest = configuration.dependencies.findAll { dependency ->
dependency instanceof ExternalDependency
}.collect { dependency ->
String version = (dependency.version == null) ? 'none' : '+'
project.dependencies.create("${dependency.group}:${dependency.name}:${version}")
}

Configuration copy = configuration.copyRecursive().setTransitive(false)
copy.dependencies.clear()
copy.dependencies.addAll(latest)
Expand Down

0 comments on commit 91ce2b1

Please sign in to comment.