Skip to content
This repository has been archived by the owner on Aug 10, 2024. It is now read-only.

Commit

Permalink
update to latest kotlin RC
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Oct 2, 2018
1 parent a9863af commit ce19e02
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 25 deletions.
21 changes: 13 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ allprojects {
maven {
url "https://plugins.gradle.org/m2/"
}
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
}
}
}

buildscript {
ext.kotlin_version = '1.2.60'
ext.kotlin_version = '1.3.0-rc-57'
ext.dokka_version = '0.9.17'
ext.ktor_version = '0.9.3'
ext.ktor_version = '0.9.5-rc13'

repositories {
jcenter()
Expand All @@ -22,6 +23,8 @@ buildscript {
maven {
url "https://plugins.gradle.org/m2/"
}
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }

}


Expand All @@ -35,7 +38,7 @@ buildscript {
}

group 'io.kweb'
version '0.3.4'
version '0.3.5'

apply plugin: 'java'

Expand Down Expand Up @@ -68,6 +71,8 @@ repositories {
}
maven { url "http://dl.bintray.com/jetbrains/spek" }
jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }

}

configurations {
Expand All @@ -76,7 +81,7 @@ configurations {

configurations.all {
resolutionStrategy {
force 'org.jetbrains.kotlinx:kotlinx-coroutines-io:0.23.4'
// force 'org.jetbrains.kotlinx:kotlinx-coroutines-io:0.30.0-eap13'
}
}

Expand Down Expand Up @@ -111,9 +116,9 @@ dependencies {
//////////////////////////////
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.23.4'
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:0.23.4'
// compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.30.0-eap13'
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:0.30.0-eap13'

// TODO: This should be testCompile
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.+'
Expand All @@ -139,7 +144,7 @@ dependencies {
compile 'io.github.microutils:kotlin-logging:1.5.4'
compile("org.reflections:reflections:0.9.11")

compile 'com.github.kwebio:shoebox:0.2.19'
compile 'com.github.kwebio:shoebox:0.2.20'

compile 'com.github.yamamotoj:cached-property-kotlin:0.1.0'

Expand Down
10 changes: 5 additions & 5 deletions src/main/kotlin/io/kweb/Kweb.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package io.kweb

import com.github.salomonbrys.kotson.fromJson
import io.ktor.application.*
import io.ktor.content.*
import io.ktor.features.*
import io.ktor.http.*
import io.ktor.http.cio.websocket.Frame.Text
import io.ktor.http.cio.websocket.readText
import io.ktor.http.content.*
import io.ktor.request.*
import io.ktor.response.respondText
import io.ktor.routing.*
Expand All @@ -18,8 +18,8 @@ import io.kweb.browserConnection.KwebClientConnection
import io.kweb.browserConnection.KwebClientConnection.Caching
import io.kweb.dev.hotswap.KwebHotswapPlugin
import io.kweb.plugins.KWebPlugin
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.consumeEach
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.consumeEach
import org.apache.commons.io.IOUtils
import java.io.*
import java.time.*
Expand Down Expand Up @@ -207,7 +207,7 @@ class Kweb(val port: Int,

webSocket("/ws") {

val hello = gson.fromJson<Client2ServerMessage>((incoming.receive() as Text).readText())
val hello = gson.fromJson<Client2ServerMessage>((incoming as Text).readText())


if (hello.hello == null) {
Expand Down Expand Up @@ -304,7 +304,7 @@ class Kweb(val port: Int,
}
}

private fun refreshAllPages() = async(CommonPool) {
private fun refreshAllPages() = launch(Dispatchers.Default) {
for (client in clientState.values) {
val message = Server2ClientMessage(
yourId = client.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package io.kweb.browserConnection

import io.ktor.http.cio.websocket.*
import io.ktor.http.cio.websocket.Frame.Text
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
import mu.KotlinLogging
import java.util.concurrent.ConcurrentLinkedQueue

Expand All @@ -20,18 +20,16 @@ sealed class KwebClientConnection {

init {
launch {
sendBuffer.consumeEach { channel.outgoing.send(it) }
sendBuffer.consumeEach { channel.send(it) }
}

}

override fun send(message: String) {
logger.debug("Start message send: $message on channel isFull: ${channel.outgoing.isFull} isClosedForSend: ${channel.outgoing.isClosedForSend}")
runBlocking {
sendBuffer.send(Text(message))
}
sendCount++
logger.debug("End message send: $message")
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/kotlin/io/kweb/demos/async/async.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package io.kweb.demos.async
import io.kweb.Kweb
import io.kweb.dom.element.creation.tags.p
import io.kweb.dom.element.new
import kotlinx.coroutines.experimental.future.await
import kotlinx.coroutines.experimental.future.future
import kotlinx.coroutines.future.*
import mu.KotlinLogging

/**
Expand Down
9 changes: 6 additions & 3 deletions src/main/kotlin/io/kweb/demos/todo/todoApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ import io.kweb.routing.*
import io.kweb.state.KVar
import io.kweb.state.persistent.*
import io.mola.galimatias.URL
import kotlinx.coroutines.experimental.async
import kotlinx.coroutines.experimental.future.await
import kotlinx.coroutines.async
import kotlinx.coroutines.async
import kotlinx.coroutines.future.await
import kotlinx.coroutines.future.await
import mu.KotlinLogging
import sun.plugin.util.PluginSysUtil.execute
import java.time.Instant
import java.util.*
import io.kweb.plugins.semanticUI.semantic as s

private val logger = KotlinLogging.logger {}
Expand All @@ -30,7 +34,6 @@ fun main(args: Array<String>) {
* */
Kweb(port = 8091, debug = true, plugins = plugins) {
doc.body.new {

/** Kweb allows you to modularize your code however suits your needs
best. Here I use an extension function defined elsewhere to
draw some common outer page DOM elements */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package io.kweb.dom.element.storage

import io.kweb.Kweb
import io.kweb.dom.Document
import kotlinx.coroutines.experimental.future.await
import kotlinx.coroutines.experimental.future.future
import kotlinx.coroutines.future.await
import kotlinx.coroutines.future.future
import java.util.concurrent.CompletableFuture

/**
Expand Down

0 comments on commit ce19e02

Please sign in to comment.