-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathbuild.gradle
45 lines (42 loc) · 1.64 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
plugins {
id 'java-platform'
}
def name = project.name
dependencies {
constraints {
rootProject.subprojects.each {
if (rootProject.ext.unpublished.contains(it.name)) return
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(group: it.groupId, name: it.artifactId, version: it.version)
}
}
}
}
publishing {
publications {
mavenBom(MavenPublication) {
from components.javaPlatform
}
// Disable metadata publication
it.each { pub ->
pub.moduleDescriptorGenerator = null
tasks.matching { it.name == "generateMetadataFileFor${pub.name.capitalize()}Publication" }.all {
onlyIf { false }
}
}
}
}