Files

105 lines
3.0 KiB
Groovy
Raw Permalink Normal View History

2024-01-16 20:57:50 +01:00
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'org.jetbrains.dokka'
2024-01-16 20:57:50 +01:00
tasks.withType(Jar).configureEach {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
2024-01-06 14:28:55 +01:00
tasks.register('androidSourcesJar', Jar) {
2024-01-16 20:57:50 +01:00
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set('sources')
if (project.plugins.findPlugin("com.android.library")) {
// For Android libraries
from android.sourceSets.main.kotlin.srcDirs
2024-01-16 20:57:50 +01:00
from android.sourceSets.main.java.srcDirs
} else {
// For pure Kotlin libraries, in case you have them
from sourceSets.main.java.srcDirs
from sourceSets.main.kotlin.srcDirs
}
}
tasks.withType(dokkaHtmlPartial.getClass()).configureEach {
pluginsMapConfiguration.set(
["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""]
)
}
2024-01-06 14:28:55 +01:00
tasks.register('javadocJar', Jar) {
dependsOn dokkaJavadoc
archiveClassifier.set("javadoc")
from dokkaJavadoc.outputDirectory
}
2024-01-06 14:28:55 +01:00
tasks.register('htmldocJar', Jar) {
dependsOn dokkaHtml
archiveClassifier.set("htmldoc")
from dokkaHtml.outputDirectory
}
artifacts {
archives androidSourcesJar
archives javadocJar
archives htmldocJar
}
2024-01-16 20:57:50 +01:00
group = GROUP_ID
version = VERSION_NAME
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
2024-01-16 20:57:50 +01:00
tasks.named("generateMetadataFileForReleasePublication").configure {dependsOn(androidSourcesJar)}
groupId GROUP_ID
artifactId ARTIFACT_ID
version VERSION_NAME
// Two artifacts, the `aar` (or `jar`) and the sources
if (project.plugins.findPlugin("com.android.library")) {
from components.release
} else {
from components.java
}
artifact javadocJar
artifact htmldocJar
2024-01-16 20:57:50 +01:00
// artifact androidSourcesJar
// Mostly self-explanatory metadata
pom {
2024-01-16 20:57:50 +01:00
name = ARTIFACT_ID
description = POM_DESCRIPTION
url = POM_URL
licenses {
license {
2024-01-16 20:57:50 +01:00
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
}
developers {
developer {
2024-01-16 20:57:50 +01:00
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
}
}
// Version control info - if you're using GitHub, follow the
// format as seen here
scm {
2024-01-16 20:57:50 +01:00
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
url = POM_SCM_URL
}
}
}
}
}
}
signing {
sign publishing.publications
}