Skip to content

Commit 408514a

Browse files
committed
Merge branch 'master' into copilot/add-jspecify-annotations-ce85e181-c15c-45b6-ace7-d0ef898a87a8
2 parents 87ebe35 + 9ae83ab commit 408514a

File tree

95 files changed

+3991
-4213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+3991
-4213
lines changed

build.gradle

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ dependencies {
156156
// this is needed for the idea jmh plugin to work correctly
157157
jmh 'org.openjdk.jmh:jmh-core:1.37'
158158
jmh 'org.openjdk.jmh:jmh-generator-annprocess:1.37'
159+
jmh 'me.bechberger:ap-loader-all:4.0-10'
159160

160161
// comment this in if you want to run JMH benchmarks from idea
161162
// jmhAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.37'
@@ -228,7 +229,38 @@ jmh {
228229
includes = [project.property('jmhInclude')]
229230
}
230231
if (project.hasProperty('jmhProfilers')) {
231-
profilers = [project.property('jmhProfilers')]
232+
def profStr = project.property('jmhProfilers') as String
233+
if (profStr.startsWith('async')) {
234+
// Resolve native lib from ap-loader JAR on the jmh classpath
235+
def apJar = configurations.jmh.files.find { it.name.contains('ap-loader') }
236+
if (apJar) {
237+
def proc = ['java', '-jar', apJar.absolutePath, 'agentpath'].execute()
238+
proc.waitFor(10, java.util.concurrent.TimeUnit.SECONDS)
239+
def libPath = proc.text.trim()
240+
if (libPath && new File(libPath).exists()) {
241+
if (profStr == 'async') {
242+
profilers = ["async:libPath=${libPath}"]
243+
} else {
244+
profilers = [profStr.replaceFirst('async:', "async:libPath=${libPath};")]
245+
}
246+
} else {
247+
profilers = [profStr]
248+
}
249+
} else {
250+
profilers = [profStr]
251+
}
252+
} else {
253+
profilers = [profStr]
254+
}
255+
}
256+
if (project.hasProperty('jmhFork')) {
257+
fork = project.property('jmhFork') as int
258+
}
259+
if (project.hasProperty('jmhIterations')) {
260+
iterations = project.property('jmhIterations') as int
261+
}
262+
if (project.hasProperty('jmhWarmupIterations')) {
263+
warmupIterations = project.property('jmhWarmupIterations') as int
232264
}
233265
}
234266

0 commit comments

Comments
 (0)