Add release/publish configuration

This commit is contained in:
Michael Bull 2017-10-21 22:33:59 +01:00
parent e5ee148ec8
commit 2e2fc22b2b
3 changed files with 78 additions and 13 deletions

View File

@ -19,8 +19,8 @@ It also iterates on other Result libraries written in Kotlin, namely:
Improvements on the existing solutions include: Improvements on the existing solutions include:
- Complete feature parity with Result types from other languages including Elm, - Feature parity with Result types from other languages including Elm, Haskell,
Haskell, & Rust & Rust
- Lax constraints on `value`/`error` nullability - Lax constraints on `value`/`error` nullability
- Lax constraints on the `error` type's inheritance (does not inherit from - Lax constraints on the `error` type's inheritance (does not inherit from
`Exception`) `Exception`)

View File

@ -8,13 +8,21 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion" classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion"
classpath "org.junit.platform:junit-platform-gradle-plugin:$junitPlatformVersion" classpath "org.junit.platform:junit-platform-gradle-plugin:$junitPlatformVersion"
classpath "net.researchgate:gradle-release:$gradleReleaseVersion"
} }
} }
ext {
gradleDir = "$rootDir/gradle"
}
apply plugin: 'kotlin' apply plugin: 'kotlin'
apply plugin: 'maven-publish'
apply plugin: 'org.jetbrains.dokka' apply plugin: 'org.jetbrains.dokka'
apply plugin: 'org.junit.platform.gradle.plugin' apply plugin: 'org.junit.platform.gradle.plugin'
apply plugin: 'net.researchgate.release'
apply from: "$gradleDir/publish.gradle"
description = 'A Result monad for modelling success or failure operations.'
repositories { repositories {
mavenCentral() mavenCentral()
@ -54,13 +62,3 @@ task sourcesJar(type: Jar) {
classifier = 'sources' classifier = 'sources'
from sourceSets.main.allSource from sourceSets.main.allSource
} }
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact javadocJar
artifact sourcesJar
}
}
}

67
gradle/publish.gradle Normal file
View File

@ -0,0 +1,67 @@
apply plugin: 'maven'
apply plugin: 'signing'
ext.isSnapshot = version.endsWith('-SNAPSHOT')
ext.isCI = System.getenv('CI') != null
if (!isCI) {
signing {
sign configurations.archives
}
}
uploadArchives {
repositories {
mavenDeployer {
if (isSnapshot || isCI) {
repository(url: "file://~/.m2/repository")
} else {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
}
}
}
}
rootProject.tasks.afterReleaseBuild.dependsOn tasks.uploadArchives
afterEvaluate {
tasks.uploadArchives.repositories.mavenDeployer.pom.project {
groupId = project.group
artifactId = project.name
version = project.version
packaging = 'jar'
name = project.name
description = project.description
inceptionYear = 2017
url = 'https://github.com/michaelbull/kotlin-result'
scm {
connection = 'scm:git:https://github.com/michaelbull/kotlin-result'
developerConnection = 'scm:git:git@github.com:michaelbull/kotlin-result.git'
url = 'https://github.com/michaelbull/kotlin-result'
}
licenses {
license {
name = 'ISC License'
url = 'http://opensource.org/licenses/isc-license.txt'
}
}
developers {
developer {
name = 'Michael Bull'
url = 'https://www.michael-bull.com'
}
}
}
}