File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
src/test/groovy/org/gradlex/jvm/dependency/conflict/test Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ package org.gradlex.jvm.dependency.conflict.test
2+
3+ import org.gradle.api.artifacts.Configuration
4+ import org.gradle.testfixtures.ProjectBuilder
5+ import org.gradlex.jvm.dependency.conflict.detection.rules.CapabilityDefinition
6+ import spock.lang.Specification
7+
8+ import java.util.zip.ZipFile
9+
10+ class JarOverlapTest extends Specification {
11+
12+ def " it works" (CapabilityDefinition definition) {
13+ given :
14+ def project = ProjectBuilder . builder(). build()
15+ def dependencies = project. getDependencies()
16+ project. getPlugins(). apply(" jvm-ecosystem" )
17+ project. getRepositories(). mavenCentral()
18+
19+ def modules = definition. modules. collect { dependencies. create(" $it :latest.release" ) }
20+ Configuration conf = project. getConfigurations(). detachedConfiguration(* modules)
21+ conf. transitive = false
22+
23+ when :
24+ Map<String , Set<String > > jarClassFiles = conf. files. collectEntries { jar ->
25+ def jarName = jar. name
26+ [(jarName): new ZipFile (jar). withCloseable {
27+ it. entries(). collect { entry -> entry. name }. findAll { it. endsWith(" .class" ) } as Set
28+ }]
29+ }
30+
31+ then :
32+ Collection<Set<String > > jarEntries = jarClassFiles. values()
33+ [jarEntries, jarEntries]. combinations(). each { Set a , Set b ->
34+ assert ! a. intersect(b). isEmpty()
35+ }
36+
37+ where :
38+ definition << CapabilityDefinition . values()
39+ }
40+ }
You can’t perform that action at this time.
0 commit comments