Skip to content

Commit

Permalink
feature(dependencies): upgrade kotlin, coroutines and ktor
Browse files Browse the repository at this point in the history
  • Loading branch information
Malinskiy committed Apr 30, 2020
1 parent 11b3075 commit 5b48c1b
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-sonatype-release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: deploy-github-release
name: deploy-sonatype-release
on:
push:
tags: '*'
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
object Versions {
val adam = System.getenv("GITHUB_TAG_NAME") ?: "0.0.2"
val kotlin = "1.3.41"
val coroutines = "1.2.2"
val kotlin = "1.3.61"
val coroutines = "1.3.3"

val annotations = "16.0.2"
val kxml = "2.3.0"
val ktor = "1.2.3"
val ktor = "1.3.0"
val logging = "1.7.6"

val assertk = "0.19"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.produce
import kotlinx.coroutines.io.close
import java.net.InetAddress
import java.net.InetSocketAddress
import kotlin.coroutines.CoroutineContext
Expand All @@ -59,7 +58,7 @@ class AndroidDebugBridgeServer(
}
return request.process(readChannel, writeChannel)
} finally {
writeChannel?.close()
writeChannel?.close(null)
}
}
}
Expand Down Expand Up @@ -88,7 +87,7 @@ class AndroidDebugBridgeServer(

request.close(channel)
} finally {
writeChannel?.close()
writeChannel?.close(null)
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/com/malinskiy/adam/extension/Channel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ package com.malinskiy.adam.extension

import com.malinskiy.adam.transport.AndroidReadChannel
import com.malinskiy.adam.transport.AndroidWriteChannel
import kotlinx.coroutines.io.ByteReadChannel
import kotlinx.coroutines.io.ByteWriteChannel
import io.ktor.utils.io.ByteReadChannel
import io.ktor.utils.io.ByteWriteChannel


fun ByteReadChannel.toAndroidChannel() = AndroidReadChannel(this)
fun ByteWriteChannel.toAndroidChannel() = AndroidWriteChannel(this)
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import com.malinskiy.adam.transport.AndroidReadChannel
import com.malinskiy.adam.transport.AndroidWriteChannel
import io.ktor.util.cio.writeChannel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.io.cancel
import kotlinx.coroutines.io.close
import java.io.File
import kotlin.coroutines.CoroutineContext

Expand Down Expand Up @@ -94,9 +92,9 @@ class PullFileRequest(
val header = headerBuffer.copyOfRange(0, 4)
when {
header.contentEquals(Const.Message.DONE) -> {
channel.close()
readChannel.cancel()
writeChannel.close()
channel.close(null)
readChannel.cancel(null)
writeChannel.close(null)
return 1.0
}
header.contentEquals(Const.Message.DATA) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import com.malinskiy.adam.transport.AndroidReadChannel
import com.malinskiy.adam.transport.AndroidWriteChannel
import io.ktor.util.cio.readChannel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.io.cancel
import kotlinx.coroutines.io.close
import java.io.File
import kotlin.coroutines.CoroutineContext

Expand Down Expand Up @@ -65,12 +63,12 @@ class PushFileRequest(
val available = channel.readAvailable(buffer, 8, Const.MAX_FILE_PACKET_LENGTH)
return when {
available < 0 -> {
channel.cancel()
channel.cancel(null)
Const.Message.DONE.copyInto(buffer)
(local.lastModified() / 1000).toInt().toByteArray().copyInto(buffer, destinationOffset = 4)
writeChannel.write(request = buffer, length = 8)
readChannel.cancel()
writeChannel.close()
readChannel.cancel(null)
writeChannel.close(null)
1.0
}
available > 0 -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import com.malinskiy.adam.Const
import com.malinskiy.adam.request.async.AsyncChannelRequest
import com.malinskiy.adam.transport.AndroidReadChannel
import com.malinskiy.adam.transport.AndroidWriteChannel
import kotlinx.coroutines.io.cancel
import kotlinx.coroutines.io.close

/**
* @see https://android.googlesource.com/platform/frameworks/base/+/master/cmds/am/src/com/android/commands/am/Am.java#155
Expand All @@ -47,8 +45,8 @@ class TestRunnerRequest(
String(buffer, 0, available, Const.DEFAULT_TRANSPORT_ENCODING)
}
available < 0 -> {
readChannel.cancel()
writeChannel.close()
readChannel.cancel(null)
writeChannel.close(null)
return ""
}
else -> ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.malinskiy.adam.transport
import com.malinskiy.adam.Const
import com.malinskiy.adam.log.AdamLogging
import com.malinskiy.adam.request.TransportResponse
import kotlinx.coroutines.io.ByteReadChannel
import io.ktor.utils.io.ByteReadChannel

class AndroidReadChannel(private val delegate: ByteReadChannel) : ByteReadChannel by delegate {
suspend fun read(): TransportResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.malinskiy.adam.transport

import kotlinx.coroutines.io.ByteWriteChannel
import io.ktor.utils.io.ByteWriteChannel
import java.nio.ByteBuffer

class AndroidWriteChannel(private val delegate: ByteWriteChannel) : ByteWriteChannel by delegate {
Expand Down

0 comments on commit 5b48c1b

Please sign in to comment.