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.gradle18
1 files changed, 10 insertions, 8 deletions
diff --git a/buildSrc/src/main/groovy/refinery-jmh.gradle b/buildSrc/src/main/groovy/refinery-jmh.gradle
index 538159a4..1ab9edc3 100644
--- a/buildSrc/src/main/groovy/refinery-jmh.gradle
+++ b/buildSrc/src/main/groovy/refinery-jmh.gradle
@@ -1,3 +1,5 @@
1import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry
2
1plugins { 3plugins {
2 id 'refinery-java-conventions' 4 id 'refinery-java-conventions'
3 id 'refinery-sonarqube' 5 id 'refinery-sonarqube'
@@ -12,9 +14,9 @@ configurations {
12sourceSets { 14sourceSets {
13 jmh { 15 jmh {
14 java.srcDirs = ['src/jmh/java'] 16 java.srcDirs = ['src/jmh/java']
15 resources.srcDirs = ['src/jmh/resources'] 17 resources.srcDirs = ['src/jmh/resources']
16 compileClasspath += sourceSets.main.runtimeClasspath 18 compileClasspath += sourceSets.main.runtimeClasspath
17 compileClasspath += sourceSets.test.runtimeClasspath 19 compileClasspath += sourceSets.test.runtimeClasspath
18 } 20 }
19} 21}
20 22
@@ -25,13 +27,13 @@ dependencies {
25 27
26tasks.register('jmh', JavaExec) { 28tasks.register('jmh', JavaExec) {
27 dependsOn tasks.named('jmhClasses') 29 dependsOn tasks.named('jmhClasses')
28 mainClass = 'org.openjdk.jmh.Main' 30 mainClass = 'org.openjdk.jmh.Main'
29 classpath = sourceSets.jmh.compileClasspath + sourceSets.jmh.runtimeClasspath 31 classpath = sourceSets.jmh.compileClasspath + sourceSets.jmh.runtimeClasspath
30} 32}
31 33
32eclipse.classpath.file.whenMerged { classpath -> 34eclipse.classpath.file.whenMerged { classpath ->
33 for (entry in classpath.entries) { 35 for (entry in classpath.entries) {
34 if (entry in org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry) { 36 if (entry in AbstractClasspathEntry) {
35 // Workaround from https://github.com/gradle/gradle/issues/4802#issuecomment-407902081 37 // Workaround from https://github.com/gradle/gradle/issues/4802#issuecomment-407902081
36 if (entry.entryAttributes['gradle_scope'] == 'jmh') { 38 if (entry.entryAttributes['gradle_scope'] == 'jmh') {
37 // Allow test helper classes to be used in benchmarks from Eclipse 39 // Allow test helper classes to be used in benchmarks from Eclipse
@@ -41,7 +43,7 @@ eclipse.classpath.file.whenMerged { classpath ->
41 // Workaround based on 43 // Workaround based on
42 // https://discuss.gradle.org/t/gradle-used-by-scope-not-correctly-generated-when-the-java-test-fixtures-plugin-is-used/39935/2 44 // https://discuss.gradle.org/t/gradle-used-by-scope-not-correctly-generated-when-the-java-test-fixtures-plugin-is-used/39935/2
43 def usedBy = new LinkedHashSet( 45 def usedBy = new LinkedHashSet(
44 Arrays.asList((entry.entryAttributes['gradle_used_by_scope'] ?: '').split(',')) 46 Arrays.asList((entry.entryAttributes['gradle_used_by_scope'] ?: '').split(','))
45 ) 47 )
46 if (['main', 'test', 'testFixtures'].any { e -> usedBy.contains(e) }) { 48 if (['main', 'test', 'testFixtures'].any { e -> usedBy.contains(e) }) {
47 // main and test sources are also used by jmh sources. 49 // main and test sources are also used by jmh sources.
@@ -57,6 +59,6 @@ eclipse.classpath.file.whenMerged { classpath ->
57 59
58sonarqube.properties { 60sonarqube.properties {
59 properties['sonar.tests'] += [ 61 properties['sonar.tests'] += [
60 'src/jmh/java', 62 'src/jmh/java',
61 ] 63 ]
62} 64}