Coder Social home page Coder Social logo

kotlin-mpp-angular's Introduction

kotlin-multiplatform-angular

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:

Environment

  • 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

Usage

Run JVM application

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.

Run Angular App

In a console:

cd ui/js/src/angular
ng serve --open

Solved issues

  1. 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.
  2. 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.

Open issues

  • Feature: Build a combined JAR with all Java classes and resources (non-fat JAR)
  • Bug: jvmJar contains Angular artifacts

Future extensions

  1. Include backend REST endpoint

kotlin-mpp-angular's People

Contributors

flandreas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.