Skip to content

Commit ee4cba4

Browse files
authored
update: cinterop limitation and test requirements (#4600)
1 parent 562099e commit ee4cba4

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

docs/topics/multiplatform/multiplatform-publish-lib.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,31 @@ in the publication's scope.
5050
## Host requirements
5151

5252
Kotlin/Native supports cross-compilation, allowing any host to produce necessary `.klib` artifacts.
53+
However, there are still some specifics you should keep in mind.
54+
55+
### Compilation for Apple targets
56+
<primary-label ref="experimental-opt-in"/>
5357

5458
To produce artifacts for projects with Apple targets, you'd normally need an Apple machine.
55-
However, if you want to use other hosts, you can set this [Experimental](components-stability.md#stability-levels-explained)
56-
option in your `gradle.properties` file:
59+
However, if you want to use other hosts, set this option in your `gradle.properties` file:
5760

5861
```none
5962
kotlin.native.enableKlibsCrossCompilation=true
6063
```
6164

62-
> To build [final binaries](multiplatform-build-native-binaries.md) for Apple targets, you still need to use a Mac machine.
63-
>
64-
{style="note"}
65+
Cross-compilation is currently Experimental and has some limitations. You still need to use a Mac machine if:
66+
67+
* Your library has a [cinterop dependency](native-c-interop.md).
68+
* You have [CocoaPods integration](native-cocoapods.md) set up in your project.
69+
* You need to build or test [final binaries](multiplatform-build-native-binaries.md) for Apple targets.
70+
71+
### Duplicating publications
6572

6673
To avoid any issues during publication, publish all artifacts from a single host to avoid duplicating publications in the
6774
repository. Maven Central, for example, explicitly forbids duplicate publications and fails the process.
6875
<!-- TBD: add the actual error -->
6976

70-
### If you use Kotlin 1.7.0 or earlier {initial-collapse-state="collapsed" collapsible="true"}
77+
#### If you use Kotlin 1.7.0 or earlier {initial-collapse-state="collapsed" collapsible="true"}
7178

7279
Before 1.7.20, the Kotlin/Native compiler didn't support all cross-compilation options. If you use earlier versions, you may need
7380
to publish multiplatform projects from multiple hosts: a Windows host to compile a Windows target, a Linux host to compile a Linux target, and so on.

docs/topics/whatsnew21.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -693,31 +693,32 @@ The Kotlin compiler produces `.klib` artifacts for publishing Kotlin libraries.
693693
Previously, you could get the necessary artifacts from any host, except for Apple platform targets that required a Mac machine.
694694
That put a special restraint on Kotlin Multiplatform projects that targeted iOS, macOS, tvOS, and watchOS targets.
695695

696-
Kotlin 2.1.0 lifts this restriction, achieving full support for cross-compilation.
696+
Kotlin 2.1.0 lifts this restriction, adding support for cross-compilation.
697697
Now you can use any host to produce `.klib` artifacts,
698698
which should greatly simplify the publishing process for Kotlin and Kotlin Multiplatform libraries.
699699

700-
> To build [final binaries](multiplatform-build-native-binaries.md) for Apple targets, you still need to use a Mac machine.
701-
>
702-
{style="note"}
703-
704-
For more information, see [Publishing multiplatform libraries](https://kotlinlang.org/docs/multiplatform-publish-lib.html).
705-
706-
#### How to enable the publishing Kotlin libraries from any host feature
700+
#### How to enable publishing libraries from any host
707701

708-
This feature is currently [Experimental](components-stability.md#stability-levels-explained).
709-
To try it out in your project, add the following binary option to your `gradle.properties` file:
702+
To try cross-compilation out in your project, add the following binary option to your `gradle.properties` file:
710703

711704
```none
712705
# gradle.properties
713706
kotlin.native.enableKlibsCrossCompilation=true
714707
```
715708

716-
#### Leave feedback on the publishing Kotlin libraries from any host feature
709+
This feature is currently Experimental and has some limitations. You still need to use a Mac machine if:
710+
711+
* Your library has a [cinterop dependency](native-c-interop.md).
712+
* You have [CocoaPods integration](native-cocoapods.md) set up in your project.
713+
* You need to build or test [final binaries](multiplatform-build-native-binaries.md) for Apple targets.
714+
715+
#### Leave feedback on publishing libraries from any host
717716

718717
We're planning to stabilize this feature and further improve library publication in future Kotlin releases.
719718
Please leave your feedback in our issue tracker [YouTrack](https://youtrack.jetbrains.com/issue/KT-71290).
720719

720+
For more information, see [Publishing multiplatform libraries](multiplatform-publish-lib.md).
721+
721722
### Support for non-packed klibs
722723

723724
Kotlin 2.1.0 makes it possible to generate non-packed `.klib` file artifacts.

0 commit comments

Comments
 (0)