From 127571767e32c812c1b52ce96882947fd6b95901 Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Fri, 18 Aug 2023 16:50:43 -0700 Subject: [PATCH 1/5] Add dependency rule to identify renamed dependencies --- settings.gradle | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/settings.gradle b/settings.gradle index ddae69d490..a89bc5e701 100644 --- a/settings.gradle +++ b/settings.gradle @@ -88,6 +88,7 @@ rootProject.name="labkey-server" apply from: 'gradle/settings/parameters.gradle' +import groovy.transform.CompileStatic import org.labkey.gradle.util.BuildUtils /* This file is used to determine which projects will be configured during the Gradle build of LabKey Server. @@ -195,3 +196,66 @@ if (hasProperty('inheritedDistPath')) { include "${inheritedDistPath}" } + +// Define known renamed packages. We can't define a resolution strategy here but this will trigger a build failure if +// a conflicting dependency is introduced. Note: This information isn't recognized by ':showDiscrepancies' +// https://docs.gradle.org/current/userguide/dependency_capability_conflict.html +dependencyResolutionManagement { + components { + all(RenamedDependencyRule) + } +} + +@CompileStatic +class RenamedDependencyRule implements ComponentMetadataRule { + void execute(ComponentMetadataContext context) { + context.details.with { + // 'net.hydromatic' is the new group coordinate for 'eigenbase' packages + if (id.group == 'eigenbase') { + allVariants { + it.withCapabilities { + // Declare that eigenbase:eigenbase-* packages provide net.hydromatic:eigenbase-* capability, but with an older version + // Affects 'eigenbase-properties', 'eigenbase-resgen', and 'eigenbase-xom' + it.addCapability('net.hydromatic', id.name, id.version) + } + } + } + // 'org.codehaus.woodstox:woodstox-core-asl' moved to 'com.fasterxml.woodstox:woodstox-core' at version 5.0 + else if (id.group == 'org.codehaus.woodstox' && id.name == 'woodstox-core-asl') { + allVariants { + it.withCapabilities { + it.addCapability('com.fasterxml.woodstox', 'woodstox-core', id.version) + } + } + } + // Normalize bouncycastle dependencies to detect conflict across jdk variants + else if (id.group == 'bouncycastle' || id.group == 'org.bouncycastle') { + var fixedName = id.name + + // Strip '-jdkXX' suffix + var splitAt = fixedName.indexOf("-jdk") + if (splitAt >= 0) { + fixedName = fixedName.substring(0, splitAt) + } + + // bcmail renamed to bcpkix at version 1.47 + if (fixedName == 'bcmail') { + fixedName = 'bcpkix' + } + + // Insert '.' into old version numbers (e.g. '140' -> '1.40') + var fixedVersion = id.version + if (!fixedVersion.contains('.')) { + fixedVersion = "1." + fixedVersion.substring(1) + } + + allVariants { + it.withCapabilities { + // Add normalized capability to catch conflicts + it.addCapability('org.bouncycastle', fixedName, fixedVersion) + } + } + } + } + } +} From e184473350d6b4b001952e8043b9dc73660e21fc Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Tue, 2 Jan 2024 14:36:51 -0800 Subject: [PATCH 2/5] Module collision --- settings.gradle | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/settings.gradle b/settings.gradle index 687439ed8c..f7314b62d6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -215,6 +215,15 @@ dependencyResolutionManagement { class RenamedDependencyRule implements ComponentMetadataRule { void execute(ComponentMetadataContext context) { context.details.with { + // Make local and remote modules collide + if (id.group == 'org.labkey.module') { + allVariants { + it.withCapabilities { + it.addCapability('org.labkey', id.name, id.version) + } + } + } + // 'net.hydromatic' is the new group coordinate for 'eigenbase' packages if (id.group == 'eigenbase') { allVariants { From 2b312d462c8cd67d08086949dcfc528d7f7c2556 Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Thu, 28 Mar 2024 16:15:05 -0700 Subject: [PATCH 3/5] Define graaljs rename --- settings.gradle | 154 ++++++++++++++++++++++++++---------------------- 1 file changed, 82 insertions(+), 72 deletions(-) diff --git a/settings.gradle b/settings.gradle index 3fb54174b8..7018e4ab5e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -90,6 +90,88 @@ apply from: 'gradle/settings/parameters.gradle' import groovy.transform.CompileStatic import org.labkey.gradle.util.BuildUtils + + +// Define known renamed packages. We can't define a resolution strategy here but this will trigger a build failure if +// a conflicting dependency is introduced. Note: This information isn't recognized by ':showDiscrepancies' +// https://docs.gradle.org/current/userguide/dependency_capability_conflict.html +dependencyResolutionManagement { + components { + all(RenamedDependencyRule) + } +} + +@CompileStatic +class RenamedDependencyRule implements ComponentMetadataRule { + void execute(ComponentMetadataContext context) { + context.details.with { + // Make local and remote modules collide + if (id.group == 'org.labkey.module') { + allVariants { + it.withCapabilities { + it.addCapability('org.labkey', id.name, id.version) + } + } + } + + // 'net.hydromatic' is the new group coordinate for 'eigenbase' packages + if (id.group == 'eigenbase') { + allVariants { + it.withCapabilities { + // Declare that eigenbase:eigenbase-* packages provide net.hydromatic:eigenbase-* capability, but with an older version + // Affects 'eigenbase-properties', 'eigenbase-resgen', and 'eigenbase-xom' + it.addCapability('net.hydromatic', id.name, id.version) + } + } + } + // 'org.codehaus.woodstox:woodstox-core-asl' moved to 'com.fasterxml.woodstox:woodstox-core' at version 5.0 + else if (id.group == 'org.codehaus.woodstox' && id.name == 'woodstox-core-asl') { + allVariants { + it.withCapabilities { + it.addCapability('com.fasterxml.woodstox', 'woodstox-core', id.version) + } + } + } + // Normalize bouncycastle dependencies to detect conflict across jdk variants + else if (id.group == 'bouncycastle' || id.group == 'org.bouncycastle') { + var fixedName = id.name + + // Strip '-jdkXX' suffix + var splitAt = fixedName.indexOf("-jdk") + if (splitAt >= 0) { + fixedName = fixedName.substring(0, splitAt) + } + + // bcmail renamed to bcpkix at version 1.47 + if (fixedName == 'bcmail') { + fixedName = 'bcpkix' + } + + // Insert '.' into old version numbers (e.g. '140' -> '1.40') + var fixedVersion = id.version + if (!fixedVersion.contains('.')) { + fixedVersion = "1." + fixedVersion.substring(1) + } + + allVariants { + it.withCapabilities { + // Add normalized capability to catch conflicts + it.addCapability('org.bouncycastle', fixedName, fixedVersion) + } + } + } + // 'org.graalvm.js:js' moved to 'org.graalvm.polyglot:js-community' at version 23.1.0 + else if (id.group == 'org.graalvm.js' && id.name == 'js') { + allVariants { + it.withCapabilities { + it.addCapability('org.graalvm.polyglot', 'js-community', id.version) + } + } + } + } + } +} + /* This file is used to determine which projects will be configured during the Gradle build of LabKey Server. @@ -201,75 +283,3 @@ if (hasProperty('inheritedDistPath')) { include "${inheritedDistPath}" } - -// Define known renamed packages. We can't define a resolution strategy here but this will trigger a build failure if -// a conflicting dependency is introduced. Note: This information isn't recognized by ':showDiscrepancies' -// https://docs.gradle.org/current/userguide/dependency_capability_conflict.html -dependencyResolutionManagement { - components { - all(RenamedDependencyRule) - } -} - -@CompileStatic -class RenamedDependencyRule implements ComponentMetadataRule { - void execute(ComponentMetadataContext context) { - context.details.with { - // Make local and remote modules collide - if (id.group == 'org.labkey.module') { - allVariants { - it.withCapabilities { - it.addCapability('org.labkey', id.name, id.version) - } - } - } - - // 'net.hydromatic' is the new group coordinate for 'eigenbase' packages - if (id.group == 'eigenbase') { - allVariants { - it.withCapabilities { - // Declare that eigenbase:eigenbase-* packages provide net.hydromatic:eigenbase-* capability, but with an older version - // Affects 'eigenbase-properties', 'eigenbase-resgen', and 'eigenbase-xom' - it.addCapability('net.hydromatic', id.name, id.version) - } - } - } - // 'org.codehaus.woodstox:woodstox-core-asl' moved to 'com.fasterxml.woodstox:woodstox-core' at version 5.0 - else if (id.group == 'org.codehaus.woodstox' && id.name == 'woodstox-core-asl') { - allVariants { - it.withCapabilities { - it.addCapability('com.fasterxml.woodstox', 'woodstox-core', id.version) - } - } - } - // Normalize bouncycastle dependencies to detect conflict across jdk variants - else if (id.group == 'bouncycastle' || id.group == 'org.bouncycastle') { - var fixedName = id.name - - // Strip '-jdkXX' suffix - var splitAt = fixedName.indexOf("-jdk") - if (splitAt >= 0) { - fixedName = fixedName.substring(0, splitAt) - } - - // bcmail renamed to bcpkix at version 1.47 - if (fixedName == 'bcmail') { - fixedName = 'bcpkix' - } - - // Insert '.' into old version numbers (e.g. '140' -> '1.40') - var fixedVersion = id.version - if (!fixedVersion.contains('.')) { - fixedVersion = "1." + fixedVersion.substring(1) - } - - allVariants { - it.withCapabilities { - // Add normalized capability to catch conflicts - it.addCapability('org.bouncycastle', fixedName, fixedVersion) - } - } - } - } - } -} From aef91ab0cb8ac6764b582b48b2c8de81bbc0c94a Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Thu, 30 May 2024 11:25:21 -0700 Subject: [PATCH 4/5] Spacing --- settings.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/settings.gradle b/settings.gradle index 655f9d390f..5dae6c2238 100644 --- a/settings.gradle +++ b/settings.gradle @@ -124,6 +124,7 @@ class RenamedDependencyRule implements ComponentMetadataRule { } } } + // 'org.codehaus.woodstox:woodstox-core-asl' moved to 'com.fasterxml.woodstox:woodstox-core' at version 5.0 else if (id.group == 'org.codehaus.woodstox' && id.name == 'woodstox-core-asl') { allVariants { @@ -132,6 +133,7 @@ class RenamedDependencyRule implements ComponentMetadataRule { } } } + // Normalize bouncycastle dependencies to detect conflict across jdk variants else if (id.group == 'bouncycastle' || id.group == 'org.bouncycastle') { var fixedName = id.name @@ -160,6 +162,7 @@ class RenamedDependencyRule implements ComponentMetadataRule { } } } + // 'org.graalvm.js:js' moved to 'org.graalvm.polyglot:js-community' at version 23.1.0 else if (id.group == 'org.graalvm.js' && id.name == 'js') { allVariants { From f7375f598540f15057b36ef8e8ad93bec84d71c2 Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Tue, 26 Nov 2024 16:25:16 -0800 Subject: [PATCH 5/5] Make embedded and regular tomcats conflict --- settings.gradle | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/settings.gradle b/settings.gradle index 5dae6c2238..65d47ea148 100644 --- a/settings.gradle +++ b/settings.gradle @@ -114,6 +114,36 @@ class RenamedDependencyRule implements ComponentMetadataRule { } } +// // Make embedded and standard tomcats collide +// if (id.group == 'org.apache.tomcat.embed') { +// if (id.name == 'tomcat-embed-core') { +// allVariants { +// it.withCapabilities { +// it.addCapability('org.apache.tomcat', 'tomcat-catalina', id.version) +// it.addCapability('org.apache.tomcat', 'tomcat-coyote', id.version) +// it.addCapability('org.apache.tomcat', 'tomcat-juli', id.version) +// it.addCapability('org.apache.tomcat', 'tomcat-api', id.version) +// it.addCapability('org.apache.tomcat', 'tomcat-util', id.version) +// it.addCapability('org.apache.tomcat', 'tomcat-util-scan', id.version) +// } +// } +// } +// if (id.name == 'tomcat-embed-el') { +// allVariants { +// it.withCapabilities { +// it.addCapability('org.apache.tomcat', 'tomcat-el-api', id.version) +// } +// } +// } +// if (id.name == 'tomcat-embed-websocket') { +// allVariants { +// it.withCapabilities { +// it.addCapability('org.apache.tomcat', 'tomcat-websocket', id.version) +// } +// } +// } +// } + // 'net.hydromatic' is the new group coordinate for 'eigenbase' packages if (id.group == 'eigenbase') { allVariants {