Skip to content

Commit

Permalink
update to SpringBoot 3 and Java 17 (#1638)
Browse files Browse the repository at this point in the history
### 📝 Description

SpringBoot v3 requires Java 17. This PR updates target bytecode of ALL `graphql-kotlin` modules to Java 17 and as a result ibrary users will have to use Java 17+ as well.

### 🔗 Related Issues
* Resolves #1609
  • Loading branch information
dariuszkuc authored Jan 27, 2023
1 parent 0540730 commit 1fbbd48
Show file tree
Hide file tree
Showing 56 changed files with 127 additions and 129 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Set up Java 11
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'zulu'

- name: Set up Gradle cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Set up Java 11
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'zulu'

- name: Set up Gradle cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/federation-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Set up Java 11
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'zulu'

- name: Set up Gradle cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/federation-composition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Java 11
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'zulu'

- name: Set up Gradle cache
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/plugin-it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- uses: actions/checkout@v3
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up Java 11
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'zulu'
- name: Set up Gradle cache
uses: gradle/gradle-build-action@v2
Expand All @@ -36,10 +36,10 @@ jobs:
- uses: actions/checkout@v3
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up Java 11
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'zulu'
- name: Set up Gradle cache
uses: gradle/gradle-build-action@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-check-federation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- master
paths:
- 'generator/graphql-kotlin-federation/**'
- 'integration/federation-compatibility/**'

jobs:
federation-compatibility:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

- uses: gradle/wrapper-validation-action@v1

- name: Set up Java 11
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'zulu'

- name: Build library with Gradle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ plugins {
// see https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
val libs = the<LibrariesForLibs>()
tasks {
kotlin {
jvmToolchain(17)
}
val kotlinJvmVersion: String by project
withType<KotlinCompile> {
kotlinOptions {
// intellij gets confused without it
jvmTarget = kotlinJvmVersion
freeCompilerArgs = listOf("-Xjsr305=strict")
}
Expand Down Expand Up @@ -53,12 +57,6 @@ tasks {
// NOTE: in order to run gradle and maven plugin integration tests we need to have our build artifacts available in local repo
finalizedBy("publishToMavenLocal")
}
java {
// even though we don't have any Java code, since we are building using Java LTS version,
// this is required for Gradle to set the correct JVM versions in the module metadata
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
}

// published sources and javadoc artifacts
val jarComponent = project.components.getByName("java")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ dependencies {
testImplementation(libs.junit.engine)
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
freeCompilerArgs = listOf("-Xjsr305=strict")
}
}
Expand All @@ -39,6 +39,9 @@ tasks {
toolVersion = libs.versions.detekt.get()
config = files(File(rootDir.parent, "detekt.yml").absolutePath)
}
kotlin {
jvmToolchain(17)
}
ktlint {
version.set(libs.versions.ktlint.core.get())
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021 Expedia, Inc
* Copyright 2023 Expedia, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@

package com.expediagroup.graphql.examples.server.spring.exceptions

import javax.validation.ConstraintViolation
import jakarta.validation.ConstraintViolation

class ValidationException(val constraintErrors: List<ConstraintError>) : RuntimeException("Validation error")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021 Expedia, Inc
* Copyright 2023 Expedia, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,8 +19,8 @@ package com.expediagroup.graphql.examples.server.spring.query
import com.expediagroup.graphql.server.operations.Query
import org.springframework.stereotype.Component
import org.springframework.validation.annotation.Validated
import javax.validation.Valid
import javax.validation.constraints.Pattern
import jakarta.validation.Valid
import jakarta.validation.constraints.Pattern

@Validated
@Component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021 Expedia, Inc
* Copyright 2023 Expedia, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -31,7 +31,7 @@ import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.TestMethodOrder
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.web.server.LocalServerPort
import org.springframework.boot.test.web.server.LocalServerPort
import org.springframework.web.reactive.socket.WebSocketSession
import org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient
import reactor.core.publisher.Flux
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ systemProp.org.gradle.internal.publish.checksums.insecure=true
# See: https://github.com/gradle/gradle/issues/8139
org.gradle.jvmargs=-Xmx2g -XX:+HeapDumpOnOutOfMemoryError

kotlinJvmVersion = 1.8
kotlinJvmVersion = 17
18 changes: 9 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[versions]
android-plugin = "7.1.2"
android-plugin = "8.0.0-alpha11"
classgraph = "4.8.149"
dataloader = "3.2.0"
federation = "2.2.0"
graphql-java = "19.2"
jackson = "2.13.3"
jackson = "2.14.1"
kotlin = "1.7.21"
kotlinx-benchmark = "0.4.4"
kotlinx-coroutines = "1.6.4"
Expand All @@ -15,21 +15,21 @@ maven-plugin-api = "3.6.3"
maven-project = "2.2.1"
poet = "1.12.0"
## reactorVersion should be the same reactor-core version pulled from spring-boot-starter-webflux
reactor-core = "3.4.26"
reactor-extensions = "1.1.9"
reactor-core = "3.5.1"
reactor-extensions = "1.2.1"
slf4j = "1.7.36"
spring = "5.3.24"
spring-boot = "2.7.7"
spring = "6.0.3"
spring-boot = "3.0.1"

# test dependencies
# kotlin-compile-testing has to be using the same kotlin version as the kotlinx-serialization compiler
# https://github.com/tschuchortdev/kotlin-compile-testing the latest version targets kotlin 1.7.10 which blocks updates to newer
# versions of kotlin, switching to a fork https://github.com/ZacSweers/kotlin-compile-testing
compile-testing = "0.1.0"
icu = "71.1"
junit = "5.8.2"
junit = "5.9.1"
logback = "1.2.1"
mockk = "1.12.5"
mockk = "1.13.3"
rxjava = "3.1.5"
wiremock = "2.33.2"

Expand All @@ -40,7 +40,7 @@ jacoco = "0.8.8"
# klint gradle plugin breaks with 0.46.x+
ktlint-core = "0.45.2"
ktlint-plugin = "10.3.0"
maven-plugin-development = "0.4.0"
maven-plugin-development = "0.4.1"
nexus-publish-plugin = "1.1.0"
plugin-publish = "0.21.0"

Expand Down
23 changes: 13 additions & 10 deletions integration/federation-compatibility/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ plugins {
}

group = "com.expediagroup.federation.compatibility"
java.sourceCompatibility = JavaVersion.VERSION_11

repositories {
mavenCentral()
Expand All @@ -28,15 +27,19 @@ dependencies {
graphqlSDL("com.expediagroup", "graphql-kotlin-federated-hooks-provider")
}

tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "11"
}
}

tasks.withType<Test> {
useJUnitPlatform()
tasks {
kotlin {
jvmToolchain(17)
}
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf("-Xjsr305=strict")
}
}
withType<Test> {
useJUnitPlatform()
}
}

graphql {
Expand Down
7 changes: 4 additions & 3 deletions integration/gradle-plugin-android-test/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ plugins {
android {
compileSdk = 30
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
}
namespace = "com.expediagroup.graphqlkotlin"
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.expediagroup.graphqlkotlin">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 8 additions & 4 deletions integration/gradle-plugin-android-test/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
1 change: 1 addition & 0 deletions integration/gradle-plugin-android-test/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
4 changes: 2 additions & 2 deletions integration/gradle-plugin-integration-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ tasks {
}

for (projectName in listOf(":download-sdl-groovy-it", ":download-sdl-kotlin-it")) {
project("$projectName") {
project(projectName) {
ext.set("wireMockServerPort", extension.port)

project.afterEvaluate {
Expand All @@ -88,7 +88,7 @@ for (projectName in listOf(":download-sdl-groovy-it", ":download-sdl-kotlin-it")
}

for (projectName in listOf(":introspection-groovy-it", ":introspection-kotlin-it")) {
project("$projectName") {
project(projectName) {
ext.set("wireMockServerPort", extension.port)

project.afterEvaluate {
Expand Down
Loading

0 comments on commit 1fbbd48

Please sign in to comment.