Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 45 additions & 54 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
kotlin("multiplatform") version "2.1.0"
id("org.jetbrains.dokka") version "2.0.0"
id("org.jetbrains.kotlinx.kover") version "0.9.0"
`maven-publish`
signing
id("com.vanniktech.maven.publish") version "0.30.0"
}

group = "com.jsoizo"
version = "1.10.0"
val projectName = "kotlin-csv"

buildscript {
repositories {
Expand All @@ -21,22 +24,11 @@ repositories {
mavenCentral()
}

val dokkaJar by tasks.registering(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "A Javadoc JAR containing Dokka HTML"
from(tasks.dokkaHtml.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}

kotlin {
jvm {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
//https://docs.gradle.org/current/userguide/publishing_maven.html
mavenPublication {
artifact(dokkaJar)
}
}
js {
browser {
Expand Down Expand Up @@ -81,52 +73,51 @@ tasks.withType<Test>() {
useJUnitPlatform()
}

mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)

publishing {
publications.all {
(this as MavenPublication).pom {
name.set("kotlin-csv")
description.set("Kotlin CSV Reader/Writer")
url.set("https://github.com/jsoizo/kotlin-csv")
if (project.hasProperty("signing.keyId")) {
signAllPublications()
}

organization {
name.set("com.jsoizo")
url.set("https://github.com/jsoizo")
}
licenses {
license {
name.set("Apache License 2.0")
url.set("https://github.com/jsoizo/kotlin-csv/blob/master/LICENSE")
}
}
scm {
url.set("https://github.com/jsoizo/kotlin-csv")
connection.set("scm:git:git://github.com/jsoizo/kotlin-csv.git")
developerConnection.set("https://github.com/jsoizo/kotlin-csv")
}
developers {
developer {
name.set("jsoizo")
}
coordinates(group.toString(), projectName, version.toString())

configure(
KotlinMultiplatform(
javadocJar = JavadocJar.Dokka("dokkaHtml"),
sourcesJar = true,
androidVariantsToPublish = listOf("debug", "release"),
)
)

val repo = "github.com/jsoizo/${projectName}"
val repoHttpUrl = "https://${repo}"
val repoGitUrl = "git://${repo}.git"

pom {
name = projectName
description = "Pure Kotlin CSV reader and writer"
inceptionYear = "2019"
url = repoHttpUrl
organization {
name.set("com.jsoizo")
url.set("https://github.com/jsoizo")
}
licenses {
license {
name.set("Apache License 2.0")
url.set("${repoHttpUrl}/blob/master/LICENSE")
}
}
}
repositories {
maven {
credentials {
val nexusUsername: String? by project
val nexusPassword: String? by project
username = nexusUsername
password = nexusPassword
scm {
url.set(repoHttpUrl)
connection.set("scm:git:${repoGitUrl}")
developerConnection.set(repoHttpUrl)
}
developers {
developer {
name.set("jsoizo")
}

val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
}
}
}

signing {
sign(publishing.publications)
}