mirror of
https://github.com/FabricMC/fabric.git
synced 2024-12-17 19:42:40 -05:00
22fe817d10
* 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
)
57 lines
1.3 KiB
Groovy
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}")
|
|
}
|
|
}
|
|
}
|
|
}
|