From 68cabd7a1e7967168211823679161bc7be1d7242 Mon Sep 17 00:00:00 2001 From: Michael Bull Date: Wed, 12 Feb 2020 14:32:53 +0000 Subject: [PATCH] Replace bintray with maven central --- README.md | 6 +-- build.gradle.kts | 108 ++++++++++++++++++++++++++++++----------------- 2 files changed, 72 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 9541ec3..d0f207e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # kotlin-result -[![Release](https://api.bintray.com/packages/michaelbull/maven/kotlin-result/images/download.svg)](https://bintray.com/michaelbull/maven/kotlin-result/_latestVersion) [![CI Status](https://github.com/michaelbull/kotlin-result/workflows/ci/badge.svg)](https://github.com/michaelbull/kotlin-result/actions?query=workflow%3Aci) [![License](https://img.shields.io/github/license/michaelbull/kotlin-result.svg)](https://github.com/michaelbull/kotlin-result/blob/master/LICENSE) +[![Maven Central](https://img.shields.io/maven-central/v/com.michael-bull.kotlin-result/kotlin-result.svg)](https://search.maven.org/search?q=g:com.michael-bull.kotlin-result) [![CI Status](https://github.com/michaelbull/kotlin-result/workflows/ci/badge.svg)](https://github.com/michaelbull/kotlin-result/actions?query=workflow%3Aci) [![License](https://img.shields.io/github/license/michaelbull/kotlin-result.svg)](https://github.com/michaelbull/kotlin-result/blob/master/LICENSE) [`Result`][result] is a monad for modelling success ([`Ok`][result-ok]) or failure ([`Err`][result-err]) operations. @@ -9,11 +9,11 @@ failure ([`Err`][result-err]) operations. ```groovy repositories { - maven { url = 'https://dl.bintray.com/michaelbull/maven' } + mavenCentral() } dependencies { - compile 'com.michael-bull.kotlin-result:kotlin-result:1.1.4' + implementation("com.michael-bull.kotlin-result:kotlin-result:1.1.6") } ``` diff --git a/build.gradle.kts b/build.gradle.kts index 5e7ba39..158e491 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,25 +1,18 @@ import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask -import com.jfrog.bintray.gradle.BintrayExtension -import com.jfrog.bintray.gradle.tasks.BintrayUploadTask import org.jetbrains.dokka.gradle.DokkaTask -import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +val ossrhUsername: String? by ext +val ossrhPassword: String? by ext + description = "A Result monad for modelling success or failure operations." -val SourceSet.kotlin: SourceDirectorySet - get() = withConvention(KotlinSourceSet::class) { kotlin } - -fun BintrayExtension.pkg(configure: BintrayExtension.PackageConfig.() -> Unit) { - pkg(delegateClosureOf(configure)) -} - plugins { `maven-publish` + signing kotlin("jvm") version "1.3.61" - id("org.jetbrains.dokka") version "0.10.0" + id("org.jetbrains.dokka") version "0.10.1" id("com.github.ben-manes.versions") version "0.27.0" - id("com.jfrog.bintray") version "1.8.4" id("net.researchgate.release") version "2.8.1" } @@ -75,42 +68,79 @@ val sourcesJar by tasks.registering(Jar::class) { } publishing { + repositories { + maven { + if (project.version.toString().endsWith("SNAPSHOT")) { + setUrl("https://oss.sonatype.org/content/repositories/snapshots") + } else { + setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2") + } + + credentials { + username = ossrhUsername + password = ossrhPassword + } + } + } + publications { register("mavenJava", MavenPublication::class) { from(components["java"]) artifact(javadocJar.get()) artifact(sourcesJar.get()) + + pom { + name.set(project.name) + description.set(project.description) + url.set("https://github.com/michaelbull/kotlin-result") + inceptionYear.set("2017") + + licenses { + license { + name.set("ISC License") + url.set("https://opensource.org/licenses/isc-license.txt") + } + } + + developers { + developer { + name.set("Michael Bull") + url.set("https://www.michael-bull.com") + } + } + + scm { + connection.set("scm:git:https://github.com/michaelbull/kotlin-result") + developerConnection.set("scm:git:git@github.com:michaelbull/kotlin-result.git") + url.set("https://github.com/michaelbull/kotlin-result") + } + + issueManagement { + system.set("GitHub") + url.set("https://github.com/michaelbull/kotlin-result/issues") + } + + ciManagement { + system.set("GitHub") + url.set("https://github.com/michaelbull/kotlin-result/actions?query=workflow%3Aci") + } + + contributors { + contributor { + name.set("Kevin Herron") + url.set("https://github.com/kevinherron") + } + } + } } } } -val bintrayUser: String? by project -val bintrayKey: String? by project - -bintray { - user = bintrayUser - key = bintrayKey - setPublications("mavenJava") - - pkg { - repo = "maven" - name = project.name - desc = project.description - websiteUrl = "https://github.com/michaelbull/kotlin-result" - issueTrackerUrl = "https://github.com/michaelbull/kotlin-result/issues" - vcsUrl = "git@github.com:michaelbull/kotlin-result.git" - githubRepo = "michaelbull/kotlin-result" - setLicenses("ISC") - } +signing { + useGpgCmd() + sign(publishing.publications) } -val bintrayUpload by tasks.existing(BintrayUploadTask::class) { - dependsOn("build") - dependsOn("generatePomFileForMavenJavaPublication") - dependsOn(sourcesJar) - dependsOn(javadocJar) -} - -tasks.named("afterReleaseBuild") { - dependsOn(bintrayUpload) +tasks.afterReleaseBuild { + dependsOn(tasks.publish) }