From 147af48879c725f422b99ea15a9e6f3ce1a496f3 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Wed, 16 Jun 2021 23:16:44 +0100 Subject: [PATCH] Patch all eclipse deps to use a strict version --- build.gradle | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/build.gradle b/build.gradle index f64dbc3..a7e766f 100644 --- a/build.gradle +++ b/build.gradle @@ -97,6 +97,7 @@ dependencies { // Mercury pulls all of these deps in, however eclipse does not specify the exact version to use so they can get updated without us knowing. // Depend specifically on these versions to prevent them from being updated under our feet. + // The POM is also patched later on to as this strict versioning does not make it through. implementation ('org.eclipse.jdt:org.eclipse.jdt.core:[3.21.0]') implementation ('org.eclipse.platform:org.eclipse.compare.core:[3.6.1000]') implementation ('org.eclipse.platform:org.eclipse.core.commands:[3.9.800]') @@ -196,6 +197,18 @@ import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.Node +def patchPom(groovy.util.Node node) { + node.dependencies.first().each { + def groupId = it.get("groupId").first().value().first() + + // Patch all eclipse deps to use a strict version + if (groupId.startsWith("org.eclipse.")) { + def version = it.get("version").first().value().first() + it.get("version").first().value = new groovy.util.NodeList(["[$version]"]) + } + } +} + publishing { publications { plugin(MavenPublication) { publication -> @@ -207,6 +220,10 @@ publishing { artifact sourcesJar artifact javadocJar + + pom.withXml { + patchPom(asNode()) + } } // Also publish a snapshot so people can use the latest version if they wish @@ -219,6 +236,10 @@ publishing { artifact sourcesJar artifact javadocJar + + pom.withXml { + patchPom(asNode()) + } } // Manually crate the plugin marker for snapshot versions