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

[ISSUE #4700] Remove logging backends from runtime deps #4719

Merged
merged 23 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
103daac
[ISSUE #4700] Remove logging backends from runtime deps
ppkarwasz Jan 3, 2024
6b0c122
Fix licenses
ppkarwasz Jan 4, 2024
965cc90
Merge remote-tracking branch 'apache/master' into logging-deps
ppkarwasz Apr 5, 2024
f237570
Fix Logback exclusions
ppkarwasz Apr 5, 2024
96db748
Fix license check
ppkarwasz Apr 5, 2024
cb0bf2b
Fix `printProjects` according to the review
ppkarwasz Apr 6, 2024
ec028ca
Add logging backend to `eventmesh-starter`
ppkarwasz Apr 6, 2024
fe5d26e
Remove task description
ppkarwasz Apr 6, 2024
6765a82
Fix task dependencies of task `installPlugin`
ppkarwasz Apr 6, 2024
8d5cab7
Fix `installPlugin` task
ppkarwasz Apr 6, 2024
52d38a7
Add comment about exclusions
ppkarwasz Apr 6, 2024
e89f31c
Minimize changes to current configuration
ppkarwasz Apr 8, 2024
cd3df62
Merge remote-tracking branch 'apache/master' into logging-deps
ppkarwasz Apr 8, 2024
04e03f3
Add comments to remove exclusions after upgrade
ppkarwasz Apr 9, 2024
f5d8b73
Make `installPlugin` independent from `dist`
ppkarwasz Apr 11, 2024
b6a574d
Make `copy` tasks easier to understand
ppkarwasz Apr 11, 2024
fec936a
Add `eventmesh-common` to EventMesh OpenConnect deps
ppkarwasz Apr 11, 2024
ebc6d0a
Refactor RocketMQ deps
ppkarwasz Apr 11, 2024
d17cb9c
Delete `output.dirs`
ppkarwasz Apr 11, 2024
44cd3cd
Fix typo
ppkarwasz Apr 11, 2024
54c352c
Remove last `outputs.dir`
ppkarwasz Apr 11, 2024
f18e6c9
Remove dependencies from `installPlugin`
ppkarwasz Apr 13, 2024
e771010
Add `eventmesh-common` to OpenConnect artifacts
ppkarwasz Apr 15, 2024
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ node_modules
h2/db.mv.db

# license check tmp file
all-dependencies.txt
/tools/dependency-check/all-dependencies.txt
self-modules.txt
third-party-dependencies.txt

Expand All @@ -50,4 +50,4 @@ bld/
**/org/apache/eventmesh/connector/jdbc/antlr4/autogeneration/*

#rust
Cargo.lock
Cargo.lock
266 changes: 148 additions & 118 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,33 @@ allprojects {
.exclude('**/org/apache/eventmesh/connector/openfunction/client/CallbackServiceGrpc**')
.exclude('**/org/apache/eventmesh/connector/jdbc/antlr**')

configurations {
if (!"eventmesh-starter".equals(project.name)) {
runtimeClasspath {
// Log4j API implementations
exclude group: 'org.apache.logging.log4j', module: 'log4j-core'
ppkarwasz marked this conversation as resolved.
Show resolved Hide resolved
exclude group: 'org.apache.logging.log4j', module: 'log4j-to-jul'
exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j'
// SLF4J implementations
exclude group: 'ch.qos.logback', module: 'logback-classic'
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'org.slf4j', module: 'slf4j-nop'
exclude group: 'org.slf4j', module: 'slf4j-reload4j'
exclude group: 'org.slf4j', module: 'slf4j-simple'
exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl'
exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j2-impl'
// JUL implementations
exclude group: 'org.apache.logging.log4j', module: 'log4j-jul'
exclude group: 'org.slf4j', module: 'jul-to-slf4j'
// Log4j 1.x and replacements
exclude group: 'log4j', module: 'log4j'
exclude group: 'org.slf4j', module: 'log4j-over-slf4j'
exclude group: 'org.apache.logging.log4j', module: 'log4j-1.2-api'
}
}
}

dependencies {
repositories {
mavenLocal()
Expand Down Expand Up @@ -139,6 +166,72 @@ allprojects {
}
}

def log4jVersion = '2.22.1'

configurations {
distOnly
}

dependencies {
distOnly "org.apache.logging.log4j:log4j-core:${log4jVersion}"
distOnly "org.apache.logging.log4j:log4j-slf4j2-impl:${log4jVersion}"
}
ppkarwasz marked this conversation as resolved.
Show resolved Hide resolved

tasks.register('dist') {
ppkarwasz marked this conversation as resolved.
Show resolved Hide resolved
group = JavaBasePlugin.BUILD_TASK_NAME
description "Creates the distribution directory"
ppkarwasz marked this conversation as resolved.
Show resolved Hide resolved
def includedProjects =
["eventmesh-common",
"eventmesh-meta:eventmesh-meta-api",
"eventmesh-metrics-plugin:eventmesh-metrics-api",
"eventmesh-protocol-plugin:eventmesh-protocol-api",
"eventmesh-retry:eventmesh-retry-api",
"eventmesh-runtime",
"eventmesh-security-plugin:eventmesh-security-api",
"eventmesh-spi",
"eventmesh-starter",
"eventmesh-storage-plugin:eventmesh-storage-api",
"eventmesh-trace-plugin:eventmesh-trace-api",
"eventmesh-webhook:eventmesh-webhook-api",
"eventmesh-webhook:eventmesh-webhook-admin",
"eventmesh-webhook:eventmesh-webhook-receive"]
includedProjects.each { dependsOn("${it}:jar") }
outputs.dirs('dist/apps', 'dist/bin', 'dist/conf', 'dist/lib', 'dist/licenses')
ppkarwasz marked this conversation as resolved.
Show resolved Hide resolved
ppkarwasz marked this conversation as resolved.
Show resolved Hide resolved
doLast {
includedProjects.each {
def project = findProject(it)
ppkarwasz marked this conversation as resolved.
Show resolved Hide resolved
copy {
from project.jar.archivePath
into 'dist/apps'
}
copy {
from project.file('bin')
into 'dist/bin'
}
copy {
from project.file('conf')
from project.sourceSets.main.resources.srcDirs
into 'dist/conf'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
exclude 'META-INF'
}
copy {
from project.configurations.runtimeClasspath
into 'dist/lib'
exclude 'eventmesh*'
}
ppkarwasz marked this conversation as resolved.
Show resolved Hide resolved
}
copy {
from configurations.distOnly
into 'dist/lib'
}
copy {
from 'tools/third-party-licenses'
into 'dist'
}
}
}

task tar(type: Tar) {
archiveBaseName.set(project.name)
archiveVersion.set(project.version.toString())
Expand All @@ -160,50 +253,52 @@ task zip(type: Zip) {
}
}

task installPlugin() {
if (!new File("${rootDir}/dist").exists()) {
return
}
String[] libJars = java.util.Optional.ofNullable(new File("${rootDir}/dist/lib").list()).orElseGet(() -> new String[0])
getAllprojects().forEach(subProject -> {
var file = new File("${subProject.projectDir}/gradle.properties")
if (!file.exists()) {
tasks.register('installPlugin') {
doLast {
if (!new File("${rootDir}/dist").exists()) {
return
}
Pil0tXia marked this conversation as resolved.
Show resolved Hide resolved
var properties = new Properties()
properties.load(new FileInputStream(file))
var pluginType = properties.getProperty("pluginType")
var pluginName = properties.getProperty("pluginName")
if (pluginType == null || pluginName == null) {
return
}
var pluginFile = new File("${rootDir}/dist/plugin/${pluginType}/${pluginName}")
if (pluginFile.exists()) {
return
}
pluginFile.mkdirs()
println String.format(
"install plugin, pluginType: %s, pluginInstanceName: %s, module: %s", pluginType, pluginName, subProject.getName()
)

copy {
into "${rootDir}/dist/plugin/${pluginType}/${pluginName}"
from "${subProject.getProjectDir()}/dist/apps"
}
copy {
into "${rootDir}/dist/plugin/${pluginType}/${pluginName}"
from "${subProject.getProjectDir()}/dist/lib/"
exclude(libJars)
}
copy {
into "${rootDir}/dist/conf"
from "${subProject.getProjectDir()}/dist/conf"
exclude 'META-INF'
}
})
String[] libJars = java.util.Optional.ofNullable(new File("${rootDir}/dist/lib").list()).orElseGet(() -> new String[0])
getAllprojects().forEach(subProject -> {
var file = new File("${subProject.projectDir}/gradle.properties")
if (!file.exists()) {
return
}
var properties = new Properties()
properties.load(new FileInputStream(file))
var pluginType = properties.getProperty("pluginType")
var pluginName = properties.getProperty("pluginName")
if (pluginType == null || pluginName == null) {
return
}
var pluginFile = new File("${rootDir}/dist/plugin/${pluginType}/${pluginName}")
if (pluginFile.exists()) {
return
}
pluginFile.mkdirs()
println String.format(
"install plugin, pluginType: %s, pluginInstanceName: %s, module: %s", pluginType, pluginName, subProject.getName()
)
copy {
from subProject.jar.archivePath
into "${rootDir}/dist/plugin/${pluginType}/${pluginName}"
}
copy {
from subProject.configurations.runtimeClasspath
into "${rootDir}/dist/plugin/${pluginType}/${pluginName}"
exclude(libJars)
}
copy {
from subProject.file('conf')
from subProject.sourceSets.main.resources.srcDirs
into "${rootDir}/dist/conf"
exclude 'META-INF'
}
})
}
}

task printProjects() {
tasks.register('printProjects') {
getAllprojects().forEach(subProject -> {
if ("EventMesh".equals(subProject.getName())) {
return
Expand Down Expand Up @@ -303,77 +398,6 @@ subprojects {
}
}

task dist(dependsOn: ['jar']) {
doFirst {
new File("${projectDir}/dist/bin").mkdirs()
new File("${projectDir}/dist/apps").mkdirs()
new File("${projectDir}/dist/conf").mkdirs()
new File("${projectDir}/dist/lib").mkdirs()
new File("${projectDir}/dist/licenses").mkdirs()
}
Set<String> rootProject = ["eventmesh-common",
"eventmesh-storage-api",
"eventmesh-metrics-api",
"eventmesh-meta-api",
"eventmesh-trace-api",
"eventmesh-retry-api",
"eventmesh-runtime",
"eventmesh-security-api",
"eventmesh-protocol-api",
"eventmesh-starter",
"eventmesh-spi",
"eventmesh-webhook-api",
"eventmesh-webhook-admin",
"eventmesh-webhook-receive"]
doLast {
copy {
into("${projectDir}/dist/apps")
from project.jar.getArchivePath()
}
copy {
into("${projectDir}/dist/lib")
from project.configurations.runtimeClasspath
}
copy {
into("${projectDir}/dist/bin")
from 'bin'
}
copy {
into("${projectDir}/dist/conf")
from 'conf', sourceSets.main.resources.srcDirs
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
exclude 'META-INF'
}
if (rootProject.contains(project.name)) {
new File("${rootDir}/dist/apps").mkdirs()
new File("${rootDir}/dist/lib").mkdirs()
new File("${rootDir}/dist/bin").mkdirs()
new File("${rootDir}/dist/conf").mkdirs()
copy {
into("${rootDir}/dist/apps")
from "${projectDir}/dist/apps"
}
copy {
into "${rootDir}/dist/lib"
from "${projectDir}/dist/lib"
exclude "eventmesh-*"
}
copy {
into "${rootDir}/dist/bin"
from "${projectDir}/dist/bin"
}
copy {
into "${rootDir}/dist/conf"
from "${projectDir}/dist/conf"
}
}
copy {
into "${rootDir}/dist"
from "${rootDir}/tools/third-party-licenses"
}
}
}

javadoc {
source = sourceSets.main.java
destinationDir = reporting.file("javadoc")
Expand Down Expand Up @@ -473,9 +497,12 @@ subprojects {
}

def grpcVersion = '1.43.2'
def log4jVersion = '2.22.1'
def springBootVersion = '2.7.10'

dependencyManagement {
imports {
mavenBom "org.apache.logging.log4j:log4j-bom:${log4jVersion}"
}
dependencies {
dependency "org.apache.commons:commons-lang3:3.6"
dependency "org.apache.commons:commons-collections4:4.1"
Expand All @@ -488,10 +515,6 @@ subprojects {
dependency "com.google.guava:guava:31.0.1-jre"

dependency "org.slf4j:slf4j-api:2.0.9"
dependency "org.apache.logging.log4j:log4j-api:${log4jVersion}"
dependency "org.apache.logging.log4j:log4j-core:${log4jVersion}"
dependency "org.apache.logging.log4j:log4j-slf4j2-impl:${log4jVersion}"
dependency "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}" // used with SLF4J 1.7.x or older for third-party dependencies

dependency "com.lmax:disruptor:3.4.2"

Expand Down Expand Up @@ -529,7 +552,11 @@ subprojects {
dependency "com.mebigfatguy.fb-contrib:fb-contrib:7.6.0"
dependency "com.jayway.jsonpath:json-path:2.7.0"

dependency "org.springframework.boot:spring-boot-starter-web:2.7.10"
// Exclude 'spring-boot-starter-logging' only once in the right artifact
dependency("org.springframework.boot:spring-boot-starter:${springBootVersion}") {
exclude group: 'org.springframework.boot', name: 'spring-boot-starter-logging'
}
dependency "org.springframework.boot:spring-boot-starter-web:${springBootVersion}"
dependency "io.openmessaging:registry-server:0.0.1"

dependency "org.junit.jupiter:junit-jupiter:5.6.0"
Expand Down Expand Up @@ -560,7 +587,10 @@ subprojects {

dependency "com.alibaba.nacos:nacos-client:2.2.1"

dependency 'org.apache.zookeeper:zookeeper:3.7.1'
dependency('org.apache.zookeeper:zookeeper:3.7.1') {
exclude group: 'ch.qos.logback', name: 'logback-core'
exclude group: 'ch.qos.logback', name: 'logback-classic'
}
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'
Expand Down
9 changes: 2 additions & 7 deletions eventmesh-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ dependencies {
api "io.cloudevents:cloudevents-core"
api "io.cloudevents:cloudevents-json-jackson"

implementation "org.apache.logging.log4j:log4j-api"
implementation "org.apache.logging.log4j:log4j-core"
implementation "org.apache.logging.log4j:log4j-slf4j2-impl"

implementation 'com.github.seancfoley:ipaddress'

implementation "com.lmax:disruptor"
Expand Down Expand Up @@ -65,9 +61,8 @@ dependencies {
testImplementation "com.google.guava:guava"

testImplementation "org.slf4j:slf4j-api"
testImplementation "org.apache.logging.log4j:log4j-api"
testImplementation "org.apache.logging.log4j:log4j-core"
testImplementation "org.apache.logging.log4j:log4j-slf4j2-impl"
testRuntimeOnly "org.apache.logging.log4j:log4j-core"
testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j2-impl"
ppkarwasz marked this conversation as resolved.
Show resolved Hide resolved

testImplementation "com.lmax:disruptor"

Expand Down
5 changes: 0 additions & 5 deletions eventmesh-connectors/eventmesh-connector-pravega/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
* limitations under the License.
*/

configurations {
implementation.exclude group: 'ch.qos.logback', module: 'logback-classic'
implementation.exclude group: 'log4j', module: 'log4j'
}

dependencies {
api project(":eventmesh-openconnect:eventmesh-openconnect-java")
implementation project(":eventmesh-common")
Expand Down
11 changes: 6 additions & 5 deletions eventmesh-connectors/eventmesh-connector-pulsar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
* limitations under the License.
*/

List pulsar = [
"org.apache.pulsar:pulsar-client:$pulsar_version"
]
dependencies {
implementation project(":eventmesh-openconnect:eventmesh-openconnect-java")
implementation pulsar
implementation("org.apache.pulsar:pulsar-client:$pulsar_version") {
exclude group: 'org.apache.logging.log4j', module: 'log4j-core'
exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl'
}

compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
}
}
Loading
Loading