mirror of
https://github.com/jellyfin/jellyfin-sdk-kotlin.git
synced 2024-11-26 23:50:32 +00:00
Require explicit enabling of publishing (#331)
Prevents testutils (and potential future projects) from being published, also moves publishing config to AFTER the kotlin block to fix jellyfin-core-android POM and jellyfin-core Dokka
This commit is contained in:
parent
a5780c4e8d
commit
5a6b9496a9
@ -39,31 +39,9 @@ apiValidation {
|
||||
|
||||
subprojects {
|
||||
// Enable required plugins
|
||||
apply<SigningPlugin>()
|
||||
apply<MavenPublishPlugin>()
|
||||
apply<io.gitlab.arturbosch.detekt.DetektPlugin>()
|
||||
apply<org.jetbrains.dokka.gradle.DokkaPlugin>()
|
||||
|
||||
// Run block after creating project specific configuration
|
||||
afterEvaluate {
|
||||
// Add signing config
|
||||
configure<SigningExtension> {
|
||||
val signingKey = getProperty("signing.key")
|
||||
val signingPassword = getProperty("signing.password") ?: ""
|
||||
|
||||
if (signingKey != null) {
|
||||
useInMemoryPgpKeys(signingKey, signingPassword)
|
||||
val publishing: PublishingExtension by project
|
||||
sign(publishing.publications)
|
||||
}
|
||||
}
|
||||
|
||||
// Add POM to projects that use publishing
|
||||
configure<PublishingExtension> {
|
||||
publications.withType<MavenPublication>().forEach(MavenPublication::defaultPom)
|
||||
}
|
||||
}
|
||||
|
||||
// Detekt linting
|
||||
detekt {
|
||||
buildUponDefaultConfig = true
|
||||
|
34
buildSrc/src/main/kotlin/Publishing.kt
Normal file
34
buildSrc/src/main/kotlin/Publishing.kt
Normal file
@ -0,0 +1,34 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.publish.PublishingExtension
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.plugins.signing.SigningExtension
|
||||
import org.gradle.plugins.signing.SigningPlugin
|
||||
|
||||
fun Project.enablePublishing(init: PublishingExtension.() -> Unit = {}) {
|
||||
apply<SigningPlugin>()
|
||||
apply<MavenPublishPlugin>()
|
||||
|
||||
extensions.getByType<PublishingExtension>().init()
|
||||
|
||||
// Run block after creating project specific configuration
|
||||
afterEvaluate {
|
||||
// Add signing config
|
||||
configure<SigningExtension> {
|
||||
val signingKey = getProperty("signing.key")
|
||||
val signingPassword = getProperty("signing.password") ?: ""
|
||||
|
||||
if (signingKey != null) {
|
||||
useInMemoryPgpKeys(signingKey, signingPassword)
|
||||
val publishing: PublishingExtension by project
|
||||
sign(publishing.publications)
|
||||
}
|
||||
}
|
||||
|
||||
// Add POM to projects that use publishing
|
||||
configure<PublishingExtension> {
|
||||
publications.withType<MavenPublication>().forEach(MavenPublication::defaultPom)
|
||||
}
|
||||
}
|
||||
}
|
@ -42,12 +42,14 @@ kotlin {
|
||||
}
|
||||
}
|
||||
|
||||
val javadocJar by tasks.creating(Jar::class) {
|
||||
dependsOn(tasks.getByName("dokkaHtml"))
|
||||
archiveClassifier.set("javadoc")
|
||||
from("$buildDir/dokka/html")
|
||||
}
|
||||
enablePublishing {
|
||||
val javadocJar by tasks.creating(Jar::class) {
|
||||
dependsOn(tasks.getByName("dokkaHtml"))
|
||||
archiveClassifier.set("javadoc")
|
||||
from("$buildDir/dokka/html")
|
||||
}
|
||||
|
||||
publishing.publications.withType<MavenPublication> {
|
||||
artifact(javadocJar)
|
||||
publications.withType<MavenPublication> {
|
||||
artifact(javadocJar)
|
||||
}
|
||||
}
|
||||
|
@ -88,13 +88,14 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
val javadocJar by tasks.creating(Jar::class) {
|
||||
// FIXME: Dokka is failing for this module - temporarily disabled
|
||||
// dependsOn(tasks.getByName("dokkaHtml"))
|
||||
archiveClassifier.set("javadoc")
|
||||
// from("$buildDir/dokka/html")
|
||||
}
|
||||
enablePublishing {
|
||||
val javadocJar by tasks.creating(Jar::class) {
|
||||
dependsOn(tasks.getByName("dokkaHtml"))
|
||||
archiveClassifier.set("javadoc")
|
||||
from("$buildDir/dokka/html")
|
||||
}
|
||||
|
||||
publishing.publications.withType<MavenPublication> {
|
||||
artifact(javadocJar)
|
||||
publications.withType<MavenPublication> {
|
||||
artifact(javadocJar)
|
||||
}
|
||||
}
|
||||
|
@ -32,12 +32,14 @@ kotlin {
|
||||
}
|
||||
}
|
||||
|
||||
val javadocJar by tasks.creating(Jar::class) {
|
||||
dependsOn(tasks.getByName("dokkaHtml"))
|
||||
archiveClassifier.set("javadoc")
|
||||
from("$buildDir/dokka/html")
|
||||
}
|
||||
enablePublishing {
|
||||
val javadocJar by tasks.creating(Jar::class) {
|
||||
dependsOn(tasks.getByName("dokkaHtml"))
|
||||
archiveClassifier.set("javadoc")
|
||||
from("$buildDir/dokka/html")
|
||||
}
|
||||
|
||||
publishing.publications.withType<MavenPublication> {
|
||||
artifact(javadocJar)
|
||||
publications.withType<MavenPublication> {
|
||||
artifact(javadocJar)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user