![]() klib), and the number of source sets doesn’t match the number of result artifacts. There are multiple artifacts for one version of your library, their content format is different (.jar vs. If you have published regular platform (for example, android) libraries before, you may notice that the publishing format of a multiplatform library differs quite a lot. But if you are curious, let's discuss it a little! TL DR: The Kotlin Gradle plugin creates and configures your library publications automatically, so you don't need to know the details of the publication scheme to successfully deliver your library. Before going public, let's discover published artifacts to get an understanding of the multiplatform publishing format. Tasks.In the first part of the series, we've created our first multiplatform library and published it to the local Maven. Create a task building a fat framework. Use export explicitly for the dependencies you need to directly access from your Swift or Objective-C code. In most cases, you don't need to add all these dependencies to the framework API. This could increase both compilation time and binary size. It is not recommended to use transitiveExport: it adds all transitive dependencies of the exported dependencies to the framework. If set to true, the declarations of the library bar are exported as well. You can change this behavior using the transitiveExport option. This means that if you export the library foo depending on the library bar, only methods of foo are added to the output framework. This disables dead code elimination for the exported dependency (and for its dependencies, to some extent).īy default, export works non-transitively. The compiler adds the code from this dependency to the framework, even if you use a small fraction of it. When you export a dependency, it includes all of its API to the framework API. You can export only api dependencies of the corresponding source set. Usage of several Kotlin/Native frameworks in a Swift application is limited, but you can create an umbrella framework and export all these modules to it. It's possible to export different sets of dependencies to different binaries.įor example, you implement several modules in Kotlin and want to access them from Swift. Use the following factory methods to declare elements of the binaries collection.Īpi 'org.example:not-exported-library:1.0'Įxport 'org.example:exported-library:1.0' This means if you distribute a Kotlin/Native-compiled final binary, you should always include necessary license files into your binary distribution. ![]() ![]() The only binary available by default is a debug test executable that lets you run unit tests from the test compilation.īinaries produced by the Kotlin/Native compiler can include third-party code, data, or derived work. The kotlin-multiplatform plugin doesn't create any production binaries by default. ![]() This property represents a collection of native binaries built for this target in addition to the default *.klib artifact and provides a set of methods for declaring and configuring them. To declare final native binaries such as executables or shared libraries, use the binaries property of a native target. By default, a Kotlin/Native target is compiled down to a *.klib library artifact, which can be consumed by Kotlin/Native itself as a dependency but cannot be executed or used as a native library. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |