neoremind commented on a change in pull request #1880: Make ubenchmark clases 
executable from IDEA
URL: https://github.com/apache/calcite/pull/1880#discussion_r399633618
 
 

 ##########
 File path: ubenchmark/build.gradle.kts
 ##########
 @@ -22,12 +22,29 @@ dependencies {
     // Make jmhCompileClasspath resolvable
     @Suppress("DEPRECATION")
     jmhCompileClasspath(platform(project(":bom")))
-    jmh(project(":core"))
-    jmh(project(":linq4j"))
-    jmh("com.google.guava:guava")
-    jmh("org.codehaus.janino:commons-compiler")
-    jmh("org.openjdk.jmh:jmh-core")
-    jmh("org.openjdk.jmh:jmh-generator-annprocess")
+    jmhImplementation(project(":core"))
+    jmhImplementation(project(":linq4j"))
+    jmhImplementation("com.google.guava:guava")
+    jmhImplementation("org.codehaus.janino:commons-compiler")
+    jmhImplementation("org.openjdk.jmh:jmh-core")
+    jmhImplementation("org.openjdk.jmh:jmh-generator-annprocess")
 }
 
 // See https://github.com/melix/jmh-gradle-plugin
+// Unfortunately, current jmh-gradle-plugin does not allow to cusomize jmh 
parameters from the
+// command line, so the workarounds are:
+// a) Build and execute the jar itself: ./gradlew jmhJar && java -jar 
build/libs/calcite-...jar JMH_OPTIONS
+// b) Execute benchmarks via .main() methods from IDE (you might want to 
activate "power save mode"
+//    in the IDE to minimize the impact of the IDE itself on the benchmark 
results)
+
+tasks.withType<JavaExec>().configureEach {
+    // Execution of .main methods from IDEA should re-generate benchmark 
classes if required
+    dependsOn("jmhCompileGeneratedClasses")
+    doFirst {
+        // At best jmh plugin should add the generated directories to the 
Gradle model, however,
+        // currently it builds the jar only :-/
+        // IntelliJ IDEA "execute main method" adds a JavaExec task, so we 
configure it
+        classpath(File(buildDir, "jmh-generated-classes"))
+        classpath(File(buildDir, "jmh-generated-resources"))
 
 Review comment:
   @vlsi I might mislead you, maybe that is my env problem. No rush to look 
into this, unless any one else come into this trouble again.
   My idea version is the latest community one.
   ```
   IntelliJ IDEA 2019.3.3 (Community Edition)
   Build #IC-193.6494.35, built on February 11, 2020
   Runtime version: 11.0.5+10-b520.38 x86_64
   VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
   macOS 10.12.6
   GC: ParNew, ConcurrentMarkSweep
   Memory: 1981M
   Cores: 8
   Registry: 
   Non-Bundled Plugins: CheckStyle-IDEA, FindBugs-IDEA, Lombook Plugin, 
OdpsStudio, com.alibaba.p3c.smartfox, com.poratu.idea.plugins.tomcat, 
org.intellij.scala
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to