This folder contains both the Kotlin/Native runtime and Kotlin/Native stdlib.
The common code lives in libraries/stdlib. Native-specific sources are:
kotlinx.cinterop package:kotlin-native:runtime:stdlibBuildTask builds the standard library. :native:native.tests:stdlibTest will run the standard library tests.
The sources should follow the coding convention.
For IDE support, use :kotlin-native:compdb to generate the Compilation Database in kotlin-native/compile_commands.json which is supported by CLion and clangd.
:kotlin-native:runtime:hostRuntime builds the runtime for the current host. :kotlin-native:runtime:<target>Runtime can be used to build for the specific target, or :kotlin-native:runtime:assemble to build for all supported targets.
:kotlin-native:runtime:hostRuntimeTests runs the tests for the current host (the tests will also be rerun with all supported sanitizers). Use -Pgtest_filter= to filter which tests to run (uses Google Test filter syntax). Use -Pgtest_timeout= to limit how much time each test executable can take (accepts values like 30s, 1h15m20s, and so on).
To help with code formatting, .clang-format file is placed in this folder. :kotlin-native:libllvmext:clangFormat task can be used to run git-clang-format -f $(git merge-base origin/master HEAD) -- kotlin-native/libllvmext/, which will format only the changed files. The task accepts optional --parent=<branch> (to specify a branch other than origin/master) and --interactive (which adds -p flag to git-clang-format to interactively accept or reject formatting patches).
The runtime is split into multiple modules: the main runtime and a number of optional modules (e.g. objc for ObjC interop support or cms GC with Concurrent Mark&Sweep GC implementation).
The main module contains:
ObjC* and swiftExportRuntime folder)KotlinBase definition that might also get renamed in the final binary; but also used by Swift Exportcompiler::getSourceInfo in CompilerConstants.hppgoogletest and googlemock are fetched from their repo