Skip to content

Commit c70bb48

Browse files
committed
Update gradle script for publishing
1 parent 3d98089 commit c70bb48

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

build.gradle.kts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ plugins {
22
kotlin("multiplatform") version "1.5.10"
33
kotlin("plugin.serialization") version "1.5.0"
44
id("org.jlleitschuh.gradle.ktlint") version "9.4.1"
5+
id("org.jetbrains.dokka") version "1.4.32"
56
id("maven-publish")
7+
id("signing")
68
}
79

810
group = "com.sdercolin.harmoloid"
@@ -16,6 +18,14 @@ configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
1618
version.set("0.36.0")
1719
}
1820

21+
val dokkaHtml by tasks.getting(org.jetbrains.dokka.gradle.DokkaTask::class)
22+
23+
val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
24+
dependsOn(dokkaHtml)
25+
archiveClassifier.set("javadoc")
26+
from(dokkaHtml.outputDirectory)
27+
}
28+
1929
kotlin {
2030
jvm {
2131
compilations.all {
@@ -58,3 +68,49 @@ kotlin {
5868
val nativeTest by getting
5969
}
6070
}
71+
72+
publishing {
73+
publications.withType<MavenPublication> {
74+
artifact(javadocJar)
75+
pom {
76+
name.set("harmoloid-core")
77+
description.set("Core library for HARMOLOID built in Kotlin/Multiplatform.")
78+
url.set("https://github.com/sdercolin/harmoloid-core-kt")
79+
licenses {
80+
license {
81+
name.set("The Apache License, Version 2.0")
82+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
83+
}
84+
}
85+
developers {
86+
developer {
87+
id.set("sdercolin")
88+
name.set("sdercolin")
89+
email.set("sder.colin@gmail.com")
90+
}
91+
}
92+
scm {
93+
connection.set("git@github.com:sdercolin/harmoloid-core-kt.git")
94+
developerConnection.set("git@github.com:sdercolin/harmoloid-core-kt.git")
95+
url.set("https://github.com/sdercolin/harmoloid-core-kt")
96+
}
97+
}
98+
}
99+
repositories {
100+
maven {
101+
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
102+
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
103+
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
104+
credentials {
105+
username = properties["ossrhUsername"] as String
106+
password = properties["ossrhPassword"] as String
107+
}
108+
}
109+
}
110+
}
111+
112+
signing {
113+
publishing.publications.withType<MavenPublication> {
114+
sign(this)
115+
}
116+
}

0 commit comments

Comments
 (0)