blob: 02568abde057f406c9ca052165b8ee197e3af7c1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry
plugins {
id 'java-test-fixtures'
id 'refinery-java-conventions'
}
eclipse.classpath {
containsTestFixtures = true
file.whenMerged { classpath ->
def hasTest = classpath.entries.any { entry ->
entry in AbstractClasspathEntry &&
entry.entryAttributes['gradle_scope'] == 'test'
}
for (entry in classpath.entries) {
// Workaround https://github.com/gradle/gradle/issues/11845 based on
// https://discuss.gradle.org/t/gradle-used-by-scope-not-correctly-generated-when-the-java-test-fixtures-plugin-is-used/39935/2
if (entry in AbstractClasspathEntry) {
def usedBy = new LinkedHashSet(
Arrays.asList((entry.entryAttributes['gradle_used_by_scope'] ?: '').split(','))
)
if (usedBy.contains('main')) {
usedBy += 'testFixtures'
}
if (hasTest && usedBy.contains('testFixtures')) {
usedBy += 'test'
}
if (!usedBy.empty) {
entry.entryAttributes['gradle_used_by_scope'] = usedBy.join(',')
}
}
}
}
}
|