4

In Kotlin 1.3.20 and Gradle 4.10.2, it is possible to hot reload js files with the following in Gradle:

task watch {
    inputs.files 'src/main'
    doLast {
        compileKotlin2Js.execute()
    }
}

However, then we get a warning of:

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.

With Kotlin 1.3.20 / Gradle 5.1.1, the deprecation warning goes away, but the compileKotlin2Js.execute() results in the following error:

Parameter specified as non-null is null: method org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute, parameter inputs

Is there a way to compileKotlin2Js.execute() for hot-reloading js files with Kotlin 1.3.20 / Gradle 5.1.1?

AlexO
  • 1,311
  • 12
  • 18

1 Answers1

0

Answering own question, got Kotlin 1.3.72 multiplatform project working with Gradle 6.3 with Kotlin DSL: https://github.com/alexoooo/sample-multiplatform-boot-react

When developing, there are two processes:

  1. Java back-end from IDE, run with: --server.port=8081
  2. Webpack proxy with hot-reload: gradlew -t :proj-js:run

Note that Kotlin multiplatform projects are currently experimental, and some of the details are likely to change as the new IR is introduced: https://blog.jetbrains.com/kotlin/2020/03/kotlin-1-4-m1-released/

AlexO
  • 1,311
  • 12
  • 18