Skip to content

Commit

Permalink
Spring Boot 3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Spikhalskiy committed Jan 25, 2023
1 parent 301faf7 commit 0c252f8
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ steps:
agents:
queue: "default"
docker: "*"
command: "./gradlew --no-daemon test -x checkLicenseMain -x checkLicenses -x spotlessCheck -x spotlessApply -x spotlessJava"
command: "./gradlew --no-daemon test -x checkLicenseMain -x checkLicenses -x spotlessCheck -x spotlessApply -x spotlessJava -P edgeDepsTest"
timeout_in_minutes: 15
plugins:
- docker-compose#v3.8.0:
Expand All @@ -14,7 +14,7 @@ steps:
agents:
queue: "default"
docker: "*"
command: "./gradlew --no-daemon test -x checkLicenseMain -x checkLicenses"
command: "./gradlew --no-daemon test -x checkLicenseMain -x checkLicenses -x spotlessCheck -x spotlessApply -x spotlessJava"
timeout_in_minutes: 15
plugins:
- docker-compose#v3.8.0:
Expand Down
9 changes: 6 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
buildscript {
ext {
palantirGitVersionVersion = "${JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_11) ? '0.15.0' : '0.13.0'}"
kotlinVersion = "${JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_16) ? '1.5.32' : '1.4.32'}"
kotlinVersion = "${project.hasProperty("edgeDepsTest") ? '1.8.0' : (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_16) ? '1.5.32' : '1.4.32')}"
}
}

Expand All @@ -16,7 +16,8 @@ plugins {
// id 'org.jetbrains.kotlin.jvm' version '1.4.32'
// id 'org.jetbrains.kotlin.jvm' version '1.5.32'
// id 'org.jetbrains.kotlin.jvm' version '1.6.21'
// id 'org.jetbrains.kotlin.jvm' version '1.7.20'
// id 'org.jetbrains.kotlin.jvm' version '1.7.22'
// id 'org.jetbrains.kotlin.jvm' version '1.8.0'
id 'org.jetbrains.kotlin.jvm' version "${kotlinVersion}" apply false
id 'base'
}
Expand All @@ -43,7 +44,9 @@ ext {

jsonPathVersion = '2.7.0' // compileOnly

springBootVersion = '2.7.8'// [2.4.0,)
// Spring Boot 3 requires Java 17, java-sdk builds against 2.x version because we support Java 8.
// We do test compatibility with Spring Boot 3 in integration tests.
springBootVersion = project.hasProperty("edgeDepsTest") ? '3.0.2' : '2.7.8'// [2.4.0,)

// test scoped
logbackVersion = '1.2.11' // we don't upgrade to 1.3 and 1.4 because they require slf4j 2.x
Expand Down
2 changes: 1 addition & 1 deletion docker/buildkite/Dockerfile-JDK18
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM eclipse-temurin:11-focal
FROM eclipse-temurin:18-focal

# Git is needed in order to update the dls submodule
RUN apt-get update && apt-get install -y protobuf-compiler git
Expand Down
11 changes: 7 additions & 4 deletions gradle/java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ subprojects {
apply plugin: 'java-library'

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
if (!project.hasProperty("edgeDepsTest")) {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

withJavadocJar()
withSourcesJar()
}

compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-Xlint:none' << '-Xlint:deprecation' << '-Werror'
if (JavaVersion.current().isJava9Compatible()) {
if (JavaVersion.current().isJava9Compatible() && !project.hasProperty("edgeDepsTest")) {
// https://stackoverflow.com/a/43103115/525203
options.compilerArgs.addAll(['--release', '8'])
}
Expand All @@ -20,7 +23,7 @@ subprojects {
compileTestJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-Xlint:none' << '-Xlint:deprecation' << '-Werror'
if (JavaVersion.current().isJava9Compatible()) {
if (JavaVersion.current().isJava9Compatible() && !project.hasProperty("edgeDepsTest")) {
// https://stackoverflow.com/a/43103115/525203
options.compilerArgs.addAll(['--release', '8'])
}
Expand Down
8 changes: 6 additions & 2 deletions temporal-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ description = '''Temporal Workflow Java SDK Kotlin'''

compileKotlin {
kotlinOptions {
if (!project.hasProperty("edgeDepsTest")) {
jvmTarget = JavaVersion.VERSION_1_8
}
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
jvmTarget = JavaVersion.VERSION_1_8
}
}

compileTestKotlin {
kotlinOptions {
if (!project.hasProperty("edgeDepsTest")) {
jvmTarget = JavaVersion.VERSION_1_8
}
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
jvmTarget = JavaVersion.VERSION_1_8
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.springframework.boot.context.properties.ConstructorBinding;

/** These properties are significantly mirroring {@link WorkflowServiceStubsOptions} */
@ConstructorBinding
public class ConnectionProperties {
public static final String TARGET_LOCAL_SERVICE = "local";

Expand All @@ -43,6 +42,7 @@ public class ConnectionProperties {
* @param enableHttps {@link WorkflowServiceStubsOptions.Builder#setEnableHttps(boolean)}
* (String)}
*/
@ConstructorBinding
public ConnectionProperties(
@Nonnull String target, @Nullable Boolean enableHttps, @Nullable MTLSProperties mtls) {
this.target = target;
Expand All @@ -65,7 +65,6 @@ public MTLSProperties getMTLS() {
return mtls;
}

@ConstructorBinding
public static class MTLSProperties {
private final @Nullable Integer pkcs;

Expand All @@ -89,6 +88,7 @@ public static class MTLSProperties {
* @param insecureTrustManager see {@link
* SimpleSslContextBuilder#setUseInsecureTrustManager(boolean)}
*/
@ConstructorBinding
public MTLSProperties(
@Nullable Integer pkcs,
@Nullable String key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.springframework.boot.context.properties.ConstructorBinding;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

@ConstructorBinding
public class NamespaceProperties {
public static final String NAMESPACE_DEFAULT = "default";

Expand All @@ -36,6 +35,7 @@ public class NamespaceProperties {
private final @Nullable List<WorkerProperties> workers;
private final @Nonnull String namespace;

@ConstructorBinding
public NamespaceProperties(
@Nullable String namespace,
@Nullable WorkersAutoDiscoveryProperties workersAutoDiscovery,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
import org.springframework.boot.context.properties.NestedConfigurationProperty;

@ConfigurationProperties(prefix = "spring.temporal")
@ConstructorBinding
public class TemporalProperties extends NamespaceProperties {
private final @NestedConfigurationProperty @Nonnull ConnectionProperties connection;
private final @NestedConfigurationProperty @Nullable TestServerProperties testServer;
private final @Nullable Boolean startWorkers;

@ConstructorBinding
public TemporalProperties(
@Nullable String namespace,
@Nullable WorkersAutoDiscoveryProperties workersAutoDiscovery,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
import javax.annotation.Nullable;
import org.springframework.boot.context.properties.ConstructorBinding;

@ConstructorBinding
public class TestServerProperties {
private final @Nullable Boolean enabled;

@ConstructorBinding
public TestServerProperties(@Nullable Boolean enabled) {
this.enabled = enabled;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
import javax.annotation.Nullable;
import org.springframework.boot.context.properties.ConstructorBinding;

@ConstructorBinding
public class WorkerProperties {
private @Nonnull String taskQueue;

private @Nullable Collection<Class<?>> workflowClasses;

private @Nullable Collection<String> activityBeans;

@ConstructorBinding
public WorkerProperties(
@Nonnull String taskQueue,
@Nullable Collection<Class<?>> workflowClasses,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import javax.annotation.Nullable;
import org.springframework.boot.context.properties.ConstructorBinding;

@ConstructorBinding
public class WorkersAutoDiscoveryProperties {
private final @Nullable List<String> packages;

@ConstructorBinding
public WorkersAutoDiscoveryProperties(@Nullable List<String> packages) {
this.packages = packages;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
io.temporal.spring.boot.autoconfigure.TestServerAutoConfiguration
io.temporal.spring.boot.autoconfigure.OpenTracingAutoConfiguration
io.temporal.spring.boot.autoconfigure.ServiceStubsAutoConfiguration
io.temporal.spring.boot.autoconfigure.RootNamespaceAutoConfiguration

0 comments on commit 0c252f8

Please sign in to comment.