To try the alpha, so far I have: - Updated ktor d...
# ktor
m
To try the alpha, so far I have: - Updated ktor dependency version - Added the repo
maven { url '<https://dl.bintray.com/kotlin/kotlin-eap>' }
- Specified the kotlin version on the stdlib dependency (instead of letting the 1.2.71 plugin set it) - Specified
kotlin-reflect
dependency to set matching version (transitive dependency from
jackson-module-kotlin
) - Changed imports for coroutine types - Also in gradle, added languageVersion and apiVersion:
Copy code
compileKotlin {
    kotlinOptions {
      jvmTarget = "1.8"
      languageVersion = "1.3"
      apiVersion = "1.3"
    }
  }
  compileTestKotlin {
    kotlinOptions {
      jvmTarget = "1.8"
      languageVersion = "1.3"
      apiVersion = "1.3"
    }
  }
With that, I get:
Copy code
w: Language version 1.3 is experimental, there are no backwards compatibility guarantees for new language and library features
and
Copy code
e: java.lang.IllegalStateException: Backend Internal error: Exception during code generation
Cause: Back-end (JVM) Internal error: Error type encountered: [ERROR : For SuccessOrFailure] (ErrorType).
Cause: Error type encountered: [ERROR : For SuccessOrFailure] (ErrorType).
File being compiled at position: (28,42) in /home/mbp/dev/.../Foo.kt
The root cause was thrown at: KotlinTypeMapper.java:114
File being compiled at position: file:///home/mbp/dev/.../Foo.kt
The root cause was thrown at: ExpressionCodegen.java:320
        at org.jetbrains.kotlin.codegen.CompilationErrorHandler.lambda$static$0(CompilationErrorHandler.java:24)
        at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:74)
        at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:97)
        at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generateModule(CodegenFactory.kt:68)
        at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.doGenerateFiles(KotlinCodegenFacade.java:47)
        at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:39)
Am I missing a step?
e
Could you provide build.gradle?
m
It's a multiproject build, what parts would you like?
e
Do you use
kotlin-multiplatform
or
kotlin-platform-*
?
m
nope
e
root project with buildscript would be nice
m
That particular line of code (I can share more if needed) is:
return withContext(ioDispatcher) {
where
ioDispatcher
is a CoroutineDispatcher
e
what version coroutines do you use?
m
root:
Copy code
plugins {
  id "org.jetbrains.kotlin.jvm" version "1.2.71" apply false
  id "com.dorongold.task-tree" version "1.3"
  id "com.github.ben-manes.versions" version "0.20.0" apply false
}

ext {
  deps = [
      ktor      : '1.0.0-alpha-1',
      kotlin    : '1.3.0-rc-131',
      postgresql: '42.2.5',
      jackson   : '2.9.7',
      slf4j     : '1.7.25',
      junit     : '5.3.1',
      ahc       : '2.5.4',
      urlBuilder: '1.1.1',
      jaxb      : '2.3.0.1',
      jaxbApi   : '2.3.0',
      activation: '1.2.0'
  ]
}

repositories {
  jcenter()
}

subprojects {
  apply plugin: "org.jetbrains.kotlin.jvm"
  apply plugin: "com.github.ben-manes.versions"

  repositories {
    jcenter()
    maven { url '<https://dl.bintray.com/kotlin/kotlin-eap>' }
  }

  dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$deps.kotlin"

    testCompile "org.junit.jupiter:junit-jupiter-api:$deps.junit"
    testImplementation "org.junit.jupiter:junit-jupiter-api:$deps.junit"
    testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$deps.junit"
  }

  configurations.all {
    // don't let commons logging creep into the classpath; use jcl-over-slf4j instead
    exclude group: 'commons-logging', module: 'commons-logging'
  }

  test {
    useJUnitPlatform()
  }

  compileKotlin {
    kotlinOptions {
      jvmTarget = "1.8"
      languageVersion = "1.3"
      apiVersion = "1.3"
    }
  }
  compileTestKotlin {
    kotlinOptions {
      jvmTarget = "1.8"
      languageVersion = "1.3"
      apiVersion = "1.3"
    }
  }
}
I haven't set a version; just letting the ktor alpha do it
e
There is no ktor repo as I see.
m
This is how it's being resolved: | \--- io.ktorktor websockets1.0.0-alpha-1 | +--- org.jetbrains.kotlinkotlin reflect1.3.0-rc-131 (*) | +--- org.jetbrains.kotlinkotlin stdlib1.3.0-rc-131 (*) | +--- org.jetbrains.kotlinkotlin stdlib jdk71.3.0-rc-131 (*) | +--- org.jetbrains.kotlinkotlin stdlib jdk81.3.0-rc-131 (*) | +--- org.jetbrains.kotlinxkotlinx coroutines core0.30.2-eap13 (*) | +--- org.jetbrains.kotlinxkotlinx coroutines jdk80.30.2-eap13 (*) | +--- org.jetbrains.kotlinxkotlinx io jvm0.1.0-alpha-17-rc13 (*) | +--- org.jetbrains.kotlinxkotlinx coroutines io jvm0.1.0-alpha-17-rc13 (*) ```
Yep, more coming -- here's the subproject that uses ktor
Copy code
import org.flywaydb.gradle.task.FlywayCleanTask
import org.flywaydb.gradle.task.FlywayMigrateTask

buildscript {
  dependencies {
    classpath "org.postgresql:postgresql:$deps.postgresql"
    // used by jooq gradle plugin to write config
    classpath "com.sun.xml.bind:jaxb-impl:$deps.jaxb"
    classpath "com.sun.xml.bind:jaxb-core:$deps.jaxb"
    classpath "com.sun.activation:javax.activation:$deps.activation"
  }
}

plugins {
  id 'application'
  id "org.flywaydb.flyway" version "5.2.0"
  id "nu.studer.jooq" version "3.0.2"
}

repositories {
  maven { url '<https://dl.bintray.com/kotlin/ktor>' }
  maven { url = '<https://dl.bintray.com/michaelbull/maven>' }
}

dependencies {
  compile "io.ktor:ktor-server-core:$deps.ktor"
  compile "io.ktor:ktor-server-netty:$deps.ktor"
  compile "io.ktor:ktor-jackson:$deps.ktor"
  compile "io.ktor:ktor-server-sessions:$deps.ktor"
  compile "io.ktor:ktor-auth:$deps.ktor"
  compile "io.ktor:ktor-html-builder:$deps.ktor"
  testCompile("io.ktor:ktor-server-test-host:$deps.ktor") {
    // this depends on logback-classic, which ends up duplicated in IntelliJ's classpath.
    // Gradle gets it right, but to avoid angry warnings in IntelliJ tests, we'll exclude it
    exclude group: 'ch.qos.logback', module: 'logback-classic'
  }

  compile "com.fasterxml.jackson.core:jackson-databind:$deps.jackson"
  compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$deps.jackson"
  compile "com.fasterxml.jackson.module:jackson-module-kotlin:$deps.jackson"
  compile "com.fasterxml.jackson.dataformat:jackson-dataformat-csv:$deps.jackson"

  runtime "ch.qos.logback:logback-classic:1.2.3"
  runtime "org.slf4j:jcl-over-slf4j:$deps.slf4j"
  compile "org.slf4j:jul-to-slf4j:$deps.slf4j"

  compile 'com.google.inject:guice:4.2.1'

  compile 'org.skife.config:config-magic:0.17'
  compile 'commons-configuration:commons-configuration:1.10'

  compile 'com.zaxxer:HikariCP:3.2.0'
  compile 'org.jooq:jooq'
  runtime "org.postgresql:postgresql:$deps.postgresql"
  jooqRuntime "org.postgresql:postgresql:$deps.postgresql"
  jooqRuntime "com.sun.xml.bind:jaxb-impl:$deps.jaxb"
  jooqRuntime "com.sun.xml.bind:jaxb-core:$deps.jaxb"
  jooqRuntime "javax.xml.bind:jaxb-api:$deps.jaxbApi"
  jooqRuntime "com.sun.activation:javax.activation:$deps.activation"

  compile 'com.google.guava:guava:26.0-jre'

  testCompile 'com.h2database:h2:1.4.197'

  compile 'io.lettuce:lettuce-core:5.1.0.RELEASE'

  compile project(':authrocket-client')
  compile 'com.auth0:java-jwt:3.4.0'
  compile('com.sendgrid:sendgrid-java:4.2.1') {
    // goddamnit sendgrid if you're going to make your own http client then at least don't screw up the dependencies
    exclude module: 'mockito-core'
  }

  compile 'com.michael-bull.kotlin-result:kotlin-result:1.1.0'
  compile 'org.mpierce.ktor.csrf:ktor-csrf:0.3.2'

  compile 'com.lambdaworks:scrypt:1.4.0'

  compile 'org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.11'

  compile 'com.google.cloud:google-cloud-storage:1.48.0'
  compile 'com.google.cloud.sql:postgres-socket-factory:1.0.11'
  // for its test helpers so we can test GCS with a local emulator
  testCompile 'com.google.cloud:google-cloud-nio:0.65.0-alpha'

  compile 'azadev.kotlin:aza-kotlin-css:1.0'

  compile project(':trello-client')
}
(snipped out a bunch of unrelated flyway/ jooq database wrangling)
c
why do you use the kotlin 1.2.7 gradle plugin?
m
Should I not be? I didn't see an updated version on the gradle plugins repo. Do I need a separate repo for that?
c
no just use 1.3.0-rc-131 as version for the gradle plugin too
m
That version doesn't exist in the default repo: https://plugins.gradle.org/plugin/org.jetbrains.kotlin.jvm
e
1.3.0-rc-131 is published here
maven { url '<https://dl.bintray.com/kotlin/kotlin-eap>' }
m
OK, now the compiler is no longer crashing. 🙂 Is there a page documenting all the steps to try this prerelease stuff?
d
I’m working on that page 📝
👍 2