From e621e340f8751bc8fd7986b86b57d8d982d14eaa Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Fri, 17 May 2024 17:23:33 +0100 Subject: [PATCH] Don't publish snapshots for experimental versions --- build.gradle | 52 +++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index ce596d78..5e496254 100644 --- a/build.gradle +++ b/build.gradle @@ -308,34 +308,36 @@ import org.w3c.dom.Node publishing { publications { - // Also publish a snapshot so people can use the latest version if they wish - snapshot(MavenPublication) { publication -> - groupId project.group - artifactId project.base.archivesName.get() - version baseVersion + '-SNAPSHOT' + if (!ENV.EXPERIMENTAL) { + // Also publish a snapshot so people can use the latest version if they wish + snapshot(MavenPublication) { publication -> + groupId project.group + artifactId project.base.archivesName.get() + version baseVersion + '-SNAPSHOT' - from components.java - } + from components.java + } - // Manually crate the plugin marker for snapshot versions - snapshotPlugin(MavenPublication) { publication -> - groupId 'fabric-loom' - artifactId 'fabric-loom.gradle.plugin' - version baseVersion + '-SNAPSHOT' + // Manually crate the plugin marker for snapshot versions + snapshotPlugin(MavenPublication) { publication -> + groupId 'fabric-loom' + artifactId 'fabric-loom.gradle.plugin' + version baseVersion + '-SNAPSHOT' - pom.withXml({ - // Based off org.gradle.plugin.devel.plugins.MavenPluginPublishPlugin - Element root = asElement() - Document document = root.getOwnerDocument() - Node dependencies = root.appendChild(document.createElement('dependencies')) - Node dependency = dependencies.appendChild(document.createElement('dependency')) - Node groupId = dependency.appendChild(document.createElement('groupId')) - groupId.setTextContent('net.fabricmc') - Node artifactId = dependency.appendChild(document.createElement('artifactId')) - artifactId.setTextContent('fabric-loom') - Node version = dependency.appendChild(document.createElement('version')) - version.setTextContent(baseVersion + '-SNAPSHOT') - }) + pom.withXml({ + // Based off org.gradle.plugin.devel.plugins.MavenPluginPublishPlugin + Element root = asElement() + Document document = root.getOwnerDocument() + Node dependencies = root.appendChild(document.createElement('dependencies')) + Node dependency = dependencies.appendChild(document.createElement('dependency')) + Node groupId = dependency.appendChild(document.createElement('groupId')) + groupId.setTextContent('net.fabricmc') + Node artifactId = dependency.appendChild(document.createElement('artifactId')) + artifactId.setTextContent('fabric-loom') + Node version = dependency.appendChild(document.createElement('version')) + version.setTextContent(baseVersion + '-SNAPSHOT') + }) + } } } repositories {