74 lines
2.1 KiB
Groovy
74 lines
2.1 KiB
Groovy
/*
|
|
* Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
|
|
*/
|
|
|
|
// Configures publishing of Maven artifacts to Bintray
|
|
|
|
apply plugin: 'maven'
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'signing'
|
|
|
|
// todo: figure out how we can check it in a generic way
|
|
def isMultiplatform = project.name == 'atomicfu'
|
|
|
|
if (!isMultiplatform) {
|
|
// Regular java modules need 'java-library' plugin for proper publication
|
|
apply plugin: 'java-library'
|
|
|
|
// MPP projects pack their sources automtically, java libraries need to explicitly pack them
|
|
task sourcesJar(type: Jar) {
|
|
archiveClassifier = 'sources'
|
|
from "src/main/kotlin"
|
|
}
|
|
}
|
|
|
|
// empty xxx-javadoc.jar
|
|
task javadocJar(type: Jar) {
|
|
archiveClassifier = 'javadoc'
|
|
}
|
|
|
|
def bintrayUpload = System.getenv("libs.bintray.upload") != null
|
|
|
|
publishing {
|
|
repositories { // this: closure
|
|
if (bintrayUpload) {
|
|
PublishingKt.configureBintrayPublication(delegate, project)
|
|
} else {
|
|
PublishingKt.configureMavenPublication(delegate, project)
|
|
}
|
|
}
|
|
|
|
if (!isMultiplatform) {
|
|
// Configure java publications for non-MPP projects
|
|
publications {
|
|
// plugin configures its own publication pluginMaven
|
|
if (project.name == 'atomicfu-gradle-plugin') {
|
|
pluginMaven(MavenPublication) {
|
|
artifact sourcesJar
|
|
}
|
|
} else {
|
|
maven(MavenPublication) {
|
|
from components.java
|
|
artifact sourcesJar
|
|
|
|
if (project.name.endsWith("-maven-plugin")) {
|
|
pom.packaging = 'maven-plugin'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
publications.all {
|
|
PublishingKt.configureMavenCentralMetadata(pom, project)
|
|
if (!bintrayUpload) {
|
|
PublishingKt.signPublicationIfKeyPresent(project, it)
|
|
}
|
|
|
|
// add empty javadocs
|
|
if (it.name != "kotlinMultiplatform") { // The root module gets the JVM's javadoc JAR
|
|
it.artifact(javadocJar)
|
|
}
|
|
}
|
|
}
|