aboutsummaryrefslogtreecommitdiffstats
path: root/buildSrc/src/main/groovy/refinery-jmh.gradle
diff options
context:
space:
mode:
Diffstat (limited to 'buildSrc/src/main/groovy/refinery-jmh.gradle')
-rw-r--r--buildSrc/src/main/groovy/refinery-jmh.gradle64
1 files changed, 0 insertions, 64 deletions
diff --git a/buildSrc/src/main/groovy/refinery-jmh.gradle b/buildSrc/src/main/groovy/refinery-jmh.gradle
deleted file mode 100644
index 1ab9edc3..00000000
--- a/buildSrc/src/main/groovy/refinery-jmh.gradle
+++ /dev/null
@@ -1,64 +0,0 @@
1import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry
2
3plugins {
4 id 'refinery-java-conventions'
5 id 'refinery-sonarqube'
6}
7
8configurations {
9 jmh {
10 extendsFrom implementation
11 }
12}
13
14sourceSets {
15 jmh {
16 java.srcDirs = ['src/jmh/java']
17 resources.srcDirs = ['src/jmh/resources']
18 compileClasspath += sourceSets.main.runtimeClasspath
19 compileClasspath += sourceSets.test.runtimeClasspath
20 }
21}
22
23dependencies {
24 jmhImplementation libs.jmh.core
25 jmhAnnotationProcessor libs.jmh.annprocess
26}
27
28tasks.register('jmh', JavaExec) {
29 dependsOn tasks.named('jmhClasses')
30 mainClass = 'org.openjdk.jmh.Main'
31 classpath = sourceSets.jmh.compileClasspath + sourceSets.jmh.runtimeClasspath
32}
33
34eclipse.classpath.file.whenMerged { classpath ->
35 for (entry in classpath.entries) {
36 if (entry in AbstractClasspathEntry) {
37 // Workaround from https://github.com/gradle/gradle/issues/4802#issuecomment-407902081
38 if (entry.entryAttributes['gradle_scope'] == 'jmh') {
39 // Allow test helper classes to be used in benchmarks from Eclipse
40 // and do not expose JMH dependencies to the main source code.
41 entry.entryAttributes['test'] = true
42 } else {
43 // Workaround based on
44 // https://discuss.gradle.org/t/gradle-used-by-scope-not-correctly-generated-when-the-java-test-fixtures-plugin-is-used/39935/2
45 def usedBy = new LinkedHashSet(
46 Arrays.asList((entry.entryAttributes['gradle_used_by_scope'] ?: '').split(','))
47 )
48 if (['main', 'test', 'testFixtures'].any { e -> usedBy.contains(e) }) {
49 // main and test sources are also used by jmh sources.
50 usedBy += 'jmh'
51 }
52 if (!usedBy.empty) {
53 entry.entryAttributes['gradle_used_by_scope'] = usedBy.join(',')
54 }
55 }
56 }
57 }
58}
59
60sonarqube.properties {
61 properties['sonar.tests'] += [
62 'src/jmh/java',
63 ]
64}