1
0
mirror of synced 2025-12-19 18:14:56 -05:00

migrate everything from java 17 to java 21 (#35103)

This commit is contained in:
Marius Posta
2024-02-09 17:26:19 -08:00
committed by GitHub
parent fdb3030ca0
commit b9ab3d1a90
31 changed files with 69 additions and 95 deletions

View File

@@ -20,7 +20,7 @@ runs:
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
distribution: "zulu" distribution: "zulu"
java-version: "17" java-version: "21"
- if: inputs.install_node == 'true' - if: inputs.install_node == 'true'
uses: actions/setup-node@v3 uses: actions/setup-node@v3

View File

@@ -159,7 +159,7 @@ jobs:
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
distribution: "zulu" distribution: "zulu"
java-version: "17" java-version: "21"
- name: Install Python - name: Install Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:

View File

@@ -83,7 +83,7 @@ jobs:
- uses: actions/setup-java@v3 - uses: actions/setup-java@v3
with: with:
distribution: "zulu" distribution: "zulu"
java-version: "17" java-version: "21"
- name: Install Pip - name: Install Pip
if: steps.changes.outputs.gradlecheck_any_changed == 'true' if: steps.changes.outputs.gradlecheck_any_changed == 'true'
run: curl -fsSL https://bootstrap.pypa.io/get-pip.py | python3 run: curl -fsSL https://bootstrap.pypa.io/get-pip.py | python3

View File

@@ -16,7 +16,7 @@ jobs:
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
distribution: "zulu" distribution: "zulu"
java-version: "17" java-version: "21"
- name: Publish CDK to MavenLocal - name: Publish CDK to MavenLocal
run: | run: |

View File

@@ -244,7 +244,7 @@ jobs:
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
distribution: "zulu" distribution: "zulu"
java-version: "17" java-version: "21"
- name: Install Python - name: Install Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:

View File

@@ -92,7 +92,7 @@ jobs:
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
distribution: "zulu" distribution: "zulu"
java-version: "17" java-version: "21"
- name: Install Python - name: Install Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:

View File

@@ -66,7 +66,7 @@ jobs:
- uses: actions/setup-java@v3 - uses: actions/setup-java@v3
with: with:
distribution: "zulu" distribution: "zulu"
java-version: "17" java-version: "21"
- name: Checkout Airbyte - name: Checkout Airbyte
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
@@ -228,7 +228,7 @@ jobs:
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
distribution: "zulu" distribution: "zulu"
java-version: "17" java-version: "21"
- name: Install Python - name: Install Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:

View File

@@ -116,7 +116,7 @@ jobs:
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
distribution: "zulu" distribution: "zulu"
java-version: "17" java-version: "21"
- name: Check for already-published version (${{ env.CDK_VERSION }}, FORCE=${{ env.FORCE }}) - name: Check for already-published version (${{ env.CDK_VERSION }}, FORCE=${{ env.FORCE }})
if: ${{ !(env.FORCE == 'true') }} if: ${{ !(env.FORCE == 'true') }}
run: ./gradlew :airbyte-cdk:java:airbyte-cdk:assertCdkVersionNotPublished run: ./gradlew :airbyte-cdk:java:airbyte-cdk:assertCdkVersionNotPublished

View File

@@ -49,7 +49,7 @@ jobs:
- uses: actions/setup-java@v3 - uses: actions/setup-java@v3
with: with:
distribution: "zulu" distribution: "zulu"
java-version: "17" java-version: "21"
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
@@ -184,7 +184,7 @@ jobs:
- uses: actions/setup-java@v3 - uses: actions/setup-java@v3
with: with:
distribution: "zulu" distribution: "zulu"
java-version: "17" java-version: "21"
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4
with: with:

View File

@@ -84,7 +84,7 @@ jobs:
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
distribution: "zulu" distribution: "zulu"
java-version: "17" java-version: "21"
- name: Install Python - name: Install Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:

View File

@@ -1,7 +1,7 @@
java { java {
// TODO: rewrite code to avoid javac wornings in the first place // TODO: rewrite code to avoid javac wornings in the first place
compileJava { compileJava {
options.compilerArgs += "-Xlint:-deprecation,-try,-rawtypes,-overloads" options.compilerArgs += "-Xlint:-deprecation,-try,-rawtypes,-overloads,-this-escape"
} }
compileTestJava { compileTestJava {
options.compilerArgs += "-Xlint:-try,-divzero,-cast" options.compilerArgs += "-Xlint:-try,-divzero,-cast"

View File

@@ -1,3 +1,10 @@
java {
// TODO: rewrite code to avoid javac wornings in the first place
compileJava {
options.compilerArgs += "-Xlint:-deprecation,-this-escape"
}
}
dependencies { dependencies {
implementation project(':airbyte-cdk:java:airbyte-cdk:dependencies') implementation project(':airbyte-cdk:java:airbyte-cdk:dependencies')
implementation project(':airbyte-cdk:java:airbyte-cdk:core') implementation project(':airbyte-cdk:java:airbyte-cdk:core')

View File

@@ -1,10 +1,10 @@
java { java {
// TODO: rewrite code to avoid javac wornings in the first place // TODO: rewrite code to avoid javac wornings in the first place
compileJava { compileJava {
options.compilerArgs += "-Xlint:-deprecation,-removal" options.compilerArgs += "-Xlint:-deprecation,-removal,-this-escape"
} }
compileTestFixturesJava { compileTestFixturesJava {
options.compilerArgs += "-Xlint:-try" options.compilerArgs += "-Xlint:-try,-this-escape"
} }
} }

View File

@@ -7,7 +7,7 @@ plugins {
java { java {
// TODO: rewrite code to avoid javac wornings in the first place // TODO: rewrite code to avoid javac wornings in the first place
compileJava { compileJava {
options.compilerArgs += "-Xlint:-try,-rawtypes,-unchecked,-removal" options.compilerArgs += "-Xlint:-try,-rawtypes,-unchecked,-removal,-this-escape"
} }
} }

View File

@@ -10,7 +10,7 @@ plugins {
java { java {
// TODO: rewrite code to avoid javac wornings in the first place // TODO: rewrite code to avoid javac wornings in the first place
compileJava { compileJava {
options.compilerArgs += "-Xlint:-varargs,-try,-deprecation,-unchecked" options.compilerArgs += "-Xlint:-varargs,-try,-deprecation,-unchecked,-this-escape"
} }
compileTestJava { compileTestJava {
options.compilerArgs += "-Xlint:-try" options.compilerArgs += "-Xlint:-try"

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO" packages="io.airbyte.commons.logging"> <Configuration status="INFO">
<Properties> <Properties>
<!-- Set the LOG_SCRUB_PATTERN env var to a regex pattern to scrub the log messages of secrets or any other unwanted content. --> <!-- Set the LOG_SCRUB_PATTERN env var to a regex pattern to scrub the log messages of secrets or any other unwanted content. -->
<Property name="default-pattern">%d{yyyy-MM-dd HH:mm:ss}{GMT+0} %highlight{%p} %C{1.}(%M):%L - %replace{%m}{$${env:LOG_SCRUB_PATTERN:-\*\*\*\*\*}}{*****}%n</Property> <Property name="default-pattern">%d{yyyy-MM-dd HH:mm:ss}{GMT+0} %highlight{%p} %C{1.}(%M):%L - %replace{%m}{$${env:LOG_SCRUB_PATTERN:-\*\*\*\*\*}}{*****}%n</Property>

View File

@@ -83,8 +83,6 @@ class TestHarnessUtilsTest {
while (recordedBeats.get() < 3) { while (recordedBeats.get() < 3) {
Thread.sleep(10); Thread.sleep(10);
} }
thread.stop();
} }
@Test @Test

View File

@@ -1,7 +1,7 @@
java { java {
// TODO: rewrite code to avoid javac wornings in the first place // TODO: rewrite code to avoid javac wornings in the first place
compileJava { compileJava {
options.compilerArgs += "-Xlint:-try,-deprecation" options.compilerArgs += "-Xlint:-try,-deprecation,-this-escape"
} }
compileTestJava { compileTestJava {
options.compilerArgs += "-Xlint:-try" options.compilerArgs += "-Xlint:-try"

View File

@@ -640,6 +640,7 @@ E.G.: running Poe tasks on the modified internal packages of the current branch:
| Version | PR | Description | | Version | PR | Description |
| ------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | | ------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| 4.2.0 | [#35103](https://github.com/airbytehq/airbyte/pull/35103) | Java 21 support. |
| 4.1.4 | [#35039](https://github.com/airbytehq/airbyte/pull/35039) | Fix bug which prevented gradle test reports from being added. | | 4.1.4 | [#35039](https://github.com/airbytehq/airbyte/pull/35039) | Fix bug which prevented gradle test reports from being added. |
| 4.1.3 | [#35010](https://github.com/airbytehq/airbyte/pull/35010) | Use `poetry install --no-root` in the builder container. | | 4.1.3 | [#35010](https://github.com/airbytehq/airbyte/pull/35010) | Use `poetry install --no-root` in the builder container. |
| 4.1.2 | [#34945](https://github.com/airbytehq/airbyte/pull/34945) | Only install main dependencies when running poetry install. | | 4.1.2 | [#34945](https://github.com/airbytehq/airbyte/pull/34945) | Only install main dependencies when running poetry install. |

View File

@@ -30,12 +30,12 @@ PLATFORM_MACHINE_TO_DAGGER_PLATFORM = {
} }
LOCAL_MACHINE_TYPE = platform.machine() LOCAL_MACHINE_TYPE = platform.machine()
LOCAL_BUILD_PLATFORM = PLATFORM_MACHINE_TO_DAGGER_PLATFORM[LOCAL_MACHINE_TYPE] LOCAL_BUILD_PLATFORM = PLATFORM_MACHINE_TO_DAGGER_PLATFORM[LOCAL_MACHINE_TYPE]
AMAZONCORRETTO_IMAGE = "amazoncorretto:17.0.8-al2023" AMAZONCORRETTO_IMAGE = "amazoncorretto:21-al2023"
NODE_IMAGE = "node:18.18.0-slim" NODE_IMAGE = "node:18.18.0-slim"
GO_IMAGE = "golang:1.17" GO_IMAGE = "golang:1.17"
PYTHON_3_10_IMAGE = "python:3.10.13-slim" PYTHON_3_10_IMAGE = "python:3.10.13-slim"
MAVEN_IMAGE = "maven:3.9.5-amazoncorretto-17-al2023" MAVEN_IMAGE = "maven:3.9.6-amazoncorretto-21-al2023"
DOCKER_VERSION = "24.0.2" DOCKER_VERSION = "24"
DOCKER_DIND_IMAGE = f"docker:{DOCKER_VERSION}-dind" DOCKER_DIND_IMAGE = f"docker:{DOCKER_VERSION}-dind"
DOCKER_CLI_IMAGE = f"docker:{DOCKER_VERSION}-cli" DOCKER_CLI_IMAGE = f"docker:{DOCKER_VERSION}-cli"
DOCKER_REGISTRY_MIRROR_URL = os.getenv("DOCKER_REGISTRY_MIRROR_URL") DOCKER_REGISTRY_MIRROR_URL = os.getenv("DOCKER_REGISTRY_MIRROR_URL")

View File

@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
name = "pipelines" name = "pipelines"
version = "4.1.4" version = "4.2.0"
description = "Packaged maintained by the connector operations team to perform CI for connectors' pipelines" description = "Packaged maintained by the connector operations team to perform CI for connectors' pipelines"
authors = ["Airbyte <contact@airbyte.io>"] authors = ["Airbyte <contact@airbyte.io>"]

View File

@@ -14,6 +14,13 @@ airbyteJavaConnector {
useLocalCdk = false useLocalCdk = false
} }
java {
// TODO: rewrite code to avoid javac wornings in the first place
compileJava {
options.compilerArgs += "-Xlint:-this-escape"
}
}
application { application {
mainClass = 'io.airbyte.integrations.destination.bigquery.BigQueryDestination' mainClass = 'io.airbyte.integrations.destination.bigquery.BigQueryDestination'
applicationDefaultJvmArgs = ['-XX:+ExitOnOutOfMemoryError', '-XX:MaxRAMPercentage=75.0', applicationDefaultJvmArgs = ['-XX:+ExitOnOutOfMemoryError', '-XX:MaxRAMPercentage=75.0',

View File

@@ -52,12 +52,6 @@ dependencies {
testImplementation libs.testcontainers.postgresql testImplementation libs.testcontainers.postgresql
integrationTestJavaImplementation libs.testcontainers.postgresql integrationTestJavaImplementation libs.testcontainers.postgresql
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
testCompileOnly 'org.projectlombok:lombok:1.18.24'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.24'
testImplementation 'org.mockito:mockito-inline:4.7.0' testImplementation 'org.mockito:mockito-inline:4.7.0'
} }

View File

@@ -8,6 +8,13 @@ airbyteJavaConnector {
useLocalCdk = false useLocalCdk = false
} }
java {
// TODO: rewrite code to avoid javac wornings in the first place
compileJava {
options.compilerArgs += "-Xlint:-this-escape"
}
}
application { application {
mainClass = 'io.airbyte.integrations.destination.snowflake.SnowflakeDestinationRunner' mainClass = 'io.airbyte.integrations.destination.snowflake.SnowflakeDestinationRunner'
// enable when profiling // enable when profiling

View File

@@ -1,6 +1,6 @@
plugins { plugins {
id 'airbyte-java-connector' id 'airbyte-java-connector'
alias(libs.plugins.kotlin.jvm) id 'org.jetbrains.kotlin.jvm' version '1.9.22'
} }
airbyteJavaConnector { airbyteJavaConnector {

View File

@@ -9,9 +9,13 @@ airbyteJavaConnector {
} }
java { java {
// TODO: rewrite code to avoid javac wornings in the first place
compileJava { compileJava {
options.compilerArgs += "-Xlint:-try,-rawtypes" options.compilerArgs += "-Xlint:-try,-rawtypes"
} }
compileTestFixturesJava {
options.compilerArgs += "-Xlint:-this-escape"
}
} }
application { application {

View File

@@ -1,10 +1,10 @@
import com.github.spotbugs.snom.Confidence
import com.github.spotbugs.snom.Effort
import com.github.spotbugs.snom.SpotBugsTask import com.github.spotbugs.snom.SpotBugsTask
plugins { plugins {
id 'base' id 'base'
id 'com.github.node-gradle.node' version '3.5.1' id 'com.github.spotbugs' version '6.0.7'
id 'com.github.spotbugs' version '5.0.13'
id 'version-catalog' id 'version-catalog'
id 'ru.vyarus.use-python' id 'ru.vyarus.use-python'
} }
@@ -181,12 +181,11 @@ subprojects { subproj ->
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'java-test-fixtures' apply plugin: 'java-test-fixtures'
apply plugin: 'jacoco'
apply plugin: 'com.github.spotbugs' apply plugin: 'com.github.spotbugs'
java { java {
sourceCompatibility = JavaVersion.VERSION_17 sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_21
compileJava { compileJava {
options.compilerArgs += ["-Werror", "-Xlint:all,-serial,-processing"] options.compilerArgs += ["-Werror", "-Xlint:all,-serial,-processing"]
} }
@@ -218,50 +217,13 @@ subprojects { subproj ->
} }
} }
jacoco {
toolVersion = "0.8.8"
}
jacocoTestReport {
reports {
html.required = true
xml.required = true
csv.required = false
}
}
def jacocoTestReportTask = tasks.named('jacocoTestReport')
jacocoTestReportTask.configure {
dependsOn tasks.named('test')
}
jacocoTestCoverageVerification {
violationRules {
failOnViolation = false
rule {
element = 'CLASS'
excludes = ['**/*Test*', '**/generated*']
limit {
counter = 'BRANCH'
minimum = 0.8
}
limit {
counter = 'INSTRUCTION'
minimum = 0.8
}
}
}
}
spotbugs { spotbugs {
ignoreFailures = false ignoreFailures = false
effort = 'max' effort = Effort.valueOf(rootProject.ext.skipSlowTests ? 'MIN' : 'MAX')
excludeFilter.set rootProject.file('spotbugs-exclude-filter-file.xml') excludeFilter.set rootProject.file('spotbugs-exclude-filter-file.xml')
reportLevel = 'high' reportLevel = Confidence.valueOf('HIGH')
showProgress = false showProgress = false
toolVersion = '4.7.3' toolVersion = '4.8.3'
if (rootProject.ext.skipSlowTests && isConnectorProject(subproj)) {
effort = 'min'
}
} }
test { test {
@@ -278,6 +240,12 @@ subprojects { subproj ->
} }
} }
// This is required by mockito, see https://github.com/mockito/mockito/issues/3037.
jvmArgs "-XX:+EnableDynamicAgentLoading"
// This is also required, to prevent stderr spam starting with
// "OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader cl..."
jvmArgs "-Xshare:off"
// Set the timezone to UTC instead of picking up the host machine's timezone, // Set the timezone to UTC instead of picking up the host machine's timezone,
// which on a developer's laptop is more likely to be PST. // which on a developer's laptop is more likely to be PST.
systemProperty 'user.timezone', 'UTC' systemProperty 'user.timezone', 'UTC'
@@ -321,12 +289,6 @@ subprojects { subproj ->
exclude '**/io/airbyte/integrations/source/**' exclude '**/io/airbyte/integrations/source/**'
exclude '**/io/airbyte/integrations/destination/**' exclude '**/io/airbyte/integrations/destination/**'
} }
jacoco {
enabled = !rootProject.ext.skipSlowTests
excludes = ['**/*Test*', '**/generated*']
}
finalizedBy jacocoTestReportTask
} }
dependencies { dependencies {
@@ -348,8 +310,7 @@ subprojects { subproj ->
testFixturesImplementation libs.junit.pioneer testFixturesImplementation libs.junit.pioneer
// adds owasp plugin // adds owasp plugin
spotbugsPlugins libs.findsecbugs.plugin implementation 'com.github.spotbugs:spotbugs-annotations:4.8.3'
implementation libs.spotbugs.annotations
} }
tasks.withType(SpotBugsTask).configureEach { tasks.withType(SpotBugsTask).configureEach {

View File

@@ -36,6 +36,7 @@ class AirbyteIntegrationTestJavaPlugin implements Plugin<Project> {
showStandardStreams = !System.getenv().containsKey("RUN_IN_AIRBYTE_CI") showStandardStreams = !System.getenv().containsKey("RUN_IN_AIRBYTE_CI")
} }
jvmArgs = project.test.jvmArgs
systemProperties = project.test.systemProperties systemProperties = project.test.systemProperties
maxParallelForks = project.test.maxParallelForks maxParallelForks = project.test.maxParallelForks
maxHeapSize = project.test.maxHeapSize maxHeapSize = project.test.maxHeapSize

View File

@@ -12,7 +12,7 @@ jooq = "3.13.4"
junit-jupiter = "5.9.1" junit-jupiter = "5.9.1"
kotlin = "1.9.0" kotlin = "1.9.0"
log4j = "2.21.1" log4j = "2.21.1"
lombok = "1.18.24" lombok = "1.18.30"
postgresql = "42.6.0" postgresql = "42.6.0"
reactor = "3.5.2" reactor = "3.5.2"
segment = "2.1.1" segment = "2.1.1"
@@ -87,7 +87,7 @@ log4j-over-slf4j = { module = "org.slf4j:log4j-over-slf4j", version.ref = "slf4j
log4j-web = { module = "org.apache.logging.log4j:log4j-web", version.ref = "log4j" } log4j-web = { module = "org.apache.logging.log4j:log4j-web", version.ref = "log4j" }
lombok = { module = "org.projectlombok:lombok", version.ref = "lombok" } lombok = { module = "org.projectlombok:lombok", version.ref = "lombok" }
micrometer-statsd = { module = "io.micrometer:micrometer-registry-statsd", version = "1.9.3" } micrometer-statsd = { module = "io.micrometer:micrometer-registry-statsd", version = "1.9.3" }
mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter", version = "4.6.1" } mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter", version = "5.10.0" }
mockk = { module = "io.mockk:mockk", version = "1.13.3" } mockk = { module = "io.mockk:mockk", version = "1.13.3" }
mongo-driver-sync = { module = "org.mongodb:mongodb-driver-sync", version = "4.10.2" } mongo-driver-sync = { module = "org.mongodb:mongodb-driver-sync", version = "4.10.2" }
otel-bom = { module = "io.opentelemetry:opentelemetry-bom", version = "1.14.0" } otel-bom = { module = "io.opentelemetry:opentelemetry-bom", version = "1.14.0" }

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000 networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@@ -19,10 +19,4 @@
<Class name="io.airbyte.cdk.integrations.debezium.internals.AirbyteFileOffsetBackingStore" /> <Class name="io.airbyte.cdk.integrations.debezium.internals.AirbyteFileOffsetBackingStore" />
<Bug code="SECOBDES" /> <Bug code="SECOBDES" />
</Match> </Match>
<!-- Silenced during CDK migration. TODO: fix or replace this comment with description. -->
<Match>
<Class name="io.airbyte.cdk.integrations.source.jdbc.JdbcDataSourceUtils" />
<Bug pattern="MS_SHOULD_BE_FINAL" />
</Match>
</FindBugsFilter> </FindBugsFilter>