diff options
author | 2021-11-17 03:06:39 +0100 | |
---|---|---|
committer | 2021-11-17 03:06:39 +0100 | |
commit | 720b9e2fb0968905e5a80f6099eab37554a6af58 (patch) | |
tree | b471f4da129efbfa730830a70e0107de852833d7 /gradle/jmh.gradle | |
parent | build: use version catalogs (diff) | |
download | refinery-720b9e2fb0968905e5a80f6099eab37554a6af58.tar.gz refinery-720b9e2fb0968905e5a80f6099eab37554a6af58.tar.zst refinery-720b9e2fb0968905e5a80f6099eab37554a6af58.zip |
build: move scripts into script plugins
Script plugins allow applying other plugins from plugins { } blocks,
which simplifies the build script.
Diffstat (limited to 'gradle/jmh.gradle')
-rw-r--r-- | gradle/jmh.gradle | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/gradle/jmh.gradle b/gradle/jmh.gradle deleted file mode 100644 index aa58c2b7..00000000 --- a/gradle/jmh.gradle +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | configurations { | ||
2 | jmh { | ||
3 | extendsFrom implementation | ||
4 | } | ||
5 | } | ||
6 | |||
7 | sourceSets { | ||
8 | jmh { | ||
9 | java.srcDirs = ['src/jmh/java'] | ||
10 | resources.srcDirs = ['src/jmh/resources'] | ||
11 | compileClasspath += sourceSets.main.runtimeClasspath | ||
12 | compileClasspath += sourceSets.test.runtimeClasspath | ||
13 | } | ||
14 | } | ||
15 | |||
16 | dependencies { | ||
17 | jmhImplementation libs.jmh.core | ||
18 | jmhAnnotationProcessor libs.jmh.annprocess | ||
19 | } | ||
20 | |||
21 | tasks.register('jmh', JavaExec) { | ||
22 | dependsOn tasks.named('jmhClasses') | ||
23 | main = 'org.openjdk.jmh.Main' | ||
24 | classpath = sourceSets.jmh.compileClasspath + sourceSets.jmh.runtimeClasspath | ||
25 | } | ||
26 | |||
27 | eclipse.classpath { | ||
28 | plusConfigurations += [configurations.jmhCompileClasspath, configurations.jmhRuntimeClasspath] | ||
29 | |||
30 | file.whenMerged { classpath -> | ||
31 | for (entry in classpath.entries) { | ||
32 | // Workaround from https://github.com/gradle/gradle/issues/4802#issuecomment-407902081 | ||
33 | if (entry in org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry) { | ||
34 | def usedBy = (entry.entryAttributes['gradle_used_by_scope'] ?: '').split(',') | ||
35 | if (usedBy == ['jmh']) { | ||
36 | // Allow test helper classes to be used in benchmarks from Eclipse | ||
37 | // and do not expose JMH dependencies to the main source code. | ||
38 | entry.entryAttributes['test'] = true | ||
39 | } else if ((usedBy.contains('main') || usedBy.contains('test')) && !usedBy.contains('jmh')) { | ||
40 | // main and test sources are also used by jmh sources. | ||
41 | usedBy += 'jmh' | ||
42 | entry.entryAttributes['gradle_used_by_scope'] = usedBy.join(',') | ||
43 | } | ||
44 | } | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | sonarqube.properties { | ||
50 | properties['sonar.tests'] += [ | ||
51 | 'src/jmh/java', | ||
52 | ] | ||
53 | } | ||