Skip to content

Commit

Permalink
migrate to kotlin 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tetraquark committed Aug 23, 2020
1 parent adc333f commit cb046d5
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 66 deletions.
39 changes: 7 additions & 32 deletions MyersDiffKt/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ android {
}

kotlin {

android {
publishLibraryVariants("release", "debug")
}
jvm()
macosX64()
iosArm64()
iosX64()
ios()

sourceSets {
// for unit-tests purposes
Expand All @@ -46,40 +44,17 @@ kotlin {

commonMain {
dependencies {
implementation(kotlin("stdlib-common"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:${Versions.coroutines}")
}
}
val androidMain by getting {
dependencies {
implementation(kotlin("stdlib"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines}")
}
}
val jvmMain by getting {
dependencies {
implementation(kotlin("stdlib"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}")
}
}
val macosX64Main by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-native:${Versions.coroutines}")
}
}
val iosArm64Main by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-native:${Versions.coroutines}")
}
}
val iosX64Main by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-native:${Versions.coroutines}")
}
}
val androidMain by getting
val jvmMain by getting
val macosX64Main by getting
val iosArm64Main by getting
val iosX64Main by getting

val jvmTest by getting {
dependencies {
implementation(kotlin("stdlib"))
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import org.junit.Before
import org.junit.Test
import kotlin.test.assertTrue

@UseExperimental(kotlinx.coroutines.ExperimentalCoroutinesApi::class)
class DiffUtilTest {

private var oldList = mutableListOf<String>()
Expand Down Expand Up @@ -73,7 +72,5 @@ class DiffUtilTest {
}
}
}

}

}
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,43 @@ The main part of the algorithm implementation is rewritten to Kotlin from the An

Library version | Kotlin version
------------ | -------------
1.0.0 | 1.3.61
1.2.0 | 1.4.0
1.1.0 | 1.3.72
1.0.0 | 1.3.61

## Setup

1. In **settings.gradle**:
```
enableFeaturePreview("GRADLE_METADATA")
```
In root **build.gradle.kts** add the maven repository url:

2. In root **build.gradle** add the maven repository url:
```kotlin
allprojects {
repositories {
maven { url = uri("https://dl.bintray.com/tetraquark/kmplibs") }
}
}
```

or in root **build.gradle**
```groovy
allprojects {
repositories {
maven { url "https://dl.bintray.com/tetraquark/kmplibs" }
}
}
```

3. In a project **build.gradle**:
Then in a project **build.gradle.kts**:
```kotlin
dependencies {
implementation("ru.tetraquark.kmplibs:MyersDiffKt:1.2.0")
}
```

or in a project **build.gradle**:

```groovy
dependencies {
implementation "ru.tetraquark.kmplibs:MyersDiffKt:1.0.0"
implementation "ru.tetraquark.kmplibs:MyersDiffKt:1.2.0"
}
```

Expand Down
20 changes: 14 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
allprojects {
buildscript {
repositories {
google()
jcenter()

maven { url = uri("https://kotlin.bintray.com/kotlin") }
maven { url = uri("https://kotlin.bintray.com/kotlinx") }
google()
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}")
classpath("com.android.tools.build:gradle:3.5.4")
}
}

configurations.create("compileClasspath")
allprojects {
repositories {
jcenter()
google()
mavenCentral()
}
}
11 changes: 1 addition & 10 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
plugins {
`kotlin-dsl`
id("org.jetbrains.kotlin.jvm") version("1.4.0")
}

repositories {
jcenter()
google()
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61")
implementation("com.android.tools.build:gradle:3.5.2")
}

kotlinDslPluginOptions {
experimentalWarning.set(false)
}
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
object Versions {
const val kotlin = "1.3.72"
const val MyersDiffKt = "1.1.0"
const val coroutines = "1.3.3"
const val kotlin = "1.4.0"
const val MyersDiffKt = "1.2.0"
const val coroutines = "1.3.9"

const val buildToolsVersion = "29.0.2"
const val minSdkVersion = 21
Expand Down
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-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip
2 changes: 1 addition & 1 deletion sample-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ android {
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}")
implementation("org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines}")
implementation("androidx.appcompat:appcompat:${Versions.appcompat}")
implementation("androidx.recyclerview:recyclerview:${Versions.recyclerview}")
Expand Down
2 changes: 0 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
enableFeaturePreview("GRADLE_METADATA")

include(":MyersDiffKt")
include(":sample-android")

Expand Down

0 comments on commit cb046d5

Please sign in to comment.