Universal Kotlin is a project that aims to run on the most popular platforms using just Kotlin. Also, one of its goals is to use shared code from the common modules and libraries in all other ones.
- buildSrc: Kotlin DSL module to help with the build scripts
- common
- multiple_sources: Common module using multiple sources folders
- single_source: Common module using just a single source folders
- library
- multiple_sources: Multiplatform library using multiple sources folders
- single_source: Multiplatform library using just a single source folders
- application
- backend
- js
- express: Express API application (not yet implemented)
- jvm
- spring_boot: Spring Boot API application
- js
- browser
- desktop
- jvm
- tornado_fx: TornadoFX application for Windows, Linux and Mac
- jvm
- mobile
- jvm
- android: Android application
- native
- apple
- ios
- ios_x64_copying_framework: iOS X64 application copying a Kotlin framework
- ios_x64_framework: iOS X64 Kotlin framework only
- ios_x64_with_framework: iOS X64 application with a Kotlin framework
- ios_x64_without_framework: iOS X64 application using only Kotlin
- ios
- apple
- jvm
- script
- jvm
- script: Script application running through KScript (not using common modules yet)
- jvm
- television
- native
- apple
- tvos
- tvos_x64: tvOS X64 application (not yet implemented)
- tvos
- apple
- native
- terminal
- jvm
- terminal: Terminal application
- jvm
- watch
- native
- apple
- watchos
- watchos_x64: watchOS X64 application (not yet implemented)
- watchos
- apple
- native
- backend
- plugin
- gradle: Gradle plugin (not using common modules)
This structure is also available in this diagram:
Other diagrams can be found in the diagrams folder.
These instructions will get you a copy of the project up and running on your local machine.
The CIs configurations can be found at:
The project prerequisites are:
Note that JavaFX support is needed for the TornadoFX module, if you are using OpenJDK, consider changing to Oracle or Zulu (FX) for a more straightforward configuration.
Specific prerequisites:
- Android SDK or Android Studio (if you're going to use the android module.)
- XCode (if you're going to use the iOS modules.)
- KScript (if you're going to use the script module.)
- Konan (for Kotlin Native modules, but this dependency will be automatically installed when building these modules.)
If you don't have Java
or KScript
installed yet, consider to use SDKMAN!
to install these packages on a straightforward way.
If you don't have the Android SDK
, go to this link
and download the command line tools or Android Studio
.
If you don't have XCode
you can download it from the Apple Store.
- Clone:
git clone https://github.com/funttastic/universal_kotlin.git
cd universal_kotlin
- Configure:
If you are going to use the Android module, it is needed to configure ANDROID_HOME
as system environment variable:
export ANDROID_HOME="/Users/<username>/Library/Android/sdk"
or create a local.properties
file and configure it appropriately. A template is available at
local.properties.template
.
Also the Android module can be disabled directly in the com.company.team.project.dsl.model.enum_.ModuleEnum
enum
or exporting the disabledModules
environment variable:
export disabledModules="application-mobile-jvm-android"
- Build:
./gradlew build
Obs.: since this build will be enabling all modules, this could take too long. But you can enable or disable modules going to this class inside the buildSrc module:
com.company.team.project.dsl.model.enum_.ModuleEnum
Also you can enable or disable modules using environment variables (enabledModules
and disabledModules
).
Check the common-multiple_sources module for an example.
The buildSrc
method responsible to define which modules will be enabled and which don't is this one:
com.company.team.project.dsl.Util.initialize
To run the tests/checks do:
./gradlew check
or
./gradlew test
Note that the check
task depends on the test
one (reference).
Please refer to the readme
of the correspondent module that you would like to run.
Note that the modules themselves have many other dependencies and you can find them in their build.gradle.kts
files.
Please take a look at this documentation file for the Frequently Asked Questions.
All contributions are very welcome. Contribute!!!
Danilo Araújo Silva
We would like to thank all Kotlin's contributors, which are doing a very good job. Thanks a lot!
Licensed under the Apache License 2.0.
See license for more information.