plugins { id 'version-catalog' } version = rootProject.version publishing.publications { register('mavenJava', MavenPublication) { from components.versionCatalog } } tasks.withType(GenerateModuleMetadata) { // todo: RemoteSignJar fails when this is false (as set by parent build script) enabled = true } // Avoid configuration ordering issues by creating the catalog entries during task execution time tasks.register('configureCatalog') { doFirst { doConfigureCatalog() } } tasks.named('generateCatalogAsToml') { dependsOn('configureCatalog') } def doConfigureCatalog() { for (proj in rootProject.allprojects) { if (proj == project) { // the catalog itself continue } String catalogName = proj.name if (catalogName == 'fabric-api-base') { catalogName = 'base' } else if (catalogName == 'fabric-api-bom') { catalogName = 'bom' } else if (catalogName == 'deprecated') { catalogName = 'deprecated-fabric-api' } else if (catalogName == 'fabric-api') { catalogName = 'fabric-api' } else { catalogName = catalogName.substring('fabric-'.length()) } if (proj.parent != null && proj.parent.name == 'deprecated') { catalogName = 'deprecated-' + catalogName } catalog { versionCatalog { library(catalogName, "net.fabricmc.fabric-api:${proj.name}:${proj.version}") } } } }