blob: 12e2f6b7e6363b931ee498b29348e5955468f890 [file] [log] [blame]
plugins {
id 'java-platform'
}
def name = project.name
dependencies {
constraints {
rootProject.subprojects.each {
if (it.name == name) return
if (!it.plugins.hasPlugin('maven-publish')) return
evaluationDependsOn(it.path)
it.publishing.publications.all {
if (it.artifactId.endsWith("-kotlinMultiplatform")) return
if (it.artifactId.endsWith("-metadata")) return
// Skip platform artifacts (like *-linuxx64, *-macosx64)
// It leads to inconsistent bom when publishing from different platforms
// (e.g. on linux it will include only linuxx64 artifacts and no macosx64)
// It shouldn't be a problem as usually consumers need to use generic *-native artifact
// Gradle will choose correct variant by using metadata attributes
if (it.artifacts.any { it.extension == 'klib' }) return
api("${it.groupId}:${it.artifactId}:${it.version}")
}
}
}
}
publishing {
publications {
mavenBom(MavenPublication) {
from components.javaPlatform
}
// Disable metadata publication, no need to
it.each { pub ->
pub.moduleDescriptorGenerator = null
tasks.matching { it.name == "generateMetadataFileFor${pub.name.capitalize()}Publication" }.all {
onlyIf { false }
}
}
}
}