Skip to content

Commit

Permalink
Upgrade: bump into kotlin 1.3.0 and coroutines 1.0.0.
Browse files Browse the repository at this point in the history
1. Fixed the coroutines new API and android coroutines.
  • Loading branch information
pokk committed Oct 30, 2018
1 parent 712b66b commit 58b0aad
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 37 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ allprojects {
And add our dependency to your app `bundle.gradle`.

```gradle
implementation 'com.devrapid.jieyi:kotlinknifer:2.0.5'
implementation 'com.devrapid.jieyi:kotlinknifer:2.1.0'
implementation 'com.devrapid.jieyi:kotlinshaver:1.0.5'
implementation 'com.devrapid.jieyi:kotlinshaver:1.1.0'
```

Then you can use it!!!
Expand All @@ -101,14 +101,14 @@ Then you can use it!!!
<dependency>
<groupId>com.devrapid.jieyi</groupId>
<artifactId>kotlinknifer</artifactId>
<version>2.0.5</version>
<version>2.1.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.devrapid.jieyi</groupId>
<artifactId>kotlinshaver</artifactId>
<version>1.0.5</version>
<version>1.1.0</version>
<type>pom</type>
</dependency>
```
Expand All @@ -123,20 +123,20 @@ Then you can use it!!!
## kotlinshaver
### For Androidx

1. RxJava 2.2.1
1. RxJava 2.2.3
2. RxKotlin 2.3.0

If you'd not like to use them to your project, you can add the exclude as like below

```gradle
implementation('com.devrapid.jieyi:kotlinknifer:2.0.5', {
implementation('com.devrapid.jieyi:kotlinknifer:2.1.0', {
exclude group: 'com.google.code.gson', module: 'gson'
exclude group: 'com.github.bumptech.glide', module: 'glide'
})
```

```gradle
implementation('com.devrapid.jieyi:kotlinshaverr:1.0.5', {
implementation('com.devrapid.jieyi:kotlinshaverr:1.1.0', {
exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
exclude group: 'io.reactivex.rxjava2', module: 'rxkotlin'
})
Expand Down
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.61'
ext.kotlin_version = '1.3.0'
ext.kotlin_coroutine_version = '1.0.0'
repositories {
jcenter()
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-beta04'
classpath 'com.android.tools.build:gradle:3.2.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ proj_name=kotlinknifer
proj_libname=KotlinKnifer
proj_group=com.devrapid.jieyi
proj_artifactid=kotlinknifer
proj_version=2.0.5
proj_version=2.1.0
proj_description=For developing an Android conveniently and rapidly.
proj_websiteurl=https://github.com/pokk/KotlinKnifer
proj_issuetrackerurl=https://github.com/pokk/KotlinKnifer/issues
Expand All @@ -39,4 +39,4 @@ [email protected]
proj_kotlin_name=kotlinshaver
proj_kotlin_libname=KotlinShaver
proj_kotlin_artifactid=kotlinshaver
proj_kotlin_version=1.0.5
proj_kotlin_version=1.1.0
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
20 changes: 10 additions & 10 deletions kotlinknifer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ kotlin {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
// 'compile' can also import to the new project with this.
compile 'com.google.code.gson:gson:2.8.5'
compile 'com.github.bumptech.glide:glide:4.8.0'
compile "com.google.code.gson:gson:2.8.5"
compile "com.github.bumptech.glide:glide:4.8.0"
// 'implementation' can't import to the new project.
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.25.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-common:0.25.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.25.0'
implementation 'org.jetbrains.anko:anko-commons:0.10.5'
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
implementation 'androidx.recyclerview:recyclerview:1.0.0-rc01'
implementation 'androidx.palette:palette:1.0.0-rc02'
compile project(':kotlinshaver')
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutine_version"
implementation "org.jetbrains.anko:anko-commons:0.10.7-rc13"
implementation "androidx.appcompat:appcompat:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.0.0-rc01"
implementation "androidx.palette:palette:1.0.0"
compile project(":kotlinshaver")
}

apply from: 'https://raw.githubusercontent.com/pokk/JCenterUploader/master/Uploader.gradle'
21 changes: 13 additions & 8 deletions kotlinknifer/src/main/java/com/devrapid/kotlinknifer/Coroutine.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
@file:Suppress("NOTHING_TO_INLINE")

package com.devrapid.kotlinknifer

import kotlinx.coroutines.experimental.CoroutineScope
import kotlinx.coroutines.experimental.android.UI
import kotlinx.coroutines.experimental.launch
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers.Default
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch

inline fun ui(noinline block: suspend CoroutineScope.() -> Unit) = GlobalScope.launch(Main, block = block)

inline fun bkg(noinline block: suspend CoroutineScope.() -> Unit) = GlobalScope.launch(Default, block = block)

/**
* @author Jieyi Wu
* @since 2018/04/04
*/
fun ui(block: suspend CoroutineScope.() -> Unit) = launch(UI, block = block)
inline fun io(noinline block: suspend CoroutineScope.() -> Unit) = GlobalScope.launch(IO, block = block)
8 changes: 4 additions & 4 deletions kotlinshaver/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apply plugin: 'kotlin'

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.25.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-common:0.25.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$kotlin_coroutine_version"

compile 'io.reactivex.rxjava2:rxkotlin:2.3.0'
compile 'io.reactivex.rxjava2:rxjava:2.2.1'
compile "io.reactivex.rxjava2:rxkotlin:2.3.0"
compile "io.reactivex.rxjava2:rxjava:2.2.3"
}

sourceCompatibility = "1.8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ package com.devrapid.kotlinshaver
* @since 11/8/17
*/
fun <E> ArrayList<E>.removeRange(from: Int, to: Int): Boolean =
if (!(from in 0..size - 1 && to in 0..size - 1 && from > to)) {
if (!(from in 0 until size && to in 0 until size && from > to)) {
false
}
else {
subList(from, to).clear()
true
}
}
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation project(':kotlinknifer')
Expand Down

0 comments on commit 58b0aad

Please sign in to comment.