Patch all eclipse deps to use a strict version

This commit is contained in:
modmuss50 2021-06-16 23:16:44 +01:00
parent b4cd38a287
commit 147af48879

View file

@ -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