Skip to content
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

Upgrade to Java 21 #7294

Merged
merged 3 commits into from
Dec 6, 2023
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Install Python
uses: actions/setup-python@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Execute Gradle
uses: gradle/gradle-build-action@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Create and Switch to Release Branch
run: |
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Reset main to release branch
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Vulnerability check
uses: gradle/gradle-build-action@v2
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Cache SonarCloud dependencies
uses: actions/cache@v3
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17
java-version: 21

- name: Setup Snyk
run: npm install -g snyk-to-html @wcj/html-to-markdown-cli
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17
java-version: 21

- name: Setup Snyk
run: npm install -g snyk-to-html @wcj/html-to-markdown-cli
Expand Down Expand Up @@ -169,7 +169,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17
java-version: 21

- name: Execute Gradle Snyk Monitor
uses: gradle/gradle-build-action@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Compiled class file
*.class
generated/

# OS specific
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repositories {

dependencies {
implementation("com.bmuschko:gradle-docker-plugin:9.4.0")
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.23.2")
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.23.3")
implementation("com.github.johnrengelman:shadow:8.1.1")
implementation("com.github.node-gradle:gradle-node-plugin:7.0.1")
implementation("com.google.protobuf:protobuf-gradle-plugin:0.9.4")
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/common-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ spotless {
})
java {
addStep(StripOldLicenseFormatterStep.create())
palantirJavaFormat()
palantirJavaFormat("2.39.0")
licenseHeader(licenseHeader, "package").updateYearWithLatest(true)
target("**/*.java")
targetExclude("build/**")
Expand Down
13 changes: 7 additions & 6 deletions buildSrc/src/main/kotlin/java-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,19 @@ dependencies {

tasks.compileJava {
dependsOn("generateEffectiveLombokConfig")
options.compilerArgs.addAll(listOf("-Werror", "-Xlint:all"))
// Disable serial and this-escape warnings due to errors in generated code
options.compilerArgs.addAll(listOf("-Werror", "-Xlint:all", "-Xlint:-serial,-this-escape"))
options.encoding = "UTF-8"
sourceCompatibility = "17"
targetCompatibility = "17"
sourceCompatibility = "21"
targetCompatibility = "21"
}

tasks.compileTestJava {
dependsOn("generateEffectiveLombokConfig")
options.compilerArgs.addAll(listOf("-Werror", "-Xlint:all"))
options.compilerArgs.addAll(listOf("-Werror", "-Xlint:all", "-Xlint:-this-escape"))
options.encoding = "UTF-8"
sourceCompatibility = "17"
targetCompatibility = "17"
sourceCompatibility = "21"
targetCompatibility = "21"
}

tasks.javadoc {
Expand Down
5 changes: 2 additions & 3 deletions buildSrc/src/main/kotlin/plugin/go/GoSetup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ package plugin.go

import org.apache.commons.compress.archivers.tar.TarArchiveInputStream
import org.gradle.api.DefaultTask
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.TaskAction
import org.gradle.kotlin.dsl.getByName
import java.io.File
import java.io.FileInputStream
import java.net.URL
import java.net.URI
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardCopyOption
Expand All @@ -43,7 +42,7 @@ open class GoSetup : DefaultTask() {
@TaskAction
fun prepare() {
go.goRoot.mkdirs()
val url = URL("https://storage.googleapis.com/golang/go${go.version}.${go.os}-${go.arch}.tar.gz")
val url = URI.create("https://storage.googleapis.com/golang/go${go.version}.${go.os}-${go.arch}.tar.gz").toURL()
val filename = Paths.get(url.path).fileName
val targetFile = go.cacheDir.toPath().resolve(filename)

Expand Down
4 changes: 2 additions & 2 deletions charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ a [Standalone NEG](https://cloud.google.com/kubernetes-engine/docs/how-to/standa

This can be done by setting a unique name for the subnet in the UI or through the console with the following command
```shell script
gcloud container clusters create mirrornode-lb \
gcloud container clusters create mirror-node \
--enable-ip-alias \
--create-subnetwork="" \
--network=default \
--zone=us-central1-a \
--cluster-version=1.21.5-gke.1802 \
--cluster-version=1.27 \
--machine-type=n1-standard-4
```

Expand Down
4 changes: 2 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The Mirror Node can be run [locally](#running-locally) or via [Docker](#running-

## Building

To run locally, first build the project using Java. Ensure you have OpenJDK 17 installed, then run the following command
To run locally, first build the project using Java. Ensure you have Java 21 installed, then run the following command
from the top level directory. This will compile a runnable mirror node JAR file in the `target` directory.

```console
Expand All @@ -15,7 +15,7 @@ from the top level directory. This will compile a runnable mirror node JAR file

### Database Setup

In addition to OpenJDK 17, you will need to install a [PostgreSQL](https://postgresql.org) database and initialize it.
In addition to Java 21, you will need to install a [PostgreSQL](https://postgresql.org) database and initialize it.

Since [Flyway](https://flywaydb.org) will manage the database schema, the only required step is to run the database
initialization script. Locate the SQL script at `hedera-mirror-importer/src/main/resources/db/scripts/init.sh` and edit
Expand Down
3 changes: 0 additions & 3 deletions hedera-mirror-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ plugins { id("java-conventions") }

dependencies {
val testClasses by configurations.creating
annotationProcessor(group = "com.querydsl", name = "querydsl-apt", classifier = "jakarta")
annotationProcessor("jakarta.persistence:jakarta.persistence-api")
api("com.fasterxml.jackson.core:jackson-databind")
api("com.github.ben-manes.caffeine:caffeine")
api("com.google.guava:guava")
api("com.google.protobuf:protobuf-java")
api("com.hedera.hashgraph:hedera-protobuf-java-api") { isTransitive = false }
api("com.querydsl:querydsl-apt")
api("com.querydsl:querydsl-jpa")
api("io.hypersistence:hypersistence-utils-hibernate-62")
api("commons-codec:commons-codec")
api("io.projectreactor:reactor-core")
Expand Down
4 changes: 2 additions & 2 deletions hedera-mirror-graphql/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM eclipse-temurin:17.0.8.1_1-jre-jammy as builder
FROM eclipse-temurin:21-jre-jammy as builder
WORKDIR /app
COPY build/libs/*.jar ./
RUN java -Djarmode=layertools -jar *.jar extract

FROM eclipse-temurin:17.0.8.1_1-jre-jammy
FROM eclipse-temurin:21-jre-jammy
ENV JDK_JAVA_OPTIONS="-XX:MaxRAMPercentage=80"
jascks marked this conversation as resolved.
Show resolved Hide resolved
EXPOSE 8083
HEALTHCHECK --interval=10s --retries=3 --start-period=50s --timeout=2s CMD curl -f http://localhost:8083/actuator/health/liveness
Expand Down
4 changes: 2 additions & 2 deletions hedera-mirror-grpc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM eclipse-temurin:17.0.8.1_1-jre-jammy as builder
FROM eclipse-temurin:21-jre-jammy as builder
WORKDIR /app
COPY build/libs/*.jar ./
RUN java -Djarmode=layertools -jar *.jar extract

FROM eclipse-temurin:17.0.8.1_1-jre-jammy
FROM eclipse-temurin:21-jre-jammy
ENV JDK_JAVA_OPTIONS="-XX:MaxRAMPercentage=80"
EXPOSE 5600
HEALTHCHECK --interval=10s --retries=3 --start-period=50s --timeout=2s CMD curl -f http://localhost:8081/actuator/health/liveness
Expand Down
4 changes: 2 additions & 2 deletions hedera-mirror-importer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM eclipse-temurin:17.0.8.1_1-jre-jammy as builder
FROM eclipse-temurin:21-jre-jammy as builder
WORKDIR /app
COPY build/libs/*.jar ./
RUN java -Djarmode=layertools -jar *.jar extract

FROM eclipse-temurin:17.0.8.1_1-jre-jammy
FROM eclipse-temurin:21-jre-jammy
ENV JDK_JAVA_OPTIONS="-XX:MaxRAMPercentage=80"
HEALTHCHECK --interval=30s --retries=3 --start-period=60s --timeout=2s CMD curl -f http://localhost:8080/actuator/health/liveness
WORKDIR /app
Expand Down
4 changes: 2 additions & 2 deletions hedera-mirror-monitor/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM eclipse-temurin:17.0.8.1_1-jre-jammy as builder
FROM eclipse-temurin:21-jre-jammy as builder
WORKDIR /app
COPY build/libs/*.jar ./
RUN java -Djarmode=layertools -jar *.jar extract

FROM eclipse-temurin:17.0.8.1_1-jre-jammy
FROM eclipse-temurin:21-jre-jammy
ENV JDK_JAVA_OPTIONS="-XX:MaxRAMPercentage=80"
EXPOSE 8082
HEALTHCHECK --interval=10s --retries=5 --start-period=60s --timeout=2s CMD curl -f http://localhost:8082/actuator/health/liveness
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class PublishScenarioProperties extends ScenarioProperties {
private TransactionType type;

public PublishScenarioProperties() {
getRetry().setMaxAttempts(1L);
retry.setMaxAttempts(1L);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class SubscriberController {

@GetMapping
public <T extends ScenarioProperties> Flux<Scenario<T, Object>> subscriptions(
@RequestParam Optional<ScenarioProtocol> protocol, @RequestParam Optional<List<ScenarioStatus>> status) {
@RequestParam("protocol") Optional<ScenarioProtocol> protocol,
@RequestParam("status") Optional<List<ScenarioStatus>> status) {
return mirrorSubscriber
.<Scenario<T, Object>>getSubscriptions()
.filter(s -> !protocol.isPresent() || protocol.get() == s.getProtocol())
Expand Down
4 changes: 2 additions & 2 deletions hedera-mirror-rest-java/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM eclipse-temurin:17.0.8.1_1-jre-jammy as builder
FROM eclipse-temurin:21-jre-jammy as builder
WORKDIR /app
COPY build/libs/*.jar ./
RUN java -Djarmode=layertools -jar *.jar extract

FROM eclipse-temurin:17.0.8.1_1-jre-jammy
FROM eclipse-temurin:21-jre-jammy
ENV JDK_JAVA_OPTIONS="-XX:MaxRAMPercentage=80"
EXPOSE 8084
HEALTHCHECK --interval=10s --retries=3 --start-period=50s --timeout=2s CMD curl -f http://localhost:8084/actuator/health/liveness
Expand Down
2 changes: 1 addition & 1 deletion hedera-mirror-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM eclipse-temurin:17.0.8.1_1-jre-jammy
FROM eclipse-temurin:21-jre-jammy

ENV JDK_JAVA_OPTIONS="-XX:MaxRAMPercentage=80"
WORKDIR /app
Expand Down
4 changes: 2 additions & 2 deletions hedera-mirror-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ complex code underneath.

### Requirements

- OpenJDK 17+
- Java 21

### Test Execution

Expand All @@ -39,7 +39,7 @@ uses [Spring Boot](https://spring.io/projects/spring-boot) properties to configu
include:

| Name | Default | Description |
| -------------------------------------------------------------- | -------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|----------------------------------------------------------------|----------------------------------------------|-----------------------------------------------------------------------------------------------------------|
| `hedera.mirror.test.acceptance.backOffPeriod` | 5s | The amount of time the client will wait before retrying a retryable failure. |
| `hedera.mirror.test.acceptance.createOperatorAccount` | true | Whether to create a separate operator account to run the acceptance tests. |
| `hedera.mirror.test.acceptance.emitBackgroundMessages` | false | Whether background topic messages should be emitted. |
Expand Down
Loading
Loading