Don't publish snapshots for experimental versions

This commit is contained in:
modmuss50
2024-05-17 17:23:33 +01:00
parent 6c7ef44489
commit e621e340f8

View File

@@ -308,34 +308,36 @@ import org.w3c.dom.Node
publishing { publishing {
publications { publications {
// Also publish a snapshot so people can use the latest version if they wish if (!ENV.EXPERIMENTAL) {
snapshot(MavenPublication) { publication -> // Also publish a snapshot so people can use the latest version if they wish
groupId project.group snapshot(MavenPublication) { publication ->
artifactId project.base.archivesName.get() groupId project.group
version baseVersion + '-SNAPSHOT' artifactId project.base.archivesName.get()
version baseVersion + '-SNAPSHOT'
from components.java from components.java
} }
// Manually crate the plugin marker for snapshot versions // Manually crate the plugin marker for snapshot versions
snapshotPlugin(MavenPublication) { publication -> snapshotPlugin(MavenPublication) { publication ->
groupId 'fabric-loom' groupId 'fabric-loom'
artifactId 'fabric-loom.gradle.plugin' artifactId 'fabric-loom.gradle.plugin'
version baseVersion + '-SNAPSHOT' version baseVersion + '-SNAPSHOT'
pom.withXml({ pom.withXml({
// Based off org.gradle.plugin.devel.plugins.MavenPluginPublishPlugin // Based off org.gradle.plugin.devel.plugins.MavenPluginPublishPlugin
Element root = asElement() Element root = asElement()
Document document = root.getOwnerDocument() Document document = root.getOwnerDocument()
Node dependencies = root.appendChild(document.createElement('dependencies')) Node dependencies = root.appendChild(document.createElement('dependencies'))
Node dependency = dependencies.appendChild(document.createElement('dependency')) Node dependency = dependencies.appendChild(document.createElement('dependency'))
Node groupId = dependency.appendChild(document.createElement('groupId')) Node groupId = dependency.appendChild(document.createElement('groupId'))
groupId.setTextContent('net.fabricmc') groupId.setTextContent('net.fabricmc')
Node artifactId = dependency.appendChild(document.createElement('artifactId')) Node artifactId = dependency.appendChild(document.createElement('artifactId'))
artifactId.setTextContent('fabric-loom') artifactId.setTextContent('fabric-loom')
Node version = dependency.appendChild(document.createElement('version')) Node version = dependency.appendChild(document.createElement('version'))
version.setTextContent(baseVersion + '-SNAPSHOT') version.setTextContent(baseVersion + '-SNAPSHOT')
}) })
}
} }
} }
repositories { repositories {