Skip to content

Commit

Permalink
Prepare for Maven Central publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
alllex committed Jun 30, 2021
1 parent f0ec652 commit a4fdf0c
Showing 1 changed file with 50 additions and 6 deletions.
56 changes: 50 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.4.32"
signing
`maven-publish`
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}

group = "com.github.alllex"
version = "0.1.3-SNAPSHOT"
group = "me.alllex.parsus"
version = "0.1.4-SNAPSHOT"

dependencies {
testImplementation(kotlin("test-junit"))
Expand All @@ -21,16 +23,58 @@ tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "${JavaVersion.VERSION_1_8}"
}

val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
configure<JavaPluginExtension> {
withJavadocJar()
withSourcesJar()
}

configure<SigningExtension> {
val signingKey: String? by project
val signingPassword: String? by project
val publishing: PublishingExtension by project

if (signingKey == null || signingPassword == null) return@configure
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications)
}

nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(sourcesJar.get())

pom {
name.set("Parsus")
description.set("Composable parsers using Kotlin Coroutines")
url.set("https://github.com/alllex/parsus")
licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("alllex")
name.set("Aleksei Semin")
email.set("alllexsm@gmail.com")
}
}
scm {
connection.set("scm:git:git@github.com:alllex/parsus.git")
developerConnection.set("scm:git:git@github.com:alllex/parsus.git")
url.set("https://github.com/alllex/parsus")
}
}
}
}
}

0 comments on commit a4fdf0c

Please sign in to comment.