From fc2c486fe6d7010eb832a3fe6935d1e97f1a2bde Mon Sep 17 00:00:00 2001 From: minux Date: Fri, 1 Nov 2024 14:27:17 +0900 Subject: [PATCH] Fix `:dist:copyLib` Task not to copy duplicate libraries (#1047) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Motivation: The `:dist:copyLib` task currently copies dependencies into the lib directory from multiple modules. Since each module resolves dependencies independently, it can result in duplicate libraries with differing versions. Modifications: - Updated the task to use the dependencies section for centralized dependency resolution. - @ikhoon suggested this. 😉 Result: - The libraries in the lib directory are now deduplicated. --- dist/build.gradle | 34 +++++++--------------------------- server-auth/saml/build.gradle | 2 ++ server-auth/shiro/build.gradle | 3 +++ server-mirror-git/build.gradle | 2 ++ xds/build.gradle | 2 ++ 5 files changed, 16 insertions(+), 27 deletions(-) diff --git a/dist/build.gradle b/dist/build.gradle index d74736d8e8..800b2450b3 100644 --- a/dist/build.gradle +++ b/dist/build.gradle @@ -23,20 +23,19 @@ apply plugin: 'com.bmuschko.docker-remote-api' import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage import com.google.common.base.CaseFormat -evaluationDependsOn(':server') -evaluationDependsOn(':server-auth:saml') -evaluationDependsOn(':server-auth:shiro') -evaluationDependsOn(':server-mirror-git') -evaluationDependsOn(':xds') - ext { distDir = "${project.buildDir}/dist" relativeDistDir = distDir.substring("${rootProject.projectDir}/".length()) cliDownloadDir = "${gradle.gradleUserHomeDir}/caches/centraldogma-go/cli" } - dependencies { + implementation project(':server') + implementation project(':server-auth:saml') + implementation project(':server-auth:shiro') + implementation project(':server-mirror-git') + implementation project(':xds') + // Logging runtimeOnly libs.logback12 runtimeOnly libs.slf4j1.jcl.over.slf4j @@ -64,26 +63,7 @@ task copyLib(group: 'Build', dependsOn: project(':server').tasks.jar, type: Copy) { - from project(':server').configurations.runtimeClasspath { - exclude group: 'org.eclipse.jgit' - } - from project(':server').tasks.jar - from project.configurations.runtimeClasspath - from project(':server-auth:saml').configurations.runtimeClasspath { - exclude group: 'org.eclipse.jgit' - } - from project(':server-auth:saml').tasks.jar - from project(':server-auth:shiro').configurations.runtimeClasspath { - exclude group: 'org.eclipse.jgit' - } - from project(':server-auth:shiro').tasks.jar - from project(':server-mirror-git').configurations.runtimeClasspath - from project(':server-mirror-git').tasks.jar - from project(':xds').configurations.runtimeClasspath { - exclude group: 'org.eclipse.jgit' - } - from project(':xds').tasks.jar - + from configurations.runtimeClasspath File libDir = new File("${project.ext.distDir}/lib") into libDir diff --git a/server-auth/saml/build.gradle b/server-auth/saml/build.gradle index 909f49f501..2bf982a681 100644 --- a/server-auth/saml/build.gradle +++ b/server-auth/saml/build.gradle @@ -5,4 +5,6 @@ dependencies { } implementation libs.bouncycastle.bcprov + // Declare explicitly to resolve the version conflict. + implementation libs.logback12 } diff --git a/server-auth/shiro/build.gradle b/server-auth/shiro/build.gradle index ba09bd2329..d701044bf9 100644 --- a/server-auth/shiro/build.gradle +++ b/server-auth/shiro/build.gradle @@ -4,6 +4,9 @@ dependencies { // Caffeine implementation libs.caffeine + // Declare explicitly to resolve the version conflict. + implementation libs.logback12 + // Shiro implementation libs.shiro.core } diff --git a/server-mirror-git/build.gradle b/server-mirror-git/build.gradle index ec30fd5132..f01b91af38 100644 --- a/server-mirror-git/build.gradle +++ b/server-mirror-git/build.gradle @@ -6,6 +6,8 @@ dependencies { implementation libs.bouncycastle.bcprov implementation libs.eddsa implementation libs.jgit6 + // Declare explicitly to resolve the version conflict. + implementation libs.logback12 implementation libs.mina.sshd.core implementation libs.mina.sshd.git diff --git a/xds/build.gradle b/xds/build.gradle index 93e55b558a..ed332fbb80 100644 --- a/xds/build.gradle +++ b/xds/build.gradle @@ -8,6 +8,8 @@ dependencies { implementation libs.controlplane.api implementation libs.controlplane.cache implementation libs.controlplane.server + // Declare explicitly to resolve the version conflict. + implementation libs.logback12 implementation libs.reflections testImplementation libs.armeria.junit5