Skip to content

Commit

Permalink
Update kotlin to 1.4.0 (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
evant committed Aug 18, 2020
1 parent 40f640b commit e4288e3
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 86 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,13 +6,35 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Changed
- Minimum supported kotlin version is 1.4.0
- Multiplatform artifacts are published as a single artifact. You can now just write
```groovy
sourceSets {
commonTest {
dependencies {
implementation "com.willowtreeapps.assertk:assertk:..."
}
}
}
```
instead of defining one for each platform.
- Added support for the Kotlin/JS [IR compiler](https://kotlinlang.org/docs/reference/js-ir-compiler.html)

### Added
- Add `prop` function with `KProperty1` argument.

### Deprecated
- Deprecated `prop` function with `KCallable` argument. Use the new overload
with type-safe `KProperty1` argument or another overload with explicit name and lambda.

### Fixed
- Primitive array 'contains' methods now work with NaN. ex:
```kotlin
assertThat(floatArrayOf(Float.Nan)).contains(Float.NaN)
```
will pass when it failed before.

## [0.22] 2020-03-11

### Added
Expand Down
30 changes: 0 additions & 30 deletions assertk-coroutines/build.gradle
Expand Up @@ -13,38 +13,8 @@ kotlin {
commonMain {
dependencies {
implementation project(':assertk')
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$kotlin_coroutines_version"
}
}
jvmMain {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
}
}
jsMain {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$kotlin_coroutines_version"
}
}
linuxMain {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-linuxx64:$kotlin_coroutines_version"
}
}
iosArm64Main {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-iosarm64:$kotlin_coroutines_version"
}
}
iosX64Main {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-iosx64:$kotlin_coroutines_version"
}
}
macosMain {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-macosx64:$kotlin_coroutines_version"
}
}
}
}
11 changes: 2 additions & 9 deletions assertk/build.gradle
Expand Up @@ -40,18 +40,11 @@ kotlin {
implementation project(':java-interop')
}
}
jsMain {
dependencies {
// kotlin-js doesn't handle this as a transitive dep correctly
// when it's scoped as runtime.
api "com.willowtreeapps.opentest4k:opentest4k-js:$opentest4k_version"
}
}
}
}

[compileKotlinJvm, compileKotlinJs].each { it.dependsOn(compileTemplates) }
[compileTestKotlinJvm, compileTestKotlinJs].each { it.dependsOn(compileTestTemplates) }
[compileKotlinJvm, compileKotlinJsLegacy, compileKotlinJsIr].each { it.dependsOn(compileTemplates) }
[compileTestKotlinJvm, compileTestKotlinJsLegacy, compileTestKotlinJsIr].each { it.dependsOn(compileTestTemplates) }

gitPublish {
repoUri = 'git@github.com:willowtreeapps/assertk.git'
Expand Down
Expand Up @@ -2,7 +2,6 @@ package test.assertk

import assertk.assertThat
import assertk.assertions.*
import assertk.catch
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.promise
import kotlin.test.Test
Expand Down
Expand Up @@ -4,14 +4,14 @@ import assertk.*
import assertk.assertions.*
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.runBlocking
import org.junit.Test

class JVMAssertLambdaTest {

@OptIn(ExperimentalCoroutinesApi::class)
@Test fun returnedValue_works_in_coroutine_test() {
runBlockingTest {
runBlocking {
assertThat {
asyncReturnValue()
}.isSuccess().isEqualTo(1)
Expand All @@ -20,7 +20,7 @@ class JVMAssertLambdaTest {

@OptIn(ExperimentalCoroutinesApi::class)
@Test fun returnedValue_exception_works_in_coroutine_test() {
runBlockingTest {
runBlocking {
assertThat {
asyncThrows()
}.isFailure().hasMessage("test")
Expand Down
Expand Up @@ -2,4 +2,4 @@ package test.assertk

actual val exceptionPackageName: String = "kotlin."

actual val opentestPackageName: String = ""
actual val opentestPackageName: String = "com.willowtreeapps.opentest4k."
11 changes: 6 additions & 5 deletions build.gradle
Expand Up @@ -3,22 +3,23 @@ import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.dokka.gradle.DokkaTask

plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.70' apply false
id 'org.jetbrains.kotlin.multiplatform' version '1.4.0' apply false
id 'org.jetbrains.dokka' version '1.4.0-rc' apply false
id 'io.gitlab.arturbosch.detekt' version '1.5.0' apply false
id 'org.ajoberstar.git-publish' version '2.1.1' apply false
}

version = '0.23-SNAPSHOT'

ext {
isReleaseVersion = !(project.version =~ /-SNAPSHOT$/)
isReleaseVersion = !(version =~ /-SNAPSHOT$/)

opentest4k_version = '1.2.0'
kotlin_coroutines_version = '1.3.4'
opentest4k_version = '1.2.1-SNAPSHOT'
kotlin_coroutines_version = '1.3.9'
}

subprojects {
group 'com.willowtreeapps.assertk'
version '0.23-SNAPSHOT'

configurations.all {
// Don't cache SNAPSHOT deps
Expand Down
3 changes: 1 addition & 2 deletions buildSrc/build.gradle
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.30'
ext.kotlin_version = '1.4.0'

repositories {
mavenCentral()
Expand All @@ -18,5 +18,4 @@ repositories {

dependencies {
compile gradleApi()
compile "org.jetbrains.kotlin:kotlin-stdlib"
}
4 changes: 3 additions & 1 deletion gradle.properties
@@ -1 +1,3 @@
org.gradle.jvmargs=-Xmx2048m
org.gradle.jvmargs=-Xmx2048m
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
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-6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
39 changes: 8 additions & 31 deletions multiplatform.gradle
Expand Up @@ -7,7 +7,7 @@ kotlin {
jvmTarget = "1.8"
}
}
js {
js(BOTH) {
nodejs()
browser()
compilations.main.kotlinOptions {
Expand All @@ -19,55 +19,44 @@ kotlin {
}
}
linuxX64('linux')
iosArm64()
iosX64()
ios()
macosX64('macos')

targets.all {
if (name != 'metadata') {
compilations.main.kotlinOptions {
allWarningsAsErrors = true
// allWarningsAsErrors = true
}
compilations.test.kotlinOptions {
allWarningsAsErrors = true
// allWarningsAsErrors = true
freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"]
}
}
}

sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
}
}
jvmMain {
dependencies {
implementation kotlin('stdlib-jdk8')
}
}
jvmTest {
dependencies {
implementation kotlin('test-junit')
implementation kotlin('reflect')
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlin_coroutines_version"
}
}
jsMain {
dependencies {
implementation kotlin('stdlib-js')
}
}
jsTest {
dependencies {
implementation kotlin('test-js')
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$kotlin_coroutines_version"
}
}
nativeMain {
Expand All @@ -76,31 +65,19 @@ kotlin {
nativeTest {
dependsOn(commonTest)
}
[linuxMain, iosArm64Main, iosX64Main, macosMain].each {
[linuxMain, iosMain, macosMain].each {
it.dependsOn(nativeMain)
}
[linuxTest, iosArm64Test, iosX64Test, macosTest].each {
[linuxTest, iosTest, macosTest].each {
it.dependsOn(nativeTest)
}
linuxTest {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-linuxx64:$kotlin_coroutines_version"
}
}
iosArm64Test {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-iosarm64:$kotlin_coroutines_version"
}
}
iosX64Test {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-iosx64:$kotlin_coroutines_version"
}
}
macosTest {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-macosx64:$kotlin_coroutines_version"
}
}
}
}
Expand All @@ -110,6 +87,6 @@ task nativeTest {
}

task test {
dependsOn(jvmTest, jsTest, nativeTest)
dependsOn(allTests)
}

2 changes: 0 additions & 2 deletions settings.gradle
Expand Up @@ -3,5 +3,3 @@ rootProject.name = 'assertk-project'
include 'assertk'
include 'assertk-coroutines'
include 'java-interop'

enableFeaturePreview('GRADLE_METADATA')

0 comments on commit e4288e3

Please sign in to comment.