Skip to content

Commit

Permalink
Add test for constraint corner case
Browse files Browse the repository at this point in the history
If a single node contains multiple constraints to the same target, they
must all be tracked for deselection / reselection.

Issue #13551
  • Loading branch information
ljacomet committed Jun 23, 2020
1 parent 979fa8a commit 11726d3
Showing 1 changed file with 38 additions and 0 deletions.
Expand Up @@ -19,6 +19,7 @@ import org.gradle.integtests.fixtures.AbstractPolyglotIntegrationSpec
import org.gradle.integtests.fixtures.ToBeFixedForInstantExecution
import org.gradle.integtests.fixtures.resolve.ResolveTestFixture
import spock.lang.Issue
import spock.lang.Unroll

/**
* This is a variation of {@link PublishedDependencyConstraintsIntegrationTest} that tests dependency constraints
Expand Down Expand Up @@ -751,4 +752,41 @@ class DependencyConstraintsIntegrationTest extends AbstractPolyglotIntegrationSp
then:
outputContains("org:bar: FAILED")
}

@ToBeFixedForInstantExecution(because = "broken file collection")
@Unroll
void 'multiple dependency constraints on single module are all taken into account (#one then #two)'() {
def bar10 = mavenRepo.module('org', 'bar', '1.0').publish()
def bar20 = mavenRepo.module('org', 'bar', '2.0').publish()
def foo10 = mavenRepo.module('org', 'foo', '1.0').dependsOn(bar10).publish()
def foo13 = mavenRepo.module('org', 'foo', '1.3').dependsOn(bar10).publish()
def bar15 = mavenRepo.module('org', 'bar', '1.5').publish()
def foo15 = mavenRepo.module('org', 'foo', '1.5').dependsOn(bar15).publish()
def third = mavenRepo.module('org', 'third', '1.0').dependsOn(foo15).publish()
def second = mavenRepo.module('org', 'second', '1.0').dependsOn(third).dependsOn(foo13).publish()
mavenRepo.module('org', 'first', '1.0').dependsOn(second).dependsOn(foo10).publish()
writeSpec {
rootProject {
dependencies {
constraints {
conf "org:bar:$one"
conf "org:bar:$two"
}
conf('org:first:1.0')
}
}
}
when:
succeeds 'dependencyInsight', '--configuration', 'conf', '--dependency', 'org:bar'
then:
outputContains("org:bar:2.0")
where:
one | two
'1.5' | '2.0'
'2.0' | '1.5'
}
}

0 comments on commit 11726d3

Please sign in to comment.