@@ -12,8 +12,8 @@ buildscript {
1212 mavenCentral()
1313 jcenter()
1414 }
15-
16- apply from : file(' gradle/buildscript.gradle' ), to : buildscript
15+
16+ apply from : file(' gradle/buildscript.gradle' ), to : buildscript
1717}
1818
1919allprojects {
@@ -27,6 +27,7 @@ allprojects {
2727
2828subprojects {
2929 apply plugin : ' java'
30+ apply plugin : ' shadow'
3031 group = " com.netflix.rxjava"
3132
3233 // make 'examples' use the same classpath
@@ -45,22 +46,29 @@ subprojects {
4546 sourceSets {
4647 examples
4748 perf {
48- compileClasspath + = sourceSets. main. output
49- }
49+ compileClasspath + = sourceSets. main. output
50+ }
5051 }
5152
5253 tasks. build {
5354 // include 'examples' in build task
5455 dependsOn(examplesClasses)
55- dependsOn(perfClasses)
56+ dependsOn(perfClasses)
57+ }
58+
59+ task perfJar(type : Jar , dependsOn : perfClasses) {
60+ from sourceSets. perf. output + sourceSets. main. output
5661 }
5762
5863 dependencies {
5964 perfCompile ' org.openjdk.jmh:jmh-core:0.5.3'
6065 perfCompile ' org.openjdk.jmh:jmh-generator-annprocess:0.5.3'
61-
6266 // perfCompile project
6367 }
68+
69+ artifacts {
70+ perfRuntime perfJar
71+ }
6472
6573 eclipse {
6674 classpath {
@@ -78,49 +86,59 @@ subprojects {
7886 }
7987 }
8088
81- /**
82- * By default: Run without arguments this will execute all benchmarks that are found (can take a long time).
83- *
84- * Optionally pass arguments for custom execution. Example:
85- *
86- * ../gradlew benchmarks '-Pjmh=-f 1 -tu ns -bm avgt -wi 5 -i 5 -r 1 .*OperatorSerializePerf.*'
87- *
88- * To see all options:
89- *
90- * ../gradlew benchmarks '-Pjmh=-h'
91- */
92- task benchmarks(type : JavaExec ) {
93- main = ' org.openjdk.jmh.Main'
94- classpath = sourceSets. perf. runtimeClasspath + sourceSets. main. output
95- maxHeapSize = " 512m"
96-
97- if (project. hasProperty(' jmh' )) {
98- args(jmh. split(' ' ))
99- } else {
100- // args '-h' // help output
101- args ' -f' // fork
102- args ' 1'
103- args ' -tu' // time unit
104- args ' ns'
105- args ' -bm' // benchmark mode
106- args ' avgt'
107- args ' -wi' // warmup iterations
108- args ' 5'
109- args ' -i' // test iterations
110- args ' 5'
111- args ' -r' // time per execution in seconds
112- args ' 5'
113- // args '-prof' // profilers
114- // args 'HS_GC' // HotSpot (tm) memory manager (GC) profiling via implementation-specific MBeans
115- // args 'HS_RT' // HotSpot (tm) runtime profiling via implementation-specific MBeans
116- // args 'HS_THR' // HotSpot (tm) threading subsystem via implementation-specific MBeans
117- // args 'HS_COMP' // HotSpot (tm) JIT compiler profiling via implementation-specific MBeans
118- // args 'HS_CL' // HotSpot (tm) classloader profiling via implementation-specific MBeans
119- // args 'STACK' // Simple and naive Java stack profiler
120- args ' .*OperatorSerializePerf.*' // for running only a specific test
121- }
122- }
123-
89+ /**
90+ * By default: Run without arguments this will execute all benchmarks that are found (can take a long time).
91+ *
92+ * Optionally pass arguments for custom execution. Example:
93+ *
94+ * ../gradlew benchmarks '-Pjmh=-f 1 -tu ns -bm avgt -wi 5 -i 5 -r 1 .*OperatorSerializePerf.*'
95+ *
96+ * To see all options:
97+ *
98+ * ../gradlew benchmarks '-Pjmh=-h'
99+ */
100+ task benchmarks(type : JavaExec ) {
101+ main = ' org.openjdk.jmh.Main'
102+ classpath = sourceSets. perf. runtimeClasspath + sourceSets. main. output
103+ maxHeapSize = " 512m"
104+
105+ if (project. hasProperty(' jmh' )) {
106+ args(jmh. split(' ' ))
107+ } else {
108+ // args '-h' // help output
109+ args ' -f' // fork
110+ args ' 1'
111+ args ' -tu' // time unit
112+ args ' ns'
113+ args ' -bm' // benchmark mode
114+ args ' avgt'
115+ args ' -wi' // warmup iterations
116+ args ' 5'
117+ args ' -i' // test iterations
118+ args ' 5'
119+ args ' -r' // time per execution in seconds
120+ args ' 5'
121+ // args '-prof' // profilers
122+ // args 'HS_GC' // HotSpot (tm) memory manager (GC) profiling via implementation-specific MBeans
123+ // args 'HS_RT' // HotSpot (tm) runtime profiling via implementation-specific MBeans
124+ // args 'HS_THR' // HotSpot (tm) threading subsystem via implementation-specific MBeans
125+ // args 'HS_COMP' // HotSpot (tm) JIT compiler profiling via implementation-specific MBeans
126+ // args 'HS_CL' // HotSpot (tm) classloader profiling via implementation-specific MBeans
127+ // args 'STACK' // Simple and naive Java stack profiler
128+ args ' .*OperatorSerializePerf.*' // for running only a specific test
129+ }
130+ }
131+
132+ shadow {
133+ classifier = " benchmarks"
134+ includeDependenciesFor = [" runtime" , " perfRuntime" ]
135+
136+ transformer(com.github.jengelman.gradle.plugins.shadow.transformers.ManifestResourceTransformer ) {
137+ mainClass = " org.openjdk.jmh.Main"
138+ }
139+ }
140+
141+ shadowJar. dependsOn perfJar
124142}
125143
126144project(' :rxjava-core' ) {
0 commit comments