Skip to content

Commit 0ea9a73

Browse files
committed
Upgrade zu to java 21
1 parent a345b52 commit 0ea9a73

File tree

5 files changed

+104
-7
lines changed

5 files changed

+104
-7
lines changed

.github/workflows/codeql.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ master ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ master ]
20+
schedule:
21+
- cron: '34 23 * * 4'
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
analyze:
29+
name: Analyze
30+
runs-on: ubuntu-22.04
31+
permissions:
32+
actions: read
33+
contents: read
34+
security-events: write
35+
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
language: [ 'go', 'java' ]
40+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
41+
# Learn more:
42+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
43+
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@v5
47+
48+
# Set up JDK for Java analysis
49+
- name: Set up JDK 21
50+
if: matrix.language == 'java'
51+
uses: actions/setup-java@v4
52+
with:
53+
java-version: '21'
54+
distribution: 'temurin'
55+
56+
# Initializes the CodeQL tools for scanning.
57+
- name: Initialize CodeQL
58+
uses: github/codeql-action/init@v3
59+
with:
60+
languages: ${{ matrix.language }}
61+
# If you wish to specify custom queries, you can do so here or in a config file.
62+
# By default, queries listed here will override any specified in a config file.
63+
# Prefix the list here with "+" to use these queries and those in the config file.
64+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
65+
66+
# Build projects for CodeQL analysis
67+
- name: Build projects
68+
run: |
69+
if [ "${{ matrix.language }}" == "go" ]; then
70+
# Build main module
71+
go build ./...
72+
73+
# Build api module
74+
cd api
75+
go build ./...
76+
cd ..
77+
78+
# Build main binary
79+
go build -o bin/manager main.go
80+
elif [ "${{ matrix.language }}" == "java" ]; then
81+
# Build Java/Kotlin project in docker/zu/
82+
cd docker/zu
83+
./gradlew build
84+
fi
85+
86+
- name: Perform CodeQL Analysis
87+
uses: github/codeql-action/analyze@v3

docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
# http://www.apache.org/licenses/LICENSE-2.0
99
#
1010

11-
FROM gradle:jdk17
11+
FROM gradle:jdk21
1212

1313
RUN mkdir /zu
1414
COPY zu /zu
1515
WORKDIR /zu
16-
RUN ./gradlew shadowJar
16+
RUN ./gradlew shadowJar --no-daemon
1717

1818
# use forked base zookeeper 3.8.4 docker image
1919
# that runs on openjdk-21

docker/zu/build.gradle.kts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,33 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
22
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
33

44
plugins {
5-
kotlin("jvm") version "1.5.31"
6-
id("com.github.johnrengelman.shadow") version "7.1.0"
5+
kotlin("jvm") version "1.9.21"
6+
id("com.github.johnrengelman.shadow") version "8.1.1"
77
}
88

99
repositories {
1010
mavenCentral()
1111
}
1212

13+
java {
14+
sourceCompatibility = JavaVersion.VERSION_21
15+
targetCompatibility = JavaVersion.VERSION_21
16+
}
17+
1318
dependencies {
1419
implementation(kotlin("stdlib"))
1520
implementation("org.apache.zookeeper:zookeeper:3.9.3")
1621
}
1722

1823
tasks.withType<ShadowJar>() {
19-
classifier = null
24+
archiveClassifier.set("")
2025
manifest {
2126
attributes["Main-Class"] = "io.pravega.zookeeper.MainKt"
2227
}
2328
}
2429

2530
tasks.withType<KotlinCompile> {
2631
kotlinOptions {
27-
jvmTarget = "11"
32+
jvmTarget = "21"
2833
}
2934
}

docker/zu/gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Gradle daemon configuration for Docker builds
2+
org.gradle.daemon=false
3+
org.gradle.parallel=true
4+
org.gradle.configureondemand=true
5+
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)