8000 extract java, google java format and jmh to separate script plugins by qweek · Pull Request #401 · rsocket/rsocket-java · GitHub
[go: up one dir, main page]

Skip to content

extract java, google java format and jmh to separate script plugins #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 17 additions & 47 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,33 @@
* limitations under the License.
*/

/*
NOTE: plugins block cannot be used in script plugins
TODO: future versions of Gradle will remove this restriction
*/
plugins {
id "com.gradle.build-scan" version "1.9"
id 'com.jfrog.bintray' version '1.7.3'
id 'com.github.sherter.google-java-format' version '0.6'
id 'com.gradle.build-scan' version '1.9' // declare before any other plugin

id 'com.github.sherter.google-java-format' version '0.6' apply false
id 'com.github.johnrengelman.shadow' version '2.0.1' apply false
id 'me.champeau.gradle.jmh' version '0.4.4' apply false
id 'io.morethan.jmhreport' version '0.6.2.1' apply false

id 'com.jfrog.artifactory' version '4.5.2'
id 'me.champeau.gradle.jmh' version '0.4.4'
id 'com.jfrog.bintray' version '1.7.3'
}

repositories {
jcenter()
}
apply from: "$rootDir/gradle/configuration.gradle"
apply from: "$rootDir/gradle/versions.gradle"

description = 'RSocket: stream oriented messaging passing with Reactive Stream semantics.'

buildScan { licenseAgreementUrl = 'https://gradle.com/terms-of-service'; licenseAgree = 'yes' }

subprojects {
apply plugin: 'java'
apply from: "$rootDir/gradle/java.gradle"
apply from: "$rootDir/gradle/codestyle.gradle"

apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
Expand All @@ -40,38 +49,6 @@ subprojects {
group = 'io.rsocket'
version = mavenversion

compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
options.compilerArgs << "-Xlint:deprecation" // << "-Xlint:unchecked"
}

ext {
// common
jsr305Version = '3.0.2'
reactorVersion = '3.1.0.RELEASE'
nettyVersion = '4.1.15.Final'
reactiveStreamsVersion = '1.0.1'
slf4jVersion = '1.7.25'
// aeron
aeronVersion = '1.4.1'
// netty
reactorNettyVersion = '0.7.0.M2'
// spectator
spectatorVersion = '0.57.1'
hdrHistogramVersion = '2.1.9'
// tck-drivers
jacksonVersion = '2.9.1'
commonsLang3Version = '3.6'
airlineVersion = '0.8'
rxjavaVersion = '2.1.3'
// test
junitVersion = '4.12'
hamcrestVersion = '1.3'
mockitoVersion = '2.10.0'
jmhVersion = '1.19'
}

// custom tasks for creating source/javadoc jars
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
Expand All @@ -90,13 +67,6 @@ subprojects {
archives sourcesJar, javadocJar, jar
}

repositories {
maven { url 'http://repo.spring.io/milestone' }
maven { url 'https://oss.jfrog.org/libs-snapshot' }
maven { url 'https://dl.bintray.com/rsocket/RSocket' }
maven { url 'https://dl.bintray.com/reactivesocket/ReactiveSocket' }
}

dependencies {
compile &qu 8000 ot;io.projectreactor:reactor-core:3.1.0.RELEASE"
compile "io.netty:netty-buffer:4.1.15.Final"
Expand Down
51 changes: 51 additions & 0 deletions gradle/benchmark.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'me.champeau.gradle.jmh'
apply plugin: 'io.morethan.jmhreport'

// disable tasks to stop generating duplicate files
jmhClasses.enabled = false
jmhRunBytecodeGenerator.enabled = false
jmhCompileGeneratedClasses.enabled = false

jmhJar {
// add jmh classes to shadow jar
from project.configurations.jmh
from project.configurations.jmhRuntime

// exclude logging classes
exclude 'org.slf4j:slf4j-log4j12'
exclude 'log4j:log4j'
}

jmh {
jmhVersion = '1.19'
includeTests = false
duplicateClassesStrategy = DuplicatesStrategy.WARN
zip64 = true

jvmArgs = ['-XX:+UnlockCommercialFeatures', '-XX:+FlightRecorder']
// NOTE: uncomment to add specific options
// jvmArgsAppend = ['-XX:+UseG1GC', '-Xms4g', '-Xmx4g']
profilers = ['gc']
resultFormat = 'JSON'
}

// run report generation after benchmark
tasks.jmh.finalizedBy tasks.jmhReport

jmhReport {
jmhResultPath = project.file('build/reports/jmh/results.json')
jmhReportOutput = project.file('build/reports/jmh')
}

// remove directory generated by IDEA during benchmark
clean {
project.delete('out')
}

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

jmhRuntime "org.slf4j:slf4j-nop:$slf4jVersion"
}
11 changes: 11 additions & 0 deletions gradle/codestyle.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* Format the Java source code to comply with Google Style */

apply plugin: 'com.github.sherter.google-java-format'

// Use specific version
googleJavaFormat {
toolVersion = '1.1'
}

// NOTE: uncomment to force code formatting before compile
compileJava.dependsOn tasks.googleJavaFormat
17 changes: 17 additions & 0 deletions gradle/configuration.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
task wrapper(type: Wrapper) {
gradleVersion = '4.1'
distributionType = Wrapper.DistributionType.ALL
}

repositories {
jcenter()
}

subprojects {
repositories {
maven { url 'http://repo.spring.io/milestone' }
maven { url 'https://oss.jfrog.org/libs-snapshot' }
maven { url 'https://dl.bintray.com/rsocket/RSocket' }
maven { url 'https://dl.bintray.com/reactivesocket/ReactiveSocket' }
}
}
13 changes: 13 additions & 0 deletions gradle/java.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* Java compiler settings */

apply plugin: 'java'

compileJava {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
options.encoding = 'UTF-8'
options.compilerArgs << '-Xlint:all,-cast,-fallthrough,-overloads,-rawtypes,-serial,-try,-unchecked'
// NOTE: uncomment to include/exclude specific warnings
// << '-Xlint:classfile,deprecation,dep-ann,divzero,empty,finally,options,overrides,path,processing,static,varargs'
// << '-Xdoclint:all,-accessibility,-syntax,-reference,-html,-missing/public'
}
24 changes: 24 additions & 0 deletions gradle/versions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ext {
// common
jsr305Version = '3.0.2'
reactorVersion = '3.1.0.RELEASE'
nettyVersion = '4.1.16.Final'
reactiveStreamsVersion = '1.0.1'
slf4jVersion = '1.7.25'
// aeron
aeronVersion = '1.4.1'
// netty
reactorNettyVersion = '0.7.0.RELEASE'
// spectator
spectatorVersion = '0.57.1'
hdrHistogramVersion = '2.1.10'
// tck-drivers
jacksonVersion = '2.9.1'
commonsLang3Version = '3.6'
airlineVersion = '0.8'
rxjavaVersion = '2.1.4'
// test
junitVersion = '4.12'
hamcrestVersion = '1.3'
mockitoVersion = '2.10.0'
}
15 changes: 3 additions & 12 deletions rsocket-core/build.gradle
8000
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@
* limitations under the License.
*/

apply plugin: 'me.champeau.gradle.jmh'
apply from: "$rootDir/gradle/benchmark.gradle"

jmh {
jmhVersion = "1.19"
profilers = ['gc']
zip64 = true
duplicateClassesStrategy = DuplicatesStrategy.WARN
}

dependencies {
jmh "org.openjdk.jmh:jmh-core:1.19"
jmh "org.openjdk.jmh:jmh-generator-annprocess:1.19"
}
// NOTE: uncomment to run specific test only
// jmh.include = ['io.rsocket.RSocketPerf.fireAndForgetHello']
5 changes: 2 additions & 3 deletions rsocket-core/src/jmh/java/io/rsocket/FragmentationPerf.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@

@BenchmarkMode(Mode.Throughput)
@Fork(
value = 1,
jvmArgsAppend = {"-XX:+UnlockCommercialFeatures", "-XX:+FlightRecorder"}
) //, "-Dio.netty.leakDetection.level=advanced"})
value = 1 // , jvmArgsAppend = {"-Dio.netty.leakDetection.level=advanced"}
)
@Warmup(iterations = 10)
@Measurement(iterations = 10_000)
@State(Scope.Thread)
Expand Down
3 changes: 1 addition & 2 deletions rsocket-core/src/jmh/java/io/rsocket/RSocketPerf.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@

@BenchmarkMode(Mode.Throughput)
@Fork(
value = 1,
jvmArgsAppend = {"-XX:+UnlockCommercialFeatures", "-XX:+FlightRecorder"}
value = 1 // , jvmArgsAppend = {"-Dio.netty.leakDetection.level=advanced"}
)
@Warmup(iterations = 10)
@Measurement(iterations = 10)
Expand Down
16 changes: 1 addition & 15 deletions rsocket-examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,11 @@
* limitations under the License.
*/

apply plugin: 'me.champeau.gradle.jmh'

jmh {
jmhVersion = "1.19"
jvmArgs = ['-XX:+UseG1GC', '-Xmx4g', '-Xms4g', '-XX:+UnlockCommercialFeatures', '-XX:+FlightRecorder']
profilers = ['gc']
zip64 = true
warmupBatchSize = 10
iterations = 500
duplicateClassesStrategy = DuplicatesStrategy.WARN
}

dependencies {
compile project(':rsocket-core')
compile project(':rsocket-spectator')
compile project(':rsocket-transport-netty')
compile project(':rsocket-transport-local')

jmh "org.openjdk.jmh:jmh-generator-annprocess:1.19"

testCompile project(':rsocket-test')
}
}
0