blob: 7e599c3fecefaa37d125d9c5dfd1707c7be3a5f4 (
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
|
package tools.refinery.gradle
import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry
import tools.refinery.gradle.utils.EclipseUtils
plugins {
`java-test-fixtures`
id("tools.refinery.gradle.internal.java-conventions")
}
eclipse.classpath {
containsTestFixtures.set(true)
EclipseUtils.whenClasspathFileMerged(file) { eclipseClasspath ->
val hasTest = eclipseClasspath.entries.any { entry ->
entry is AbstractClasspathEntry && entry.entryAttributes["gradle_scope"] == "test"
}
EclipseUtils.patchClasspathEntries(eclipseClasspath) { entry ->
// 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
EclipseUtils.patchGradleUsedByScope(entry) { usedBy ->
if (usedBy.contains("main")) {
usedBy += "testFixtures"
}
if (hasTest && usedBy.contains("testFixtures")) {
usedBy += "test"
}
}
}
}
}
|