From 03bfb0de42b2c4326a8661375adc8193b6ed1eeb Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Fri, 26 Apr 2024 00:28:42 +0800 Subject: [PATCH 1/7] Run `./gradlew wrapper --gradle-version 8.7` --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2b303b2bb5..1912c70206 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -17,7 +17,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From 462d2046c4d6c0a2ac6c1d2e5f273cdd235bfe9d Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Fri, 26 Apr 2024 00:29:13 +0800 Subject: [PATCH 2/7] Update deprecated statements --- build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index a263b9e41b..9e7207da7c 100644 --- a/build.gradle +++ b/build.gradle @@ -273,7 +273,7 @@ tasks.register('generateDistLicense') { dependsOn('cyclonedxBom') // Task from 'org.cyclonedx.bom' plugin doLast { // Inputs - def bomFile = file("$buildDir/reports/bom.json") + def bomFile = file("build/reports/bom.json") def bom = new JsonSlurper().parseText(bomFile.text) def projectLicenseText = file('LICENSE').text @@ -443,7 +443,7 @@ tasks.register('generateDistNotice') { dependsOn('generateLicenseReport') // Task from 'com.github.jk1.dependency-license-report' plugin doLast { // Inputs - def reportsDir = file("$buildDir/reports/dependency-license/") + def reportsDir = file("build/reports/dependency-license/") def projectNoticeText = file('NOTICE').text // Outputs @@ -503,7 +503,7 @@ subprojects { showProgress = true showStackTraces = true effort = 'default' - reportsDir = file("$buildDir/reports/spotbugs") + reportsDir = file("build/reports/spotbugs") projectName = rootProject.name release = version extraArgs = ['-nested:false'] @@ -516,7 +516,7 @@ subprojects { xml.required = false html { required = true - outputLocation = file("$buildDir/reports/spotbugs/main/spotbugs.html") + outputLocation = file("build/reports/spotbugs/main/spotbugs.html") stylesheet = 'fancy-hist.xsl' } } @@ -527,7 +527,7 @@ subprojects { xml.enabled = false html { enabled = true - destination = file("$buildDir/reports/spotbugs/test/spotbugs.html") + destination = file("build/reports/spotbugs/test/spotbugs.html") stylesheet = 'fancy-hist.xsl' } } From 59df6edc7d14feaa9f51ddc29da461436ace45c1 Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Fri, 26 Apr 2024 00:39:28 +0800 Subject: [PATCH 3/7] Update some outdated grammar --- build.gradle | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 9e7207da7c..6f925d69b7 100644 --- a/build.gradle +++ b/build.gradle @@ -55,15 +55,6 @@ plugins { id 'com.github.jk1.dependency-license-report' version '2.6' } -// Remove doclint warnings that pollute javadoc logs when building -if (JavaVersion.current().isJava8()) { - allprojects { - tasks.withType(Javadoc) { - options.addStringOption('xdoclint:none', '-quiet') - } - } -} - allprojects { apply plugin: 'java' apply plugin: "eclipse" @@ -149,6 +140,15 @@ allprojects { test { useJUnitPlatform() } + + // Remove doclint warnings that pollute javadoc logs when building + if (JavaVersion.current().isJava8()) { + tasks.withType(Javadoc).tap { + configureEach { + options.addStringOption('xdoclint:none', '-quiet') + } + } + } } tasks.register('dist') { @@ -563,12 +563,13 @@ subprojects { options.encoding = "UTF-8" } - task packageJavadoc(type: Jar, dependsOn: ['javadoc']) { + tasks.register('packageJavadoc', Jar) { + dependsOn('javadoc') from project.javadoc.destinationDir archiveClassifier.set('javadoc') } - task packageSources(type: Jar) { + tasks.register('packageSources', Jar) { from project.sourceSets.main.allSource archiveClassifier.set('sources') } @@ -580,7 +581,7 @@ subprojects { } if (!Boolean.valueOf(signEnabled)) { - tasks.whenTaskAdded { task -> + tasks.configureEach { task -> if (task.name.contains("sign")) { task.enabled = false } @@ -592,7 +593,7 @@ subprojects { maven { url "https://maven.aliyun.com/repository/public" } } - configurations.all { + configurations.configureEach { resolutionStrategy.cacheChangingModulesFor 0, TimeUnit.SECONDS resolutionStrategy.cacheDynamicVersionsFor 0, TimeUnit.SECONDS } From a2bb88812a29fafeab809cf692902e4af5ae1fdb Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Fri, 26 Apr 2024 00:39:56 +0800 Subject: [PATCH 4/7] Put some tasks to a better place --- build.gradle | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index 6f925d69b7..608ba41447 100644 --- a/build.gradle +++ b/build.gradle @@ -203,27 +203,6 @@ tasks.register('dist') { } } -tasks.register('tar', Tar) { - archiveBaseName.set(project.name) - archiveVersion.set(project.version.toString()) - archiveExtension.set('tar.gz') - compression = Compression.GZIP - destinationDirectory = new File(projectDir, 'build') - into('/') { - from 'dist' - } -} - -tasks.register('zip', Zip) { - archiveBaseName.set(project.name) - archiveVersion.set(project.version.toString()) - archiveExtension.set('zip') - destinationDirectory = new File(projectDir, 'build') - into('/') { - from 'dist' - } -} - tasks.register('installPlugin') { var pluginProjects = subprojects.findAll { it.file('gradle.properties').exists() @@ -256,6 +235,27 @@ tasks.register('installPlugin') { } } +tasks.register('tar', Tar) { + archiveBaseName.set(project.name) + archiveVersion.set(project.version.toString()) + archiveExtension.set('tar.gz') + compression = Compression.GZIP + destinationDirectory = new File(projectDir, 'build') + into('/') { + from 'dist' + } +} + +tasks.register('zip', Zip) { + archiveBaseName.set(project.name) + archiveVersion.set(project.version.toString()) + archiveExtension.set('zip') + destinationDirectory = new File(projectDir, 'build') + into('/') { + from 'dist' + } +} + tasks.register('printProjects') { getAllprojects().forEach(subProject -> { if ("EventMesh".equals(subProject.getName())) { @@ -646,7 +646,6 @@ subprojects { username apacheUserName password apachePassWord } - } } } From e5a6305f7905287308b5d5b9ff3b42f984ae0ec5 Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Fri, 26 Apr 2024 00:43:04 +0800 Subject: [PATCH 5/7] Upgrade gRPC to 1.50.2 --- build.gradle | 2 +- eventmesh-examples/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 608ba41447..346e58e03f 100644 --- a/build.gradle +++ b/build.gradle @@ -654,7 +654,7 @@ subprojects { sign publishing.publications.mavenJava } - def grpcVersion = '1.43.2' + def grpcVersion = '1.50.2' def log4jVersion = '2.22.1' dependencyManagement { diff --git a/eventmesh-examples/build.gradle b/eventmesh-examples/build.gradle index 3cb1c2c0a2..5d256f0161 100644 --- a/eventmesh-examples/build.gradle +++ b/eventmesh-examples/build.gradle @@ -15,7 +15,7 @@ * limitations under the License. */ -def grpcVersion = '1.43.2' +def grpcVersion = '1.50.2' dependencies { implementation project(":eventmesh-sdks:eventmesh-sdk-java") From 6c3a930aa0100bdeb73d44858c93579a313971ff Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Sat, 18 May 2024 08:48:48 +0800 Subject: [PATCH 6/7] Add unified version identifier --- build.gradle | 58 +++++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/build.gradle b/build.gradle index 25b9386a02..49dbd386df 100644 --- a/build.gradle +++ b/build.gradle @@ -649,6 +649,12 @@ subprojects { def grpcVersion = '1.50.2' def log4jVersion = '2.23.1' + def jacksonVersion = '2.17.1' + def dropwizardMetricsVersion = '4.1.0' + def opentelemetryVersion = '1.36.0' + def cloudeventsVersion = '2.4.2' + def curatorVersion = '5.4.0' + def mockitoVersion = '3.8.0' dependencyManagement { dependencies { @@ -669,11 +675,11 @@ subprojects { dependency "com.lmax:disruptor:3.4.2" - dependency "com.fasterxml.jackson.core:jackson-databind:2.13.0" - dependency "com.fasterxml.jackson.core:jackson-core:2.13.0" - dependency "com.fasterxml.jackson.core:jackson-annotations:2.17.1" - dependency "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.0" - dependency "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.0" + dependency "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}" + dependency "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}" + dependency "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}" + dependency "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jacksonVersion}" + dependency "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${jacksonVersion}" dependency "com.squareup.okhttp3:okhttp:3.14.9" @@ -682,18 +688,18 @@ subprojects { dependency "io.netty:netty-all:4.1.79.Final" - dependency 'io.dropwizard.metrics:metrics-core:4.1.0' - dependency "io.dropwizard.metrics:metrics-healthchecks:4.1.0" - dependency "io.dropwizard.metrics:metrics-annotation:4.1.0" - dependency "io.dropwizard.metrics:metrics-json:4.1.0" + dependency "io.dropwizard.metrics:metrics-core:${dropwizardMetricsVersion}" + dependency "io.dropwizard.metrics:metrics-healthchecks:${dropwizardMetricsVersion}" + dependency "io.dropwizard.metrics:metrics-annotation:${dropwizardMetricsVersion}" + dependency "io.dropwizard.metrics:metrics-json:${dropwizardMetricsVersion}" - dependency 'io.opentelemetry:opentelemetry-api:1.36.0' - dependency 'io.opentelemetry:opentelemetry-sdk:1.36.0' - dependency 'io.opentelemetry:opentelemetry-sdk-metrics:1.36.0' - dependency 'io.opentelemetry:opentelemetry-exporter-prometheus:1.36.0-alpha' - dependency 'io.opentelemetry:opentelemetry-exporter-zipkin:1.36.0' - dependency 'io.opentelemetry:opentelemetry-semconv:1.30.1-alpha' - dependency 'io.opentelemetry:opentelemetry-exporter-jaeger:1.34.1' + dependency "io.opentelemetry:opentelemetry-api:${opentelemetryVersion}" + dependency "io.opentelemetry:opentelemetry-sdk:${opentelemetryVersion}" + dependency "io.opentelemetry:opentelemetry-sdk-metrics:${opentelemetryVersion}" + dependency "io.opentelemetry:opentelemetry-exporter-prometheus:${opentelemetryVersion}-alpha" + dependency "io.opentelemetry:opentelemetry-exporter-zipkin:${opentelemetryVersion}" + dependency "io.opentelemetry:opentelemetry-semconv:1.30.1-alpha" + dependency "io.opentelemetry:opentelemetry-exporter-jaeger:1.34.1" dependency "io.openmessaging:openmessaging-api:2.2.1-pubsub" @@ -708,13 +714,13 @@ subprojects { dependency "org.junit-pioneer:junit-pioneer:1.9.1" dependency "org.assertj:assertj-core:2.6.0" - dependency "org.mockito:mockito-core:3.8.0" - dependency "org.mockito:mockito-inline:3.8.0" - dependency "org.mockito:mockito-junit-jupiter:3.8.0" + dependency "org.mockito:mockito-core:${mockitoVersion}" + dependency "org.mockito:mockito-inline:${mockitoVersion}" + dependency "org.mockito:mockito-junit-jupiter:${mockitoVersion}" - dependency "io.cloudevents:cloudevents-core:2.4.2" - dependency "io.cloudevents:cloudevents-json-jackson:2.4.2" - dependency "io.cloudevents:cloudevents-protobuf:2.4.2" + dependency "io.cloudevents:cloudevents-core:${cloudeventsVersion}" + dependency "io.cloudevents:cloudevents-json-jackson:${cloudeventsVersion}" + dependency "io.cloudevents:cloudevents-protobuf:${cloudeventsVersion}" dependency "io.grpc:grpc-core:${grpcVersion}" dependency "io.grpc:grpc-protobuf:${grpcVersion}" @@ -733,10 +739,10 @@ subprojects { dependency "com.alibaba.nacos:nacos-client:2.2.3" dependency 'org.apache.zookeeper:zookeeper:3.7.1' - dependency 'org.apache.curator:curator-client:5.4.0' - dependency 'org.apache.curator:curator-framework:5.4.0' - dependency 'org.apache.curator:curator-recipes:5.4.0' - dependency 'org.apache.curator:curator-test:5.4.0' + dependency "org.apache.curator:curator-client:${curatorVersion}" + dependency "org.apache.curator:curator-framework:${curatorVersion}" + dependency "org.apache.curator:curator-recipes:${curatorVersion}" + dependency "org.apache.curator:curator-test:${curatorVersion}" dependency "org.projectlombok:lombok:1.18.22" dependency "com.github.seancfoley:ipaddress:5.3.3" From c57540d19cb315a3235c67cc542e10fa2b833276 Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Sat, 18 May 2024 09:26:50 +0800 Subject: [PATCH 7/7] Upgrade to snakeyaml 2.0 according to https://bitbucket.org/snakeyaml/snakeyaml/issues/556/update-yamlloadas-signature-to-support --- build.gradle | 1 - eventmesh-common/build.gradle | 2 +- .../org/apache/eventmesh/common/config/ConfigInfo.java | 4 ++-- .../org/apache/eventmesh/common/config/FileLoad.java | 10 +++++++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 49dbd386df..be08b01cc8 100644 --- a/build.gradle +++ b/build.gradle @@ -733,7 +733,6 @@ subprojects { dependency "com.github.seancfoley:ipaddress:5.3.3" dependency "com.google.code.gson:gson:2.8.2" - dependency "org.yaml:snakeyaml:1.30" dependency "org.javassist:javassist:3.30.2-GA" dependency "com.alibaba.nacos:nacos-client:2.2.3" diff --git a/eventmesh-common/build.gradle b/eventmesh-common/build.gradle index 23f9455e1a..5926f7ed91 100644 --- a/eventmesh-common/build.gradle +++ b/eventmesh-common/build.gradle @@ -42,6 +42,7 @@ dependencies { api "com.fasterxml.jackson.core:jackson-databind" api "com.fasterxml.jackson.core:jackson-core" api "com.fasterxml.jackson.core:jackson-annotations" + api "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml" api "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" implementation "org.apache.httpcomponents:httpclient" @@ -53,7 +54,6 @@ dependencies { implementation "javax.annotation:javax.annotation-api:1.3.2" testImplementation "org.junit-pioneer:junit-pioneer" - implementation "org.yaml:snakeyaml" compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigInfo.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigInfo.java index e87b119788..a180f0f6ba 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigInfo.java +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigInfo.java @@ -28,7 +28,7 @@ @Builder @AllArgsConstructor @NoArgsConstructor -public class ConfigInfo { +public class ConfigInfo { public static final String HUMP_SPOT = "spot"; public static final String HUMP_ROD = "rod"; @@ -40,7 +40,7 @@ public class ConfigInfo { private boolean monitor; private boolean removePrefix; - private Class clazz; + private Class clazz; private Object object; private String filePath; diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/FileLoad.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/FileLoad.java index adfdc9f581..a0c81ea481 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/FileLoad.java +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/FileLoad.java @@ -22,11 +22,12 @@ import org.apache.commons.lang3.StringUtils; -import java.io.BufferedInputStream; import java.io.BufferedReader; -import java.io.FileInputStream; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; +import java.io.Reader; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Objects; @@ -100,7 +101,10 @@ class YamlFileLoad implements FileLoad { @Override public T getConfig(ConfigInfo configInfo) throws IOException { Yaml yaml = new Yaml(); - return (T) yaml.loadAs(new BufferedInputStream(new FileInputStream(configInfo.getFilePath())), configInfo.getClazz()); + try (InputStream input = Files.newInputStream(Paths.get(configInfo.getFilePath())); + Reader reader = new InputStreamReader(input, StandardCharsets.UTF_8)) { + return (T) yaml.loadAs(reader, configInfo.getClazz()); + } } } }