aboutsummaryrefslogtreecommitdiffstats
path: root/gradle/jmh.gradle
blob: ea88f3e3df79390e417f08d8ec66ab5744e0ca37 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
configurations {
	jmh {
		extendsFrom compile
	}
}

sourceSets {
	jmh {
		java.srcDirs = ['src/jmh/java']
        resources.srcDirs = ['src/jmh/resources']
        compileClasspath += sourceSets.main.runtimeClasspath
        compileClasspath += sourceSets.test.runtimeClasspath
        xtendOutputDir = 'src/jmh/xtend-gen'
	}
}

dependencies {
	jmhRuntime "org.openjdk.jmh:jmh-core:${jmhVersion}"
	jmhCompile "org.openjdk.jmh:jmh-generator-annprocess:${jmhVersion}"
	jmhAnnotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:${jmhVersion}"
}

clean.doLast {
	delete 'src/jmh/xtend-gen'
}

task jmh(type: JavaExec, dependsOn: jmhClasses) {
    main = 'org.openjdk.jmh.Main'
    classpath = sourceSets.jmh.compileClasspath + sourceSets.jmh.runtimeClasspath
}

eclipse.classpath {
	plusConfigurations += [configurations.jmh]

	// Allow test helper classes to be used in benchmarks from Eclipse.
	file.whenMerged { classpath ->
		def jmhClasspathEntry = classpath.entries.find { entry -> entry.path == 'src/jmh/java' }
		jmhClasspathEntry.entryAttributes['test'] = true
	}
}