Skip to content

Commit 8215ba5

Browse files
authored
Merge pull request #42 from JavaSaBr/feature/issues-40-upgrade-java-stack-part2
Upgrade java stack, part 2 - Reformat, restructure and cleaup code
2 parents ba64d6b + 72c2519 commit 8215ba5

File tree

413 files changed

+13035
-13268
lines changed

Some content is hidden

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

413 files changed

+13035
-13268
lines changed

application/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
plugins {
2+
id "java-library"
3+
}
4+
5+
dependencies {
6+
7+
testImplementation projects.testSupport
8+
}

base/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apply plugin: "java-library"
2+
apply from: "$rootDir/gradle/configure-java.gradle"
3+
4+
dependencies {
5+
api libs.gson
6+
api libs.rlib.collections
7+
testImplementation projects.testSupport
8+
}

src/main/java/com/ss/mqtt/broker/util/DebugUtils.java renamed to base/src/main/java/javasabr/mqtt/base/utils/DebugUtils.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
package com.ss.mqtt.broker.util;
1+
package javasabr.mqtt.base.utils;
22

33
import com.google.gson.ExclusionStrategy;
44
import com.google.gson.FieldAttributes;
55
import com.google.gson.Gson;
66
import com.google.gson.GsonBuilder;
7+
import java.lang.StackWalker.Option;
8+
import java.lang.reflect.Field;
79
import java.util.Collection;
10+
import java.util.Set;
811
import javasabr.rlib.collections.array.ArrayFactory;
912
import javasabr.rlib.collections.array.MutableArray;
1013
import javasabr.rlib.common.util.ArrayUtils;
1114
import javasabr.rlib.common.util.ReflectionUtils;
1215

13-
import java.lang.StackWalker.Option;
14-
import java.lang.reflect.Field;
15-
import java.util.Set;
16-
1716
public class DebugUtils {
1817

1918
public static class PrintOnlyProvidedFields implements ExclusionStrategy {
@@ -42,8 +41,8 @@ public boolean shouldSkipClass(Class<?> clazz) {
4241
}
4342
}
4443

45-
private static final MutableArray<ExclusionStrategy> ADDITIONAL_EXCLUDE_STRATEGIES =
46-
ArrayFactory.copyOnModifyArray(ExclusionStrategy.class);
44+
private static final MutableArray<ExclusionStrategy> ADDITIONAL_EXCLUDE_STRATEGIES = ArrayFactory.copyOnModifyArray(
45+
ExclusionStrategy.class);
4746

4847
private static class ExclusionStrategyContainer implements ExclusionStrategy {
4948

@@ -81,7 +80,9 @@ public static void registerIncludedFields(String... fieldNames) {
8180

8281
boolean anyMatch = allFields
8382
.stream()
84-
.anyMatch(field -> field.getName().equals(fieldName));
83+
.anyMatch(field -> field
84+
.getName()
85+
.equals(fieldName));
8586

8687
if (!anyMatch) {
8788
throw new RuntimeException("Not found field " + fieldName + " in type " + callerClass);

build.gradle

Lines changed: 21 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -11,107 +11,43 @@ buildscript {
1111
}
1212
}
1313

14-
rootProject.version = "0.0.1"
15-
group = "com.spaceshift"
16-
17-
allprojects {
18-
19-
apply plugin: "java"
20-
apply plugin: "groovy"
21-
apply plugin: "org.springframework.boot"
14+
repositories {
15+
maven {
16+
url "https://gitlab.com/api/v4/projects/37512056/packages/maven"
17+
}
18+
}
2219

23-
//sourceCompatibility = JavaVersion.VERSION_17
24-
//targetCompatibility = JavaVersion.VERSION_17
20+
rootProject.version = "0.0.1"
21+
group = "javasabr.mqtt"
2522

23+
subprojects {
2624
repositories {
2725
mavenCentral()
2826
mavenLocal()
29-
}
30-
31-
dependencies {
32-
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
39-
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-
}
69-
}
70-
test {
71-
java {
72-
srcDirs 'src/test/groovy'
73-
}
27+
maven {
28+
url "https://gitlab.com/api/v4/projects/37512056/packages/maven"
7429
}
7530
}
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-
}
9531
}
9632

97-
task buildSingleArtifact(type: GradleBuild) {
98-
group = 'build'
99-
description = 'Build all modules -> Build result artifact'
33+
tasks.register("buildSingleArtifact", GradleBuild) {
34+
group = "build"
35+
description = "Build all modules -> Build result artifact"
10036
tasks = ['build', 'bootJar']
10137
}
10238

103-
task buildSingleArtifactWithoutTests(type: GradleBuild) {
104-
group = 'build'
105-
description = 'Build all modules without tests -> Build result artifact'
39+
tasks.register("buildSingleArtifactWithoutTests", GradleBuild) {
40+
group = "build"
41+
description = "Build all modules without tests -> Build result artifact"
10642
tasks = ['classes', 'bootJar']
10743
}
10844

109-
wrapper {
110-
gradleVersion = '6.6-milestone-1'
111-
distributionType = Wrapper.DistributionType.ALL
112-
}
113-
11445
configurations.each {
11546
it.exclude group: "org.slf4j", module: "slf4j-log4j12"
11647
it.exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
11748
}
49+
50+
wrapper {
51+
gradleVersion = '9.1.0'
52+
distributionType = Wrapper.DistributionType.ALL
53+
}

gradle/configure-java.gradle

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import org.apache.tools.ant.filters.ReplaceTokens
2+
3+
dependencies {
4+
compileOnly libs.jspecify
5+
compileOnly libs.lombok
6+
annotationProcessor libs.lombok
7+
}
8+
9+
test {
10+
useJUnitPlatform()
11+
failOnNoDiscoveredTests = false
12+
}
13+
14+
sourceSets {
15+
main {
16+
java {
17+
srcDirs 'src/main/groovy'
18+
}
19+
}
20+
test {
21+
java {
22+
srcDirs 'src/test/groovy'
23+
}
24+
}
25+
}
26+
27+
tasks.withType(Test).configureEach {
28+
maxParallelForks = 2
29+
forkEvery = 100
30+
jvmArgs += "--enable-preview"
31+
}
32+
33+
tasks.withType(JavaCompile).configureEach {
34+
options.compilerArgs += "--enable-preview"
35+
}
36+
37+
38+
processResources {
39+
filter(ReplaceTokens, tokens: [])
40+
}

gradle/libs.versions.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
22
# https://gitlab.com/JavaSaBr/maven-repo/-/packages
3-
rlib = "10.0.alpha"
3+
rlib = "10.0.alpha1"
44
# https://mvnrepository.com/artifact/org.jetbrains/annotations
55
jetbrains-annotations = "26.0.2"
66
# https://mvnrepository.com/artifact/org.projectlombok/lombok
@@ -38,6 +38,7 @@ moquette-broker = "0.17"
3838
[libraries]
3939
rlib-network = { module = "javasabr.rlib:rlib-network", version.ref = "rlib" }
4040
rlib-logger-slf4j = { module = "javasabr.rlib:rlib-logger-slf4j", version.ref = "rlib" }
41+
rlib-collections = { module = "javasabr.rlib:rlib-collections", version.ref = "rlib" }
4142
springboot-starter-core = { module = "org.springframework.boot:spring-boot-starter", version.ref = "springboot" }
4243
springboot-starter-log4j2 = { module = "org.springframework.boot:spring-boot-starter-log4j2", version.ref = "springboot" }
4344
project-reactor-core = { module = "io.projectreactor:reactor-core", version.ref = "project-reactor" }

gradle/wrapper/gradle-wrapper.jar

-13.4 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)