kotlin-result/build.gradle.kts

110 lines
3.1 KiB
Plaintext
Raw Normal View History

import com.jfrog.bintray.gradle.BintrayExtension
import com.jfrog.bintray.gradle.tasks.BintrayUploadTask
import org.jetbrains.dokka.gradle.DokkaTask
2018-09-24 21:13:47 +00:00
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
2019-05-30 12:07:51 +00:00
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2018-09-24 21:13:47 +00:00
description = "A Result monad for modelling success or failure operations."
plugins {
`maven-publish`
2019-08-09 20:12:05 +00:00
kotlin("jvm") version ("1.3.41")
2019-05-30 12:07:51 +00:00
id("org.jetbrains.dokka") version ("0.9.18")
id("com.github.ben-manes.versions") version ("0.21.0")
2018-09-24 21:13:47 +00:00
id("com.jfrog.bintray") version ("1.8.4")
2019-08-09 20:12:05 +00:00
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"))
2018-09-24 21:13:47 +00:00
testImplementation("junit:junit:4.12")
testImplementation(kotlin("test-common"))
testImplementation(kotlin("test-annotations-common"))
testImplementation(kotlin("test-junit"))
testImplementation(kotlin("test"))
2018-09-24 21:13:47 +00:00
}
val SourceSet.kotlin: SourceDirectorySet
get() = withConvention(KotlinSourceSet::class) { kotlin }
fun BintrayExtension.pkg(configure: BintrayExtension.PackageConfig.() -> Unit) {
pkg(delegateClosureOf(configure))
}
2018-11-01 11:03:47 +00:00
val dokka by tasks.existing(DokkaTask::class) {
2018-09-24 21:13:47 +00:00
sourceDirs = sourceSets["main"].kotlin.srcDirs
outputFormat = "javadoc"
outputDirectory = "$buildDir/docs/javadoc"
kotlinTasks(::defaultKotlinTasks)
2018-09-24 21:13:47 +00:00
}
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 {
publications {
register("mavenJava", MavenPublication::class) {
from(components["java"])
artifact(javadocJar.get())
artifact(sourcesJar.get())
}
}
}
val bintrayUser: String? by project
val bintrayKey: String? by project
2018-09-24 21:13:47 +00:00
bintray {
user = bintrayUser
key = bintrayKey
2018-09-24 21:13:47 +00:00
setPublications("mavenJava")
pkg {
2018-09-24 21:13:47 +00:00
repo = "maven"
2019-06-09 12:48:30 +00:00
name = project.name
desc = project.description
2019-05-30 12:38:12 +00:00
websiteUrl = "https://github.com/michaelbull/kotlin-result"
issueTrackerUrl = "https://github.com/michaelbull/kotlin-result/issues"
2018-09-24 21:13:47 +00:00
vcsUrl = "git@github.com:michaelbull/kotlin-result.git"
2019-05-30 12:38:12 +00:00
githubRepo = "michaelbull/kotlin-result"
2018-09-24 21:13:47 +00:00
setLicenses("ISC")
}
2018-09-24 21:13:47 +00:00
}
2018-11-01 11:03:47 +00:00
val bintrayUpload by tasks.existing(BintrayUploadTask::class) {
dependsOn("build")
dependsOn("generatePomFileForMavenJavaPublication")
2018-09-24 21:13:47 +00:00
dependsOn(sourcesJar)
dependsOn(javadocJar)
}
tasks.named("afterReleaseBuild") {
2018-09-24 21:13:47 +00:00
dependsOn(bintrayUpload)
}