Test` containing product and test sources for this platform. Common for all
+platforms sources are located in `commonMain` and `commonTest` source sets created by default. More information about source sets can be found
+[here](https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#configuring-source-sets).
+
+
+
+```groovy
+kotlin {
+ sourceSets {
+ // Adding target-independent sources.
+ commonMain.kotlin.srcDirs += file("src/main/mySources")
+
+ // Adding Linux-specific code.
+ linuxX64Main.kotlin.srcDirs += file("src/main/linux")
+ }
+}
+```
+
+
+
+### Managing dependencies
+
+With the `kotlin-platform-native` plugin dependencies are configured in a traditional for Gradle way by grouping them into configurations
+using the project `dependencies` block:
+
+
+
+```groovy
+dependencies {
+ implementation 'org.sample.test:mylibrary:1.0'
+ testImplementation 'org.sample.test:testlibrary:1.0'
+}
+```
+
+
+
+The `kotlin-multiplatform` plugin also uses configurations under the hood but it also provides a `dependencies` block for each source set
+allowing configuring dependencies of this sources set:
+
+
+
+```groovy
+kotlin.sourceSets {
+ commonMain {
+ dependencies {
+ implementation("org.sample.test:mylibrary:1.0")
+ }
+ }
+
+ commonTest {
+ dependencies {
+ implementation("org.sample.test:testlibrary:1.0")
+ }
+ }
+}
+```
+
+
+
+Note that a module referenced by a dependency declared for `commonMain` or `commonTest` source set must be published using the `kotlin-multiplatform` plugin.
+If you want to use libraries published by the `kotlin-platform-native` plugin, you need to declare a separate source set for common native sources.
+
+
+
+```groovy
+kotlin.sourceSets {
+ // Create a common source set used by native targets only.
+ nativeMain {
+ dependsOn(commonMain)
+ dependencies {
+ // Depend on a library published by the kotlin-platform-naive plugin.
+ implementation("org.sample.test:mylibrary:1.0")
+ }
+ }
+
+ // Configure all native platform sources sets to use it as a common one.
+ linuxX64Main.dependsOn(nativeMain)
+ macosX64Main.dependsOn(nativeMain)
+ //...
+}
+```
+
+
+
+See more info about dependencies at the [corresponding page](https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#adding-dependencies).
+
+### Output kinds
+
+With the `kotlin-platform-native` plugin output kinds are specified as a list in properties of a component:
+
+
+
+```groovy
+components.main {
+ // Compile the component into an executable and a Kotlin/Native library.
+ outputKinds = [EXECUTABLE, KLIBRARY]
+}
+```
+
+
+
+With the `kotlin-multiplatform` plugin a compilation always produces a `*.klib` file. A separate `binaries` block is used to configure what
+final native binaries should be produced by each target. Each binary can be configured independently including linker options, executable entry point etc.
+
+
+
+```groovy
+kotlin {
+ macosX64 {
+ binaries {
+ executable {
+ // Binary configuration: linker options, name, etc.
+ }
+ framework {
+ // ...
+ }
+
+ }
+ }
+}
+```
+
+
+
+See more about native binaries declaration at the [corresponding page](https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#building-final-native-binaries).
+
+
+### Publishing
+
+Both `kotlin-platform-native` and `kotlin-multiplatform` plugins automatically set up artifact publication when the
+`maven-publish` plugin is applied. See details about publication at the [corresponding page](https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#publishing-a-multiplatform-library).
+Note that currently only Kotlin/Native libraries (`*.klib`) can be published for native targets.
+
+### Cinterop support
+
+With the `kotlin-platform-native` plugin interop with a native library can be declared in component dependencies:
+
+
+
+```groovy
+components.main {
+ dependencies {
+ cinterop('mystdio') {
+ // Сinterop configuration.
+ }
+ }
+}
+```
+
+
+
+With the `kotlin-multiplatform` plugin interops are configured as a part of a compilation (see details [here](https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#cinterop-support)).
+The rest of an interop configuration is the same as for the `kotlin-platform-native` plugin.
+
+
+
+```groovy
+kotlin {
+ macosX64 {
+ compilations.main.cinterops {
+ mystdio {
+ // Сinterop configuration.
+ }
+ }
+ }
+}
+```
+
+
+
+## `kotlin-platform-native` reference
### Overview
@@ -226,7 +484,7 @@ dependencies {
-Dependency declaraion is also possible in the component block:
+Dependency declaration is also possible in the component block: