*98f5c5aa95- (tag: build-1.4.0-dev-588) JVM_IR: Preserve annotations on inline class replacement methods. (4 days ago) <Mads Ager> *e7835fecfc- (tag: build-1.4.0-dev-587) JVM_IR: fix a couple of inline class reflection issues. (4 days ago) <Mads Ager> *2ebb797e61- (tag: build-1.4.0-dev-582) JVM_IR: Remove accessor for internal inline class properties. (4 days ago) <Mads Ager> *d27593aeda- (tag: build-1.4.0-dev-577) PSI2IR: SAM conversion in method arguments of out-projected Java classes (4 days ago) <Dmitry Petrov> *a55bce801e- (tag: build-1.4.0-dev-575) Update year in the license to 2020 (4 days ago) <Alexander Udalov> *e0b9ffa780- Regenerate builtins sources (4 days ago) <Alexander Udalov> *d73e6c855b- (tag: build-1.4.0-dev-565) Regenerate FIR tree (5 days ago) <Alexander Udalov> *8a4510c21b- (tag: build-1.4.0-dev-563) Regenerate tests (5 days ago) <Alexander Udalov> *a55296db26- (tag: build-1.4.0-dev-556) Mute flaky GradleKtsImportTest.testCompositeBuild (7 days ago) <Vyacheslav Gerasimov> *1b00996c86- (tag: build-1.4.0-dev-553) Mute failing test-kotlin-version-in-manifest (7 days ago) <Vyacheslav Gerasimov> *8054e2960e- (tag: build-1.4.0-dev-551) PSI2IR: Post-process return expressions based on expected return type (7 days ago) <Dmitry Petrov> *0e4e5ac287- (tag: build-1.4.0-dev-547) Update nullability assertion tests that use newer Java features (7 days ago) <Dmitry Petrov> *d622542824- (tag: build-1.4.0-dev-536) PSI2IR: Fix delegated members generation (8 days ago) <Dmitry Petrov> *cc0b231b3b- (tag: build-1.4.0-dev-534) Convert SyntheticMethodForAnnotatedPropertyGenTest to a box test (8 days ago) <Alexander Udalov> *8f30b25b24- Minor, fix some codegen tests for language version 1.4 (8 days ago) <Alexander Udalov> *e2a42446ed- Use getter names for $annotations methods in most codegen tests (8 days ago) <Alexander Udalov> *330dd789de- (tag: build-1.4.0-dev-524) Minor: mute test in FIR+JVM_IR (8 days ago) <Dmitry Petrov> *c7d39b612c- (tag: build-1.4.0-dev-521) Simplify adding Kotlin sdk by inlining internals of ProjectSdksModel (8 days ago) <Nikolay Krasko> *70067bc9bf- Better fix for compiler plugin test initialization (8 days ago) <Nikolay Krasko> *1715f1a864- (tag: build-1.4.0-dev-517) [FIR] Refactoring: create use-site scopes via scope provider (8 days ago) <Simon Ogorodnik> *5f08fe88a5- [FIR] Move ScopeSession to fir:tree (8 days ago) <Mikhail Glukhikh> *98bf0e278f- (origin/rr/pdn_jvmir_vararg) Fix problem with empty vararg of boxed primitives in JVM_IR (8 days ago) <Dmitry Petrov> *0667ee9796- Minor: optimize imports (8 days ago) <Dmitry Petrov> *76e7a9ba4a- Generate instructions as text in case of other exceptions (8 days ago) <Dmitry Petrov> *4b6202c902- (tag: build-1.4.0-dev-515, tag: build-1.4.0-dev-511) JVM_IR. Support inlining of bound CR (8 days ago) <Mikhael Bogdanov>
Kotlin/Native
Kotlin/Native is an LLVM backend for the Kotlin compiler, runtime implementation, and native code generation facility using the LLVM toolchain.
Kotlin/Native is primarily designed to allow compilation for platforms where virtual machines are not desirable or possible (such as iOS or embedded targets), or where a developer is willing to produce a reasonably-sized self-contained program without the need to ship an additional execution runtime.
Prerequisites:
- install JDK for your platform, instead of JRE. The build requires
tools.jar, which is not included in JRE; - on macOS install Xcode 11
- on Fedora 26+
yum install ncurses-compat-libsmay be needed - on recent Ubuntu
apt install libncurses5is needed
To compile from sources use following steps:
First, download dependencies:
./gradlew dependencies:update
Then, build the compiler and libraries:
./gradlew bundle
To build with experimental targets support compile with -Porg.jetbrains.kotlin.native.experimentalTargets.
The build can take about an hour on a Macbook Pro. To run a shorter build with only the host compiler and libraries, run:
./gradlew dist distPlatformLibs
To include Kotlin compiler in composite build and build
against it, use the kotlinProjectPath project property:
./gradlew dist -PkotlinProjectPath=path/to/kotlin/project
It's possible to include in a composite build both Kotlin compiler and Kotlin/Native Shared simultaneously.
After that, you should be able to compile your programs like this:
export PATH=./dist/bin:$PATH
kotlinc hello.kt -o hello
For an optimized compilation, use -opt:
kotlinc hello.kt -o hello -opt
For tests, use:
./gradlew backend.native:tests:run
To generate interoperability stubs, create a library definition file
(refer to samples/tetris/.../sdl.def), and run the cinterop tool like this:
cinterop -def lib.def
See the provided samples and INTEROP.md for more details.
The Interop tool generates a library in the .klib library format. See LIBRARIES.md
for more details on this file format.