melix / jmh-gradle-plugin

Integrates the JMH benchmarking framework with Gradle
Apache License 2.0
666 stars 88 forks source link

Eclipse's test attribute #157

Closed ben-manes closed 10 months ago

ben-manes commented 4 years ago

Eclipse Photon introduced a Contains test source attribute for containerization of those classes. Recent Gradle / Buildship added support for this, which results in test sources not being visible to JMH sources in Eclipse. The workaround is to also make the JMH sources part of the test container.

eclipse.classpath.file.whenMerged {
  entries.find { it.path == 'src/jmh/java' }.entryAttributes['test'] = 'true'
}
sbrannen commented 3 years ago

We've run into a similar issue in the build for the Spring Framework. Specifically, our JMH sources could not see types from our Java test fixtures.

In order to properly support JMH resources as well, we've had to modify the suggested workaround as follows.

eclipse.classpath.file.whenMerged {
    entries.findAll { it.path =~ /src\/jmh\/(java|resources)/ }.each {
        it.entryAttributes['test'] = 'true'
    }
}
ben-manes commented 10 months ago

verified this was fixed in the newly released 0.7.2

sbrannen commented 10 months ago

I don't see a "milestone" or "release" for 0.7.2.

@melix, can you please add those?

Thanks in advance!