parent
f8ce59b3fb
commit
bca344daaf
138
build.gradle.kts
138
build.gradle.kts
@ -1,6 +1,5 @@
|
|||||||
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
|
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
|
||||||
import org.jetbrains.dokka.gradle.DokkaTask
|
import org.jetbrains.dokka.gradle.DokkaTask
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
||||||
|
|
||||||
val ossrhUsername: String? by ext
|
val ossrhUsername: String? by ext
|
||||||
val ossrhPassword: String? by ext
|
val ossrhPassword: String? by ext
|
||||||
@ -10,7 +9,7 @@ description = "A Result monad for modelling success or failure operations."
|
|||||||
plugins {
|
plugins {
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
signing
|
signing
|
||||||
kotlin("jvm") version "1.3.72"
|
kotlin("multiplatform") version "1.3.72"
|
||||||
id("org.jetbrains.dokka") version "0.10.1"
|
id("org.jetbrains.dokka") version "0.10.1"
|
||||||
id("com.github.ben-manes.versions") version "0.28.0"
|
id("com.github.ben-manes.versions") version "0.28.0"
|
||||||
id("net.researchgate.release") version "2.8.1"
|
id("net.researchgate.release") version "2.8.1"
|
||||||
@ -18,52 +17,6 @@ plugins {
|
|||||||
id("org.jetbrains.kotlin.plugin.allopen") version "1.3.72"
|
id("org.jetbrains.kotlin.plugin.allopen") version "1.3.72"
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
jcenter()
|
|
||||||
maven("https://dl.bintray.com/kotlin/kotlinx")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = "1.8"
|
|
||||||
freeCompilerArgs = listOf("-Xuse-experimental=kotlin.contracts.ExperimentalContracts")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allOpen {
|
|
||||||
annotation("org.openjdk.jmh.annotations.State")
|
|
||||||
annotation("org.openjdk.jmh.annotations.BenchmarkMode")
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets.create("benchmark") {
|
|
||||||
java {
|
|
||||||
srcDir("src/benchmarks/kotlin")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val benchmarkImplementation by configurations
|
|
||||||
|
|
||||||
benchmark {
|
|
||||||
targets {
|
|
||||||
register("benchmark")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation(kotlin("stdlib"))
|
|
||||||
testImplementation("junit:junit:4.13")
|
|
||||||
testImplementation(kotlin("test-common"))
|
|
||||||
testImplementation(kotlin("test-annotations-common"))
|
|
||||||
testImplementation(kotlin("test-junit"))
|
|
||||||
testImplementation(kotlin("test"))
|
|
||||||
|
|
||||||
benchmarkImplementation(sourceSets.main.get().output + sourceSets.main.get().runtimeClasspath)
|
|
||||||
benchmarkImplementation("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:0.2.0-dev-8")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<DependencyUpdatesTask> {
|
tasks.withType<DependencyUpdatesTask> {
|
||||||
rejectVersionIf {
|
rejectVersionIf {
|
||||||
listOf("alpha", "beta", "rc", "cr", "m", "eap", "pr").any {
|
listOf("alpha", "beta", "rc", "cr", "m", "eap", "pr").any {
|
||||||
@ -85,11 +38,82 @@ val javadocJar by tasks.registering(Jar::class) {
|
|||||||
from(dokka.get().outputDirectory)
|
from(dokka.get().outputDirectory)
|
||||||
}
|
}
|
||||||
|
|
||||||
val sourcesJar by tasks.registering(Jar::class) {
|
allprojects {
|
||||||
group = LifecycleBasePlugin.BUILD_GROUP
|
repositories {
|
||||||
description = "Assembles a jar archive containing the main classes with sources."
|
mavenCentral()
|
||||||
archiveClassifier.set("sources")
|
jcenter()
|
||||||
from(sourceSets["main"].allSource)
|
maven("https://dl.bintray.com/kotlin/kotlinx")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allOpen {
|
||||||
|
annotation("org.openjdk.jmh.annotations.State")
|
||||||
|
annotation("org.openjdk.jmh.annotations.BenchmarkMode")
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets.create("benchmark")
|
||||||
|
|
||||||
|
benchmark {
|
||||||
|
targets {
|
||||||
|
register("jvmBenchmark")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
jvm {
|
||||||
|
withJava()
|
||||||
|
|
||||||
|
mavenPublication {
|
||||||
|
artifact(javadocJar.get())
|
||||||
|
}
|
||||||
|
|
||||||
|
compilations.all {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
all {
|
||||||
|
languageSettings.apply {
|
||||||
|
useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val commonMain by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("stdlib-common"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val commonTest by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("test-common"))
|
||||||
|
implementation(kotlin("test-annotations-common"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val jvmMain by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("stdlib-jdk8"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val jvmTest by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("test-junit"))
|
||||||
|
implementation(kotlin("test"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val jvmBenchmark by getting {
|
||||||
|
dependsOn(jvmMain)
|
||||||
|
dependencies {
|
||||||
|
implementation("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:0.2.0-dev-8")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
@ -108,12 +132,7 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
publications {
|
publications.withType<MavenPublication> {
|
||||||
register("mavenJava", MavenPublication::class) {
|
|
||||||
from(components["java"])
|
|
||||||
artifact(javadocJar.get())
|
|
||||||
artifact(sourcesJar.get())
|
|
||||||
|
|
||||||
pom {
|
pom {
|
||||||
name.set(project.name)
|
name.set(project.name)
|
||||||
description.set(project.description)
|
description.set(project.description)
|
||||||
@ -169,7 +188,6 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
signing {
|
signing {
|
||||||
useGpgCmd()
|
useGpgCmd()
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
application
|
application
|
||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
@ -22,3 +24,9 @@ dependencies {
|
|||||||
implementation("io.ktor:ktor-server-netty:$ktorVersion")
|
implementation("io.ktor:ktor-server-netty:$ktorVersion")
|
||||||
implementation("io.ktor:ktor-gson:$ktorVersion")
|
implementation("io.ktor:ktor-gson:$ktorVersion")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType(KotlinCompile::class.java).all {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -38,11 +38,7 @@ inline fun <V, E> binding(crossinline block: ResultBinding<E>.() -> V): Result<V
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal object BindException : Exception() {
|
internal expect object BindException : Exception
|
||||||
override fun fillInStackTrace(): Throwable {
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ResultBinding<E> {
|
interface ResultBinding<E> {
|
||||||
fun <V> Result<V, E>.bind(): V
|
fun <V> Result<V, E>.bind(): V
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.github.michaelbull.result
|
||||||
|
|
||||||
|
internal actual object BindException : Exception() {
|
||||||
|
override fun fillInStackTrace(): Throwable {
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user