


Each folder represents a separate maven project, containing different artifacts and a. We published only one library, but there are multiple folders. Let’s take a look at what we have in the local Maven folder of the library we’ve just published: pom file - an XML representation of a Maven project. This is exactly what you are using when copy-pasting a dependency string to your adle file. Each project is defined by groupId, artifactId, and version, and these three fields are used by Maven as a coordinate system.

A project is everything we build and could depend on. So how does this magic work? Maven doesn’t operate with targets, source sets, and compilations.
#.klib fike code#
For example, the artifacts for iOS or macOS can be built only on Mac-OS.Ĭonsidering all that complexity, adding the ordinary multiplatform dependency requires just a single line of code in your the adle file:Įnter fullscreen mode Exit fullscreen mode There should be the ability to publish all those parts from a multiple host because of Kotlin/Native cross-compilation limitations.in a source set shared between the iOS device and simulator, or shared code for all desktop platforms). Platform-specific code may still be shared across similar platforms (e.g.Multiplatform libraries consist of multiple parts: common parts with expects declarations and platform-specific parts with actual implementations.Here are key differences to keep in mind: Multiplatform libraries have more complex structures compared to normal ones, so the publication is less trivial as well. This is because ordinary publishing is not enough for a multiplatform library. 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.

With the -Xklib-relative-path-base compiler option, you can change the format and use only relative path in the artifact.In the first part of the series, we've created our first multiplatform library and published it to the local Maven. It includes paths of files for generating proper debug information. Using relative paths in klibs is available since Kotlin 1.6.20.Ī serialized IR representation of source files is a part of a klib library. manifest - A file in the java property format describing the library.Īn example layout can be found in klib/stdlib directory of your installation. A set of ProtoBuf files with serialized linkage metadata. There can be several platform specific kotlin and native pairs. Bitcode files of additional native objects.
