diff --git a/gradle/ide.gradle b/gradle/ide.gradle index 554d4b3c543..39eefb55c4c 100644 --- a/gradle/ide.gradle +++ b/gradle/ide.gradle @@ -29,12 +29,11 @@ eclipse.classpath.file.whenMerged { classpath -> classpath.entries.removeAll { entry -> (entry.path =~ /(?!.*?repack.*\.jar).*?\/([^\/]+)\/build\/libs\/[^\/]+\.jar/) } } - // Use separate main/test outputs (prevents WTP from packaging test classes) eclipse.classpath.defaultOutputDir = file(project.name+"/bin/eclipse") eclipse.classpath.file.beforeMerged { classpath -> classpath.entries.findAll{ it instanceof SourceFolder }.each { - if(it.output.startsWith("bin/")) { + if (it.output.startsWith("bin/")) { it.output = null } } @@ -56,6 +55,23 @@ eclipse.classpath.file.whenMerged { classpath -> } } +// Ensure that test fixture dependencies are handled properly in Gradle 6.7. +// Bug fixed in Gradle 6.8: https://github.com/gradle/gradle/issues/14932 +eclipse.classpath.file.whenMerged { + entries.findAll { it instanceof ProjectDependency }.each { + it.entryAttributes.remove('without_test_code') + } +} + +// Ensure that JMH sources and resources are treated as test classpath entries +// so that they can see test dependencies such as JUnit Jupiter APIs. +// https://github.com/melix/jmh-gradle-plugin/issues/157 +eclipse.classpath.file.whenMerged { + entries.findAll { it.path =~ /src\/jmh\/(java|resources)/ }.each { + it.entryAttributes['test'] = 'true' + } +} + // Allow projects to be used as WTP modules eclipse.project.natures "org.eclipse.wst.common.project.facet.core.nature"