Skip to content

kotlin_apple_framework

Kotlin/Native framework for Apple platforms.

Description

Compiles Kotlin sources with kotlinc-native -produce framework and emits an Apple framework provider. Apple application, framework, and test bundle targets consume the framework through their normal deps edge, add it to the link line with -framework, and embed it where the bundle target supports framework embedding.

Attributes

AttributeTypeRequiredDefaultDescription
platformstringyesApple platform such as ios, macos, tvos, or watchos
sdk_variantstringnosimulatorsimulator or device; ignored for macOS target inference
archstringnohost archTarget architecture used for Kotlin/Native target inference
targetstringnoinferredKotlin/Native target such as ios_arm64, ios_simulator_arm64, or macos_arm64
product_namestringnotarget nameFramework product name
module_namestringnoproduct nameSwift/ObjC module name exported by the framework
kotlinc_nativestringnoPATHOverride kotlinc-native path
kotlin_homestringnoKotlin/Native installation root used to find bin/kotlinc-native
java_homestringnoJAVA_HOMEJava runtime home exposed to kotlinc-native
konan_data_dirstringnoOptional Kotlin/Native cache directory exposed as KONAN_DATA_DIR
compiler_optslist<string>no[]Additional kotlinc-native arguments

Dependency Edges

This target kind currently declares no dep edges.

Providers

The target emits kotlin_native_framework, apple_framework, apple_bundle, and native_linkable.

Capabilities

CapabilityOutput groups
builddefault, framework

Provider Record

FieldTypeMeaning
label_idstringCanonical target id
platformstringApple platform
sdk_variantstringApple SDK variant used for target inference
archstringTarget architecture
targetstringKotlin/Native target passed to the compiler
framework_pathstringBuilt framework directory
framework_module_namestringModule name linked by Apple consumers
framework_fileslist<string>Framework file outputs tracked by the action graph
transitive_frameworkslist<string>Frameworks exposed to downstream Apple targets

Outputs

OutputLocation
Framework bundle.once/out/<target>/<product_name>.framework

Example

toml
[[target]]
name = "SharedKotlin"
kind = "kotlin_apple_framework"
srcs = ["Sources/**/*.kt"]

[target.attrs]
platform = "ios"
sdk_variant = "simulator"
arch = "arm64"
module_name = "SharedKotlin"

Released under an open-source license.