Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Kotlin.kts and Upgrade Kotlin to 1.3 #43

Merged
merged 6 commits into from Nov 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion .travis.yml
Expand Up @@ -3,11 +3,17 @@ language: java
jdk:
- oraclejdk8

cache:
directories:
- $HOME/.gradle

before_script:
- chmod +x deploy_bintray.sh

script:
- ./gradlew test --info

after_success:
- ./deploy_bintray.sh
- ./gradlew jacocoTestReport
- bash <(curl -s https://codecov.io/bash)
- ./deploy_bintray.sh
5 changes: 4 additions & 1 deletion README.md
@@ -1,6 +1,9 @@
# Result

[![Kotlin](https://img.shields.io/badge/kotlin-1.2.71-blue.svg)](http://kotlinlang.org) [ ![jcenter](https://api.bintray.com/packages/kittinunf/maven/Result/images/download.svg) ](https://bintray.com/kittinunf/maven/Result/_latestVersion) [![Build Status](https://travis-ci.org/kittinunf/Result.svg?branch=master)](https://travis-ci.org/kittinunf/Result)
[![Kotlin](https://img.shields.io/badge/kotlin-1.3.10-blue.svg)](http://kotlinlang.org)
[![jcenter](https://api.bintray.com/packages/kittinunf/maven/Result/images/download.svg)](https://bintray.com/kittinunf/maven/Result/_latestVersion)
[![Build Status](https://travis-ci.org/kittinunf/Result.svg?branch=master)](https://travis-ci.org/kittinunf/Result)
[![Codecov](https://codecov.io/github/kittinunf/Result/coverage.svg?branch=master)](https://codecov.io/gh/kittinunf/Result)

This is a tiny framework for modelling success/failure of operations in [Kotlin](http://kotlinlang.org). In short, it is a model in type of `Result<V, E : Exception>`.

Expand Down
31 changes: 0 additions & 31 deletions build.gradle

This file was deleted.

41 changes: 41 additions & 0 deletions build.gradle.kts
@@ -0,0 +1,41 @@
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin

buildscript {
repositories {
jcenter()
mavenCentral()
}

dependencies {
classpath(kotlin("gradle-plugin", extra.get("kotlin") as String))
classpath("com.jfrog.bintray.gradle:gradle-bintray-plugin:${extra.get("bintray")}")
}
}

allprojects {
repositories {
jcenter()
}
}

subprojects {
apply {
plugin<JavaLibraryPlugin>()
plugin<KotlinPlatformJvmPlugin>()
plugin("maven-publish")
plugin("com.jfrog.bintray")
plugin("jacoco")
}

configure<JacocoPluginExtension> {
toolVersion = extra.get("jacoco") as String
}

tasks.withType<JacocoReport> {
reports {
html.isEnabled = true
xml.isEnabled = true
csv.isEnabled = false
}
}
}
23 changes: 7 additions & 16 deletions gradle.properties
@@ -1,18 +1,9 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true

kotlin=1.3.10

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
bintray=1.8.4
coroutines=1.0.1
jacoco=0.8.2
junit=4.12
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
32 changes: 0 additions & 32 deletions result-coroutines/build.gradle

This file was deleted.

13 changes: 13 additions & 0 deletions result-coroutines/build.gradle.kts
@@ -0,0 +1,13 @@
sourceSets {
getByName("main").java.srcDirs("src/main/kotlin")
getByName("test").java.srcDirs("src/main/kotlin")
}

dependencies {
implementation(project(":result"))

implementation(kotlin("stdlib"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${extra.get("coroutines")}")

testImplementation("junit:junit:${extra.get("junit")}")
}
@@ -1,7 +1,7 @@
package com.github.kittinunf.result.coroutines

import com.github.kittinunf.result.NoException
import kotlinx.coroutines.experimental.runBlocking
import kotlinx.coroutines.runBlocking
import org.hamcrest.CoreMatchers.equalTo
import org.hamcrest.CoreMatchers.notNullValue
import org.hamcrest.CoreMatchers.nullValue
Expand Down
@@ -1,7 +1,6 @@
package com.github.kittinunf.result.coroutines

import kotlinx.coroutines.experimental.async
import kotlinx.coroutines.experimental.runBlocking
import kotlinx.coroutines.*
import org.hamcrest.CoreMatchers.equalTo
import org.hamcrest.MatcherAssert.assertThat
import org.junit.Test
Expand Down Expand Up @@ -44,7 +43,7 @@ class SuspendableValidationTests {
}

suspend fun resultReadFromAssetFileName(name: String): SuspendableResult<String, Exception> {
val operation = async { readFromAssetFileName(name) }.await()
val operation = runBlocking { async { readFromAssetFileName(name) }.await() }
return SuspendableResult.of(operation)
}

Expand Down
23 changes: 0 additions & 23 deletions result/build.gradle

This file was deleted.

10 changes: 10 additions & 0 deletions result/build.gradle.kts
@@ -0,0 +1,10 @@
sourceSets {
getByName("main").java.srcDirs("src/main/kotlin")
getByName("test").java.srcDirs("src/main/kotlin")
}

dependencies {
implementation(kotlin("stdlib"))

testImplementation("junit:junit:${extra.get("junit")}")
}
1 change: 0 additions & 1 deletion settings.gradle

This file was deleted.

1 change: 1 addition & 0 deletions settings.gradle.kts
@@ -0,0 +1 @@
include(":result", ":result-coroutines")