Support classpath groups when using configure on demand. (#1392)

* Support classpath groups when using configure on demand.

* Cleanup

* Work around Gradle 8.14 issue

* Another fix

* Rename plugin

* Fix plugin versioning

* Add some docs

* More fixes

* Ensure backwards compatible.
This commit is contained in:
modmuss
2025-10-20 22:46:36 +01:00
committed by GitHub
parent b2c933d2c0
commit 09a4831f25
19 changed files with 611 additions and 77 deletions

View File

@@ -237,6 +237,10 @@ gradlePlugin {
id = 'fabric-loom'
implementationClass = 'net.fabricmc.loom.LoomGradlePlugin'
}
fabricLoomCompanion {
id = 'net.fabricmc.fabric-loom-companion'
implementationClass = 'net.fabricmc.loom.LoomCompanionGradlePlugin'
}
}
}
@@ -292,25 +296,27 @@ publishing {
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'
gradlePlugin.plugins.forEach { plugin ->
// Manually crate the plugin marker for snapshot versions
it.create(plugin.id + "SnapshotMarker", MavenPublication) { publication ->
groupId = plugin.id
artifactId = plugin.id + '.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(project.version)
})
}
}
}
}