fabric/fabric-api-catalog/build.gradle
Jason Penilla 22fe817d10 add fabric-api-bom and fabric-api-catalog (#3487)
* feat: add fabric-api-bom and fabric-api-catalog

* spotlessApply

* Apply suggestions from code review

Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>

---------

Co-authored-by: modmuss <modmuss50@gmail.com>
Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
(cherry picked from commit 679aae3c9a)
2024-01-11 15:50:48 +00:00

57 lines
1.3 KiB
Groovy

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}")
}
}
}
}