This project is a playground for exploring how to use Kotlin for building a multi-platform application that contains JVM and Angular UIs.
The domain logic calculates Fibonacci numbers and is by intention as simple as possible.
Links:
- Multiplatform setup: https://github.com/dhakehurst/example.kotlin.angular
- Kotlin and Typescript integration: https://www.itemis.com/en/kotlin-typescript-integration/
- Developement with IntelliJ IDEA 2019.3
- Gradle project with multiple subprojects
- Kotlin multiplatform setup for JVM and JS targets
- mockk for mocking in tests
- Entire domain logic written in Kotlin
- JVM Swing UI built with ShadowJar and started by gradle "run" task
- Angular UI using Kotlin domain logic in the browser
In a console (using the built shadow JAR):
java -jar .gradle-build/ui/libs/ui-1.0.0-all.jar
Or with the gradle run
task (also using the shadow JAR):
gradlew :ui:run
Or with an IntelliJ IDEA run configuration: Navigate in IntelliJ IDEA to ../ui/jvm/src/main/ch/flandreas/techstack/ui /FibonacciUI and execute "Run FibonacciUI" from the popup menu, which will generate a new run configuration.
In a console:
cd ui/js/src/angular
ng serve --open
- Resources are not part of IntelliJ Kotlin (JVM) run configuration classpath. See https://youtrack.jetbrains.com /issue/KT-24463. Use gradle task to copy the resources to the appropriate build directory.
- The "application" plugin can't be used, because the "main" source set is hardcoded in ApplicationPlugin, but the source set of the artifact is "jvmMain". See gradle/gradle#8113. Hence, the ShadowJar plugin can't be used based on the application plugin, but must be configured separately. The same applies to running the Java application.
- Feature: Build a combined JAR with all Java classes and resources (non-fat JAR)
- Bug: jvmJar contains Angular artifacts
- Include backend REST endpoint