Coder Social home page Coder Social logo

kotlin-multiplatform-recipes's Introduction

NO LONGER RELEVANT

Multi-platform Kotlin has undergone signifcant changes after I stopped updating this. Please see the current documentation.

Recipes for Multi-Platform Kotlin Modules

This project is a testbed for multi-platform Kotlin modules. It shows how you could implement modules that have code that is common for all platforms, and that may need platform-specific code for (some of) its types and functions.

Note that you have to change settings in IntelliJ IDEA to be able to build the project and run the examples from your IDE. See the item about IntelliJ IDEA under current issues below.

Recipes for unit tests for common and platform-specific code are available. Execute the following command to run the Java tests. The test output can be found in jvm/build/reports/tests/test/index.html:

./gradlew :jvm:test

Execute the following command to run the JavaScript tests. The test output can be found in the build output:

./gradlew :js:test

Current Issues

Not everything is working as it should as multi-platform support is still being developed. This is the list of known issues:

  • IntelliJ IDEA support using stable plug-ins is broken. The experience should be better with an EAP or development build, and using the associated Gradle plug-in and standard library from the Kotlin development repository:
    • You have to build and run the examples using the Gradle runner by enabling the following setting: Settings › Build, Execution, Deployment › Build Tools › Gradle › Runner › Delegate IDE build/run actions to gradle), or use the command line. To run the Java app:

        ./gradlew :jvm-app:run
      

      Or to run the JavaScript app:

        ./gradlew :js-app:runDceKotlinJs
      

      And open js-app/JsApp.html. The JavaScript has been mapped to the sources of the Kotlin standard library and module js, so you can set breakpoints in Kotlin code. Note that for some reason, the source maps are not available if you open the browser from within IntelliJ. Copy the file path of jsApp.html and paste that in the address bar of your browser.

      If you want to use the minified JavaScript run:

        ./gradlew :js-app:minifyJs
      

      And open js-app/JsApp-minified.html.

kotlin-multiplatform-recipes's People

Contributors

jstuyts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kotlin-multiplatform-recipes's Issues

Emphasize build instructions

Kotlin: Modifier 'impl' is only applicable to members that are initially declared in platform-independent code

Took me few times to read README.md to find the way to make build pass.

Test dependencies delegation

For example I have a project with modules:

  • jvm(jvm platform), expectedBy project(':common')
  • js(js platform), expectedBy project(':common')
  • common(common platform), compile project(':util')
  • util(common platform)

Then I want to add tests to util module, but the tests don't appear when i run :js:test. So i want to delegate tests. Thanks.

Add API docs and generation of HTML files

The Kotlin API documentation has very nice drop-down menus to select the platform and the API version. This project should show how you can generate the same for your own project. Add API docs to the types, properties and functions, and generate HTML for the API docs in the build.

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.