Skip to content

Commit

Permalink
Merge reactor#2775 into 3.4.11
Browse files Browse the repository at this point in the history
Amended TestBestPracticesArchTest to adapt to new ArchUnit version.
  • Loading branch information
simonbasle committed Sep 24, 2021
2 parents 23f3a7b + d8cf061 commit bf3ea41
Show file tree
Hide file tree
Showing 22 changed files with 117 additions and 111 deletions.
6 changes: 3 additions & 3 deletions benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ dependencies {
compileOnly "io.projectreactor:reactor-core:${perfBaselineVersion}"
compileOnly "com.google.code.findbugs:jsr305:${findbugsVersion}"

implementation "org.openjdk.jmh:jmh-core:1.21"
implementation "org.openjdk.jmh:jmh-core:${jmhVersion}"
implementation "io.projectreactor.addons:reactor-extra:3.3.3.RELEASE", {
exclude group: 'io.projectreactor', module: 'reactor-core'
}
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:1.21"
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:${jmhVersion}"

current project(':reactor-core')
baseline "io.projectreactor:reactor-core:${perfBaselineVersion}", {
Expand All @@ -29,7 +29,7 @@ dependencies {

task jmhProfilers(type: JavaExec, description:'Lists the available profilers for the jmh task', group: 'Development') {
classpath = sourceSets.main.runtimeClasspath
main = 'org.openjdk.jmh.Main'
mainClass.set('org.openjdk.jmh.Main')
args '-lprof'
}

Expand Down
66 changes: 34 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@ import java.text.SimpleDateFormat

buildscript {
// we define kotlin version for benefit of both core and test (see kotlin-gradle-plugin below)
ext.kotlinVersion = '1.3.72'
ext.kotlinVersion = '1.5.31'
repositories {
mavenCentral()
maven { url "https://repo.spring.io/plugins-release" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.24.5" //applied in individual submodules
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.24.18" //applied in individual submodules
}
}


plugins {
id "com.github.johnrengelman.shadow" version "4.0.2"
id 'org.asciidoctor.jvm.convert' version '3.3.0' apply false
id 'org.asciidoctor.jvm.pdf' version '3.3.0' apply false
id "me.champeau.gradle.japicmp" version "0.2.6"
id "de.undercouch.download" version "3.4.3"
id "org.unbroken-dome.test-sets" version "3.0.0" apply false
id "com.github.johnrengelman.shadow" version "7.0.0"
id 'org.asciidoctor.jvm.convert' version '3.3.2' apply false
id 'org.asciidoctor.jvm.pdf' version '3.3.2' apply false
id "me.champeau.gradle.japicmp" version "0.3.0"
id "de.undercouch.download" version "4.1.2"
id "org.unbroken-dome.test-sets" version "4.0.0" apply false
// note: build scan plugin now must be applied in settings.gradle
// plugin portal is now outdated due to bintray sunset, at least for artifactory gradle plugin
id 'biz.aQute.bnd.builder' version '5.0.1' apply false
id 'io.spring.nohttp' version '0.0.5.RELEASE'
id 'biz.aQute.bnd.builder' version '5.3.0' apply false
id 'io.spring.nohttp' version '0.0.9'
id "io.github.reyerizo.gradle.jcstress" version "0.8.11" apply false
id "com.diffplug.spotless" version "5.14.0"
id "com.diffplug.spotless" version "5.15.0"
}

apply plugin: "io.reactor.gradle.detect-ci"
Expand Down Expand Up @@ -86,28 +86,34 @@ ext {
* Versions not necessarily bumped by a script (testing, etc...) below:
*/
// Misc not often upgraded

jsr166BackportVersion = '1.0.0.RELEASE'
// Used as a way to get jsr305 annotations.
// 3.0.1 is the last version that has the 'annotations' jar needed on the compile classpath
findbugsVersion = '3.0.1'

jsr166BackportVersion = '1.0.0.RELEASE'

// Blockhound
blockhoundVersion = '1.0.3.RELEASE'
blockhoundVersion = '1.0.6.RELEASE'

// Logging
slf4jVersion = '1.7.12'
logbackVersion = '1.1.2'
slf4jVersion = '1.7.32'
logbackVersion = '1.2.5'

// Testing
jUnitPlatformVersion = '5.6.0'
assertJVersion = '3.19.0' //needs to be manually synchronized in buildSrc
mockitoVersion = '2.23.0'
awaitilityVersion = '3.1.2'
throwingFunctionVersion = '1.5.0'
javaObjectLayoutVersion = '0.9'
testNgVersion = '6.8.5'
jUnitPlatformVersion = '5.8.0' //needs to be manually synchronized in buildSrc
assertJVersion = '3.21.0' //needs to be manually synchronized in buildSrc
mockitoVersion = '3.12.4'
awaitilityVersion = '4.1.0'
throwingFunctionVersion = '1.5.1'
javaObjectLayoutVersion = '0.16'
testNgVersion = '7.4.0'
archUnitVersion = '0.21.0'

// For reactor-tools
byteBuddyVersion = '1.10.9' //sync with plugin version above //TODO bump to 1.11.16 with breaking changes
cgLibVersion = '3.3.0'

// JMH
jmhVersion = '1.33'
}

// only publish scan if a specific gradle entreprise server is passed
Expand Down Expand Up @@ -182,14 +188,10 @@ configure(subprojects) { p ->
maven { url 'https://repo.spring.io/milestone' }
}

jacoco {
toolVersion = '0.8.5'
}

jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
xml.required = true
html.required = true
}
}

Expand All @@ -212,14 +214,14 @@ configure(subprojects) { p ->
// show progress by displaying test classes, avoiding test suite timeouts
TestDescriptor last
beforeTest { TestDescriptor td ->
if (last != td.getParent()) {
if (last != td.getParent() && td.getParent().toString().startsWith("Test class")) {
last = td.getParent()
println last
}
}

if (JavaVersion.current().isJava9Compatible()) {
println "Java 9+: lowering MaxGCPauseMillis to 20ms in ${project.name} ${name}"
println "Java ${JavaVersion.current()}: lowering MaxGCPauseMillis to 20ms in ${project.name} ${name}"
jvmArgs = ["-XX:MaxGCPauseMillis=20"]
}

Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ repositories {
}

dependencies {
testImplementation("org.assertj:assertj-core:3.19.0")
testImplementation platform("org.junit:junit-bom:5.6.0")
testImplementation("org.assertj:assertj-core:3.21.0")
testImplementation platform("org.junit:junit-bom:5.8.0")
testImplementation "org.junit.jupiter:junit-jupiter-api"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
}
Expand Down
57 changes: 27 additions & 30 deletions buildSrc/src/main/java/io/reactor/gradle/JavaConventions.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.tasks.compile.JavaCompile;

/**
Expand All @@ -38,39 +38,36 @@ public void apply(Project project) {
}

private void applyJavaConvention(Project project) {
JavaPluginConvention java = project.getConvention().getPlugin(JavaPluginConvention.class);
JavaPluginExtension java = project.getExtensions().getByType(JavaPluginExtension.class);
java.setSourceCompatibility(JavaVersion.VERSION_1_8);
java.setTargetCompatibility(JavaVersion.VERSION_1_8);

project.getTasks()
.withType(JavaCompile.class)
.forEach(compileTask -> {
compileTask.getOptions().setEncoding("UTF-8");
compileTask.getOptions().setCompilerArgs(Arrays.asList(
"-Xlint:-varargs", // intentionally disabled
"-Xlint:cast",
"-Xlint:classfile",
"-Xlint:dep-ann",
"-Xlint:divzero",
"-Xlint:empty",
"-Xlint:finally",
"-Xlint:overrides",
"-Xlint:path",
"-Xlint:-processing",
"-Xlint:static",
"-Xlint:try",
"-Xmaxerrs", "500",
"-Xmaxwarns", "500",
"-Xlint:deprecation",
"-Xlint:unchecked",
"-Xlint:-serial", // intentionally disabled
"-Xlint:-options", // intentionally disabled
"-Xlint:-fallthrough", // intentionally disabled
"-Xlint:-rawtypes", // TODO enable and fix warnings
"-Xmaxwarns",
"1000"
));
});
.withType(JavaCompile.class)
.forEach(compileTask -> {
compileTask.getOptions().setEncoding("UTF-8");
compileTask.getOptions().setCompilerArgs(Arrays.asList(
"-Xlint:-varargs", // intentionally disabled
"-Xlint:cast",
"-Xlint:classfile",
"-Xlint:dep-ann",
"-Xlint:divzero",
"-Xlint:empty",
"-Xlint:finally",
"-Xlint:overrides",
"-Xlint:path",
"-Xlint:-processing",
"-Xlint:static",
"-Xlint:try",
"-Xlint:deprecation",
"-Xlint:unchecked",
"-Xlint:-serial", // intentionally disabled
"-Xlint:-options", // intentionally disabled
"-Xlint:-fallthrough", // intentionally disabled
"-Xmaxerrs", "500",
"-Xmaxwarns", "1000"
));
});

if (JavaVersion.current().isJava8Compatible()) {
project.getTasks().withType(JavaCompile.class, t -> {
Expand Down
2 changes: 1 addition & 1 deletion gradle/setup.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ if (qualifyVersion("$version") in ["RELEASE", "MILESTONE"] || rootProject.hasPro

signing {
//requiring signature if there is a publish task that is not to MavenLocal
required { gradle.taskGraph.allTasks.any { it.name.toLowerCase().contains("publish") && !it.name.contains("MavenLocal") } }
required { gradle.taskGraph.allTasks.any { it.name.toLowerCase().contains("publish") && !it.name.contains("MavenLocal") && !it.name.contains("MockRepository") } }
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ set CMD_LINE_ARGS=%*

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

Expand Down
6 changes: 3 additions & 3 deletions reactor-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ dependencies {
}

// JSR-305 annotations
compileOnly "com.google.code.findbugs:jsr305:${findbugsVersion}"
testCompileOnly "com.google.code.findbugs:jsr305:${findbugsVersion}"
compileOnly "com.google.code.findbugs:jsr305:$findbugsVersion"
testCompileOnly "com.google.code.findbugs:jsr305:$findbugsVersion"

// Optional Logging Operator
compileOnly "org.slf4j:slf4j-api:$slf4jVersion"
Expand Down Expand Up @@ -104,7 +104,7 @@ dependencies {
testImplementation "org.openjdk.jol:jol-core:$javaObjectLayoutVersion"
testImplementation "org.awaitility:awaitility:$awaitilityVersion"
testImplementation "com.pivovarit:throwing-function:$throwingFunctionVersion"
testImplementation "com.tngtech.archunit:archunit:0.12.0"
testImplementation "com.tngtech.archunit:archunit:$archUnitVersion"

// withMicrometerTest is a test-set that validates what happens when micrometer *IS*
// on the classpath. Needs sourceSets.test.output because tests there use helpers like AutoDisposingRule etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.junit.jupiter.api.Test;

import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes;
import static org.assertj.core.api.Assertions.assertThat;

public class CurrentContextArchTest {

Expand All @@ -43,6 +44,11 @@ public class CurrentContextArchTest {
.withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_JARS)
.importPackagesOf(reactor.core.publisher.FluxProcessor.class);

@Test
void smokeTestWhereClassesLoaded() {
assertThat(CORE_SUBSCRIBER_CLASSES).isNotEmpty();
}

@Test
public void corePublishersShouldNotUseDefaultCurrentContext() {
classes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,14 @@ public String toString() {

assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() -> {
assertThat(queueSubscription).isNull();
assertThat(queueSubscription).isSameAs("foo");
})
.withMessage("\n" + "expected: null\n" + "but was : ThisIsNotAQueue");
.withMessage("\n" +
"Expecting actual:\n" +
" \"foo\"\n" +
"and actual:\n" +
" ThisIsNotAQueue\n" +
"to refer to the same object");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void unsubscribingTwiceDoesUnsubscribeOnce() {
public void settingSameDisposableTwiceDoesUnsubscribeIt() {
Disposable underlying = mock(Disposable.class);
sequentialDisposable.update(underlying);
verifyZeroInteractions(underlying);
verifyNoInteractions(underlying);
sequentialDisposable.update(underlying);
verify(underlying).dispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
package reactor.core.publisher;

import java.lang.ref.WeakReference;
import java.time.Duration;
import java.util.concurrent.atomic.AtomicReference;

import org.awaitility.Awaitility;
import org.awaitility.Duration;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
Expand Down Expand Up @@ -147,9 +147,9 @@ public void justUnsubscribed() throws Exception {
ts.cancel();
o = null;

Awaitility.with().pollDelay(Duration.ZERO).pollInterval(Duration.ONE_MILLISECOND)
Awaitility.with().pollDelay(Duration.ZERO).pollInterval(Duration.ofMillis(1))
.await()
.atMost(Duration.FIVE_SECONDS)
.atMost(Duration.ofSeconds(5))
.untilAsserted(() -> {
System.gc();
Object garbage = new Object();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1753,9 +1753,9 @@ public void errorModeContinueInternalErrorStopStrategyAsync() {
.expectComplete()
.verifyThenAssertThat();

Awaitility.with().pollDelay(org.awaitility.Duration.ZERO).pollInterval(org.awaitility.Duration.ONE_MILLISECOND)
Awaitility.with().pollDelay(Duration.ZERO).pollInterval(Duration.ofMillis(1))
.await()
.atMost(org.awaitility.Duration.ONE_SECOND)
.atMost(Duration.ofSeconds(1))
.untilAsserted(() -> assertions.hasNotDroppedElements().hasDroppedErrors(1));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
package reactor.core.publisher;

import java.lang.ref.WeakReference;
import java.time.Duration;
import java.util.concurrent.atomic.AtomicReference;

import org.awaitility.Awaitility;
import org.awaitility.Duration;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Subscriber;
import reactor.core.Scannable;
Expand Down Expand Up @@ -128,9 +128,9 @@ public void justUnsubscribed() throws Exception {
ts.cancel();
o = null;

Awaitility.with().pollDelay(Duration.ZERO).pollInterval(Duration.ONE_MILLISECOND)
Awaitility.with().pollDelay(Duration.ZERO).pollInterval(Duration.ofMillis(1))
.await()
.atMost(Duration.FIVE_SECONDS)
.atMost(Duration.ofSeconds(5))
.untilAsserted(() -> {
System.gc();
Object garbage = new Object();
Expand Down
Loading

0 comments on commit bf3ea41

Please sign in to comment.