kotlin-result/build.gradle.kts

147 lines
4.3 KiB
Plaintext
Raw Normal View History

2019-08-23 23:26:31 +00:00
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.jetbrains.dokka.gradle.DokkaTask
2019-05-30 12:07:51 +00:00
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2018-09-24 21:13:47 +00:00
2020-02-12 14:32:53 +00:00
val ossrhUsername: String? by ext
val ossrhPassword: String? by ext
2019-09-27 09:25:37 +00:00
2020-02-12 14:32:53 +00:00
description = "A Result monad for modelling success or failure operations."
2019-09-27 09:25:37 +00:00
2018-09-24 21:13:47 +00:00
plugins {
`maven-publish`
2020-02-12 14:32:53 +00:00
signing
2020-04-16 09:37:06 +00:00
kotlin("jvm") version "1.3.72"
2020-02-12 14:32:53 +00:00
id("org.jetbrains.dokka") version "0.10.1"
2020-04-16 09:37:06 +00:00
id("com.github.ben-manes.versions") version "0.28.0"
id("net.researchgate.release") version "2.8.1"
2018-09-24 21:13:47 +00:00
}
allprojects {
repositories {
mavenCentral()
jcenter()
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf("-Xuse-experimental=kotlin.contracts.ExperimentalContracts")
}
}
2018-09-24 21:13:47 +00:00
}
dependencies {
2018-09-24 22:24:29 +00:00
implementation(kotlin("stdlib"))
2020-04-16 09:37:06 +00:00
testImplementation("junit:junit:4.13")
testImplementation(kotlin("test-common"))
testImplementation(kotlin("test-annotations-common"))
testImplementation(kotlin("test-junit"))
testImplementation(kotlin("test"))
2018-09-24 21:13:47 +00:00
}
2019-09-27 09:25:37 +00:00
tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
listOf("alpha", "beta", "rc", "cr", "m", "eap", "pr").any {
candidate.version.contains(it, ignoreCase = true)
2019-08-23 23:26:31 +00:00
}
}
}
2018-11-01 11:03:47 +00:00
val dokka by tasks.existing(DokkaTask::class) {
2018-09-24 21:13:47 +00:00
outputFormat = "javadoc"
outputDirectory = "$buildDir/docs/javadoc"
}
val javadocJar by tasks.registering(Jar::class) {
group = LifecycleBasePlugin.BUILD_GROUP
description = "Assembles a jar archive containing the Javadoc API documentation."
archiveClassifier.set("javadoc")
dependsOn(dokka)
2018-09-24 21:13:47 +00:00
from(dokka.get().outputDirectory)
}
val sourcesJar by tasks.registering(Jar::class) {
group = LifecycleBasePlugin.BUILD_GROUP
description = "Assembles a jar archive containing the main classes with sources."
archiveClassifier.set("sources")
2018-09-24 21:13:47 +00:00
from(sourceSets["main"].allSource)
}
publishing {
2020-02-12 14:32:53 +00:00
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
}
}
}
2018-09-24 21:13:47 +00:00
publications {
register("mavenJava", MavenPublication::class) {
from(components["java"])
artifact(javadocJar.get())
artifact(sourcesJar.get())
2020-02-12 14:32:53 +00:00
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")
}
}
contributors {
contributor {
name.set("Kevin Herron")
url.set("https://github.com/kevinherron")
}
}
2020-02-12 14:32:53 +00:00
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")
}
}
}
}
2018-09-24 21:13:47 +00:00
}
2020-02-12 14:32:53 +00:00
signing {
useGpgCmd()
sign(publishing.publications)
2018-09-24 21:13:47 +00:00
}
2020-02-12 14:32:53 +00:00
tasks.afterReleaseBuild {
dependsOn(tasks.publish)
2018-09-24 21:13:47 +00:00
}