Skip to content

Commit ba64d6b

Browse files
authored
Merge pull request #41 from JavaSaBr/feature/issues-40-upgrade-java-stack
Upgrade java , part 1
2 parents 6d16b4e + b39d26e commit ba64d6b

File tree

163 files changed

+2328
-2076
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+2328
-2076
lines changed

.github/workflows/gradle.yml

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,48 @@
11
name: Java CI
22

3-
on: [pull_request]
3+
on:
4+
push:
5+
branches: [ "develop" ]
6+
pull_request:
7+
branches: [ "develop" ]
48

59
jobs:
610
build:
711
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up JDK 21
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: '21'
23+
distribution: 'temurin'
24+
25+
- name: Setup Gradle
26+
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
27+
28+
- name: Compile all modules
29+
run: ./gradlew testClasses
30+
31+
- name: Run tests for all modules
32+
run: ./gradlew test
33+
34+
dependency-submission:
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: write
838
steps:
9-
- uses: actions/checkout@v1
10-
- uses: joschi/setup-jdk@v1
11-
with:
12-
java-version: 'openjdk13'
13-
architecture: 'x64'
14-
- name: Build with Gradle
15-
run: ./gradlew build
39+
- uses: actions/checkout@v4
40+
41+
- name: Set up JDK 21
42+
uses: actions/setup-java@v4
43+
with:
44+
java-version: '21'
45+
distribution: 'temurin'
46+
47+
- name: Generate and submit dependency graph
48+
uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0

build.gradle

Lines changed: 86 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,117 @@
11
import org.apache.tools.ant.filters.ReplaceTokens
22

33
buildscript {
4-
repositories {
5-
maven {
6-
url "https://plugins.gradle.org/m2/"
7-
}
8-
}
9-
dependencies {
10-
classpath "org.springframework.boot:spring-boot-gradle-plugin:2.2.0.RELEASE"
4+
repositories {
5+
maven {
6+
url "https://plugins.gradle.org/m2/"
117
}
8+
}
9+
dependencies {
10+
classpath "org.springframework.boot:spring-boot-gradle-plugin:4.0.0-M1"
11+
}
1212
}
1313

1414
rootProject.version = "0.0.1"
1515
group = "com.spaceshift"
1616

1717
allprojects {
1818

19-
apply plugin: "java"
20-
apply plugin: "groovy"
21-
apply plugin: "org.springframework.boot"
19+
apply plugin: "java"
20+
apply plugin: "groovy"
21+
apply plugin: "org.springframework.boot"
2222

23-
sourceCompatibility = JavaVersion.VERSION_14
24-
targetCompatibility = JavaVersion.VERSION_14
23+
//sourceCompatibility = JavaVersion.VERSION_17
24+
//targetCompatibility = JavaVersion.VERSION_17
2525

26-
repositories {
27-
jcenter()
28-
mavenCentral()
29-
mavenLocal()
30-
maven { url "https://dl.bintray.com/javasabr/maven" }
31-
}
26+
repositories {
27+
mavenCentral()
28+
mavenLocal()
29+
}
3230

33-
ext {
34-
annotationVersion = "17.0.0"
35-
rlibVersion = "9.9.0"
36-
lombokVersion = '1.18.4'
37-
springbootVersion = '2.2.0.RELEASE'
38-
springVersion = '5.1.6.RELEASE'
39-
junitJupiterVersion = "5.5.2"
40-
testcontainersVersion = "1.12.1"
41-
groovyVersion = "3.0.4"
42-
spockVersion = "2.0-M3-groovy-3.0"
43-
projectReactorVersion = "3.3.0.RELEASE"
44-
byteBuddyVersion = "1.10.2"
45-
objenesisVersion = "3.1"
46-
gsonVersion = "2.8.6"
47-
}
31+
dependencies {
4832

49-
dependencies {
50-
51-
implementation "com.spaceshift:rlib.network:$rlibVersion"
52-
implementation "com.spaceshift:rlib.logger.slf4j:$rlibVersion"
53-
implementation "org.springframework.boot:spring-boot-starter:$springbootVersion"
54-
implementation "org.springframework.boot:spring-boot-starter-log4j2:$springbootVersion"
55-
implementation "io.projectreactor:reactor-core:$projectReactorVersion"
56-
implementation "com.google.code.gson:gson:$gsonVersion"
57-
58-
compileOnly "org.jetbrains:annotations:$annotationVersion"
59-
compileOnly "org.projectlombok:lombok:$lombokVersion"
60-
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
61-
62-
// FIXME to remove
63-
testCompile "com.hivemq:hivemq-mqtt-client:1.1.2"
64-
testCompile "io.moquette:moquette-broker:0.12.1"
65-
66-
testCompileOnly "org.jetbrains:annotations:$annotationVersion"
67-
testImplementation "org.springframework:spring-test:$springVersion"
68-
testImplementation "org.spockframework:spock-core:$spockVersion"
69-
testImplementation "org.spockframework:spock-spring:$spockVersion"
70-
testImplementation "org.codehaus.groovy:groovy-all:$groovyVersion"
71-
testImplementation "net.bytebuddy:byte-buddy-dep:$byteBuddyVersion"
72-
testImplementation "org.objenesis:objenesis:$objenesisVersion"
73-
}
33+
implementation libs.rlib.network
34+
implementation libs.rlib.logger.slf4j
35+
implementation libs.springboot.starter.core
36+
implementation libs.springboot.starter.log4j2
37+
implementation libs.project.reactor.core
38+
implementation libs.gson
7439

75-
sourceSets {
76-
main {
77-
java {
78-
srcDirs 'src/main/groovy'
79-
}
80-
}
81-
test {
82-
java {
83-
srcDirs 'src/test/groovy'
84-
}
85-
}
86-
}
87-
88-
tasks.withType(Test) {
89-
maxParallelForks = 2
90-
forkEvery = 100
91-
jvmArgs += "--enable-preview"
92-
}
93-
94-
tasks.withType(JavaCompile) {
95-
options.compilerArgs += "--enable-preview"
96-
}
97-
98-
tasks.withType(GroovyCompile) {
99-
options.forkOptions.jvmArgs += "--enable-preview"
40+
compileOnly libs.jetbrains.annotations
41+
compileOnly libs.jspecify
42+
compileOnly libs.lombok
43+
annotationProcessor libs.lombok
44+
45+
// FIXME to remove
46+
testImplementation libs.hivemq.mqtt.client
47+
// FIXME to remove
48+
testImplementation libs.moquette.broker
49+
testImplementation libs.spring.test
50+
testImplementation libs.spock.core
51+
testImplementation libs.spock.spring
52+
testImplementation libs.groovy.all
53+
testImplementation libs.byte.buddy.dep
54+
testImplementation libs.objenesis
55+
testCompileOnly libs.jetbrains.annotations
56+
testCompileOnly libs.jspecify
57+
}
58+
59+
test {
60+
useJUnitPlatform()
61+
failOnNoDiscoveredTests = false
62+
}
63+
64+
sourceSets {
65+
main {
66+
java {
67+
srcDirs 'src/main/groovy'
68+
}
10069
}
101-
102-
processResources {
103-
filter(ReplaceTokens, tokens: [
104-
])
70+
test {
71+
java {
72+
srcDirs 'src/test/groovy'
73+
}
10574
}
75+
}
76+
77+
tasks.withType(Test).configureEach {
78+
maxParallelForks = 2
79+
forkEvery = 100
80+
jvmArgs += "--enable-preview"
81+
}
82+
83+
tasks.withType(JavaCompile).configureEach {
84+
options.compilerArgs += "--enable-preview"
85+
}
86+
87+
tasks.withType(GroovyCompile).configureEach {
88+
options.forkOptions.jvmArgs += "--enable-preview"
89+
}
90+
91+
processResources {
92+
filter(ReplaceTokens, tokens: [
93+
])
94+
}
10695
}
10796

10897
task buildSingleArtifact(type: GradleBuild) {
109-
group = 'build'
110-
description = 'Build all modules -> Build result artifact'
111-
tasks = ['build', 'bootJar']
98+
group = 'build'
99+
description = 'Build all modules -> Build result artifact'
100+
tasks = ['build', 'bootJar']
112101
}
113102

114103
task buildSingleArtifactWithoutTests(type: GradleBuild) {
115-
group = 'build'
116-
description = 'Build all modules without tests -> Build result artifact'
117-
tasks = ['classes', 'bootJar']
104+
group = 'build'
105+
description = 'Build all modules without tests -> Build result artifact'
106+
tasks = ['classes', 'bootJar']
118107
}
119108

120109
wrapper {
121-
gradleVersion = '6.6-milestone-1'
122-
distributionType = Wrapper.DistributionType.ALL
110+
gradleVersion = '6.6-milestone-1'
111+
distributionType = Wrapper.DistributionType.ALL
123112
}
124113

125114
configurations.each {
126-
it.exclude group: "org.slf4j", module: "slf4j-log4j12"
127-
it.exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
115+
it.exclude group: "org.slf4j", module: "slf4j-log4j12"
116+
it.exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
128117
}

gradle/libs.versions.toml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
[versions]
2+
# https://gitlab.com/JavaSaBr/maven-repo/-/packages
3+
rlib = "10.0.alpha"
4+
# https://mvnrepository.com/artifact/org.jetbrains/annotations
5+
jetbrains-annotations = "26.0.2"
6+
# https://mvnrepository.com/artifact/org.projectlombok/lombok
7+
lombok = "1.18.38"
8+
# https://mvnrepository.com/artifact/org.jspecify/jspecify
9+
jspecify = "1.0.0"
10+
# https://mvnrepository.com/artifact/org.testcontainers/testcontainers
11+
testcontainers = "1.21.3"
12+
# https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine
13+
junit-jupiter = "5.13.4"
14+
# https://mvnrepository.com/artifact/org.junit.platform/junit-platform-launcher
15+
junit-platform-launcher = "1.13.4"
16+
# https://mvnrepository.com/artifact/io.projectreactor/reactor-core
17+
project-reactor = "3.7.8"
18+
# https://mvnrepository.com/artifact/com.google.code.gson/gson
19+
gson = "2.13.1"
20+
# https://mvnrepository.com/artifact/org.spockframework/spock-core
21+
spock = "2.4-M6-groovy-4.0"
22+
# https://mvnrepository.com/artifact/org.apache.groovy/groovy-all
23+
groovy = "4.0.28"
24+
# https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web
25+
springboot = '3.5.4'
26+
# https://mvnrepository.com/artifact/org.springframework/spring-core
27+
spring = '6.2.9'
28+
# https://mvnrepository.com/artifact/net.bytebuddy/byte-buddy
29+
byte-buddy = "1.17.6"
30+
# https://mvnrepository.com/artifact/org.objenesis/objenesis
31+
objenesis = "3.4"
32+
# https://mvnrepository.com/artifact/com.hivemq/hivemq-mqtt-client
33+
hivemq-mqtt-client = "1.3.7"
34+
# https://mvnrepository.com/artifact/io.moquette/moquette-broker
35+
moquette-broker = "0.17"
36+
37+
38+
[libraries]
39+
rlib-network = { module = "javasabr.rlib:rlib-network", version.ref = "rlib" }
40+
rlib-logger-slf4j = { module = "javasabr.rlib:rlib-logger-slf4j", version.ref = "rlib" }
41+
springboot-starter-core = { module = "org.springframework.boot:spring-boot-starter", version.ref = "springboot" }
42+
springboot-starter-log4j2 = { module = "org.springframework.boot:spring-boot-starter-log4j2", version.ref = "springboot" }
43+
project-reactor-core = { module = "io.projectreactor:reactor-core", version.ref = "project-reactor" }
44+
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
45+
46+
jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "jetbrains-annotations" }
47+
jspecify = { module = "org.jspecify:jspecify", version.ref = "jspecify" }
48+
lombok = { module = "org.projectlombok:lombok", version.ref = "lombok" }
49+
50+
spring-test = { module = "org.springframework:spring-test", version.ref = "spring" }
51+
spock-core = { module = "org.spockframework:spock-core", version.ref = "spock" }
52+
spock-spring = { module = "org.spockframework:spock-spring", version.ref = "spock" }
53+
groovy-all = { module = "org.apache.groovy:groovy-all", version.ref = "groovy" }
54+
byte-buddy-dep = { module = "net.bytebuddy:byte-buddy-dep", version.ref = "byte-buddy" }
55+
objenesis = { module = "org.objenesis:objenesis", version.ref = "objenesis" }
56+
hivemq-mqtt-client = { module = "com.hivemq:hivemq-mqtt-client", version.ref = "hivemq-mqtt-client" }
57+
moquette-broker = { module = "io.moquette:moquette-broker", version.ref = "moquette-broker" }
58+
59+
[bundles]
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-6.6-milestone-1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
2+
13
rootProject.name = 'MQTT-Broker'

src/main/java/com/ss/mqtt/broker/config/MqttConnectionConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@RequiredArgsConstructor
1212
public class MqttConnectionConfig {
1313

14-
private final @NotNull QoS maxQos;
14+
private final QoS maxQos;
1515

1616
private final int maximumPacketSize;
1717
private final int minKeepAliveTime;

0 commit comments

Comments
 (0)