@@ -5,19 +5,34 @@ import org.gradle.testfixtures.ProjectBuilder
55import org.gradlex.jvm.dependency.conflict.detection.rules.CapabilityDefinition
66import spock.lang.Specification
77
8+ import java.util.stream.Collectors
89import java.util.zip.ZipFile
910
1011class JarOverlapTest extends Specification {
1112
13+ def allSupportedDependencies = []
14+
15+ void setup () {
16+ allSupportedDependencies = new File (" samples/sample-all/build.gradle.kts" )
17+ .readLines()
18+ .findAll { it. contains(" implementation(" ) }
19+ .collect { it. trim() }
20+ .collect { it. replace(" implementation(\" " , " " ) }
21+ .collect { it. replace(" \" )" , " " ) }
22+ }
23+
1224 def " it works" (CapabilityDefinition definition) {
1325 given :
1426 def project = ProjectBuilder . builder(). build()
1527 def dependencies = project. getDependencies()
1628 project. getPlugins(). apply(" jvm-ecosystem" )
1729 project. getRepositories(). mavenCentral()
1830
19- def modules = definition. modules. collect { dependencies. create(" $it :latest.release" ) }
31+ def modules = definition. modules. collect { dependencies. create(it) }
32+ def constraints = allSupportedDependencies. collect { dependencies. constraints. create(it) }
33+
2034 Configuration conf = project. getConfigurations(). detachedConfiguration(* modules)
35+ conf. dependencyConstraints. addAll(constraints)
2136 conf. transitive = false
2237
2338 when :
@@ -37,4 +52,6 @@ class JarOverlapTest extends Specification {
3752 where :
3853 definition << CapabilityDefinition . values()
3954 }
55+
56+
4057}
0 commit comments