2018-09-24 21:13:47 +00:00
|
|
|
import com.jfrog.bintray.gradle.BintrayExtension
|
|
|
|
import com.jfrog.bintray.gradle.tasks.BintrayUploadTask
|
|
|
|
import groovy.lang.Closure
|
|
|
|
import org.gradle.api.internal.HasConvention
|
|
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
import org.jetbrains.dokka.gradle.DokkaTask
|
2018-11-01 11:03:47 +00:00
|
|
|
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
|
2018-09-24 21:13:47 +00:00
|
|
|
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
|
|
|
|
|
|
|
description = "A Result monad for modelling success or failure operations."
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
`maven-publish`
|
2018-11-01 11:03:47 +00:00
|
|
|
kotlin("jvm") version ("1.3.0")
|
2018-09-24 21:13:47 +00:00
|
|
|
id("org.jetbrains.dokka") version ("0.9.17")
|
|
|
|
id("com.github.ben-manes.versions") version ("0.20.0")
|
|
|
|
id("com.jfrog.bintray") version ("1.8.4")
|
|
|
|
id("net.researchgate.release") version ("2.7.0")
|
|
|
|
}
|
|
|
|
|
|
|
|
allprojects {
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
2018-11-01 11:03:47 +00:00
|
|
|
|
|
|
|
plugins.withType<KotlinPluginWrapper> {
|
|
|
|
tasks.withType<KotlinCompile> {
|
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = "1.8"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
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")
|
2018-09-24 21:31:53 +00:00
|
|
|
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 }
|
|
|
|
|
2018-11-01 18:39:17 +00:00
|
|
|
fun BintrayExtension.pkg(configure: BintrayExtension.PackageConfig.() -> Unit): Any? {
|
|
|
|
return pkg(closureOf(configure))
|
|
|
|
}
|
|
|
|
|
2018-11-01 11:03:47 +00:00
|
|
|
val dokka by tasks.existing(DokkaTask::class) {
|
|
|
|
kotlinTasks(closureOf<Any?> { emptyList() })
|
|
|
|
sourceDirs = sourceSets["main"].kotlin.srcDirs
|
|
|
|
outputFormat = "javadoc"
|
|
|
|
outputDirectory = "$buildDir/docs/javadoc"
|
2018-09-24 21:13:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dokka {
|
|
|
|
kotlinTasks(closureOf<Any?> { emptyList() })
|
|
|
|
sourceDirs = sourceSets["main"].kotlin.srcDirs
|
|
|
|
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."
|
|
|
|
classifier = "javadoc"
|
2018-09-24 21:32:47 +00:00
|
|
|
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."
|
|
|
|
classifier = "sources"
|
|
|
|
from(sourceSets["main"].allSource)
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
register("mavenJava", MavenPublication::class) {
|
|
|
|
from(components["java"])
|
|
|
|
artifact(javadocJar.get())
|
|
|
|
artifact(sourcesJar.get())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bintray {
|
|
|
|
user = project.findProperty("bintrayUser")?.toString() ?: ""
|
|
|
|
key = project.findProperty("bintrayKey")?.toString() ?: ""
|
|
|
|
setPublications("mavenJava")
|
|
|
|
|
2018-11-01 18:39:17 +00:00
|
|
|
pkg {
|
2018-09-24 21:13:47 +00:00
|
|
|
repo = "maven"
|
|
|
|
name = "kotlin-result"
|
|
|
|
vcsUrl = "git@github.com:michaelbull/kotlin-result.git"
|
|
|
|
setLicenses("ISC")
|
2018-11-01 18:39:17 +00:00
|
|
|
}
|
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)
|
|
|
|
}
|
|
|
|
|
2018-11-01 11:03:47 +00:00
|
|
|
tasks.named<Task>("afterReleaseBuild") {
|
2018-09-24 21:13:47 +00:00
|
|
|
dependsOn(bintrayUpload)
|
|
|
|
}
|