From dfbc6fb27515149aeaa098727b42393569b8b25e Mon Sep 17 00:00:00 2001 From: cbullinger Date: Tue, 7 May 2024 11:04:35 -0400 Subject: [PATCH] Update Kotlin sdk version constant and add info about k2 compilation support --- snooty.toml | 4 +- source/sdk/kotlin/install.txt | 81 ++++++++++++++++++++++------------- 2 files changed, 54 insertions(+), 31 deletions(-) diff --git a/snooty.toml b/snooty.toml index f179a1d749..e6939c0f89 100644 --- a/snooty.toml +++ b/snooty.toml @@ -83,11 +83,11 @@ atlas = "Atlas" admin-api-page = "/admin/api/v3/#" base-url = "https://www.mongodb.com/docs/realm" cpp-prefix = "https://www.mongodb.com/docs/realm-sdks/cpp/latest" -kotlin-sdk-version = "1.11.0" +kotlin-sdk-version = "1.16.0" kotlinx-coroutines-version = "1.7.0" kotlin-sync-prefix = "https://www.mongodb.com/docs/realm-sdks/kotlin/latest/library-sync/" kotlin-local-prefix = "https://www.mongodb.com/docs/realm-sdks/kotlin/latest/library-base/" -java-sdk-version = "10.11.1" +java-sdk-version = "10.18.0" max-graphql-resolvers = "ten" max-graphql-relationship-depth = "five" name-char-limit = "57" diff --git a/source/sdk/kotlin/install.txt b/source/sdk/kotlin/install.txt index f7d9bdb762..f62ecf415a 100644 --- a/source/sdk/kotlin/install.txt +++ b/source/sdk/kotlin/install.txt @@ -10,9 +10,16 @@ Install the Kotlin SDK :depth: 2 :class: singlecol +.. meta:: + :description: Learn how to install the Atlas Device SDK for Kotlin in your Android and Kotlin Multiplatform (KMP) projects. + :keywords: code example -The Kotlin SDK supports two platforms, each with its own installation -method: +.. facet:: + :name: genre + :values: tutorial + +The Atlas Device SDK for Kotlin supports the following platforms. Each has its own installation +method and requirements: - :ref:`Android ` - :ref:`Kotlin Multiplatform (KMP) ` @@ -28,19 +35,21 @@ meets the following prerequisites: - Kotlin Plugin for Android Studio, version 1.6.10 or higher. - An Android Virtual Device (AVD) using a supported CPU architecture. +For a list of supported target environments, refer to the :ref:`kotlin-supported-environments` section on this page. + Additionally, Kotlin Multiplatform (KMP) for mobile projects require the following: - `Kotlin Multiplatform Mobile (KMM) Plugin `__ for Android Studio, version 0.3.1 or higher. -- A Kotlin Multiplatform (KMP) App created using the "Kotlin Multiplatform App" - template in Android Studio. Follow the instructions in the - `Kotlin Multiplatform documentation +- A Kotlin Multiplatform (KMP) App created using the "Kotlin Multiplatform App" + template in Android Studio. Follow the instructions in the + `Kotlin Multiplatform documentation `__. For more details on setting up your KMP environment, refer to the `official Kotlin -Kotlin Multiplatform for mobile documentation -`__. To verify your +Kotlin Multiplatform for mobile +`__ documentation. To verify your environment setup, follow Kotlin's `guide to checking your environment `__. @@ -50,8 +59,8 @@ environment The Kotlin Multiplatform (KMP) ecosystem frequently changes. If you experience any issues installing the SDK, check your Kotlin Plugin version, since outdated plugins can lead to difficult to debug errors. To see which - versions of the Kotlin Plugin are compatible with the SDK, see the - `realm-kotlin changelog `__. + versions of the Kotlin Plugin are compatible with the SDK, refer to the + `SDK changelog `__. .. _kotlin-install-kotlin-multiplatform: .. _kotlin-install-android: @@ -72,24 +81,24 @@ Installation .. tab:: Android :tabid: android - - Add :file:`io.realm.kotlin`, specifying the library version and - :file:`apply false`, to the list of plugins in your project-level Gradle + + Add :file:`io.realm.kotlin`, specifying the library version and + :file:`apply false`, to the list of plugins in your project-level Gradle build file, typically found at :file:`/build.gradle`: .. code-block:: kotlin :caption: Global build.gradle - + plugins { id 'io.realm.kotlin' version '{+kotlin-sdk-version+}' apply false } - + Add the following to your app-level Gradle build file, typically found at :file:`/app/build.gradle`: - Add :file:`io.realm.kotlin` to the list of plugins. - Add the following to the list of dependencies: - + - Add :file:`io.realm.kotlin:library-base` to the dependencies block. - If using Device Sync in your application, add :file:`io.realm.kotlin:library-sync` to the dependencies block. @@ -97,7 +106,7 @@ Installation .. code-block:: kotlin :caption: Module build.gradle - :emphasize-lines: 4, 12, 13, 14 + :emphasize-lines: 4, 12-14 plugins { id 'com.android.application' @@ -110,7 +119,7 @@ Installation } dependencies { - implementation 'io.realm.kotlin:library-base:{+kotlin-sdk-version+}' + implementation 'io.realm.kotlin:library-base:{+kotlin-sdk-version+}' implementation 'io.realm.kotlin:library-sync:{+kotlin-sdk-version+}'// If using Device Sync implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:{+kotlinx-coroutines-version+}' // If using coroutines with the SDK } @@ -123,15 +132,15 @@ Installation - Add :file:`io.realm.kotlin` to the list of plugins. - Add the following to the list of dependencies: - + - Add :file:`io.realm.kotlin:library-base` to the dependencies block. - If using Device Sync in your application, add :file:`io.realm.kotlin:library-sync` to the dependencies block. - To use coroutines with the SDK, add :file:`org.jetbrains.kotlinx:kotlinx-coroutines-core` to the list of dependencies. .. code-block:: kotlin - :caption: Module build.gradle - :emphasize-lines: 5, 18, 19, 20 + :caption: App build.gradle + :emphasize-lines: 5, 18-20 plugins { kotlin("multiplatform") @@ -150,7 +159,7 @@ Installation sourceSets { val commonMain by getting { dependencies { - implementation("io.realm.kotlin:library-base:{+kotlin-sdk-version+}") + implementation("io.realm.kotlin:library-base:{+kotlin-sdk-version+}") implementation("io.realm.kotlin:library-sync:{+kotlin-sdk-version+}") // If using Device Sync implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:{+kotlinx-coroutines-version+}") // If using coroutines with the SDK } @@ -158,13 +167,10 @@ Installation } } - .. note:: Android Module Dependencies - - If you use any part of the SDK inside the Android module, add the - SDK's compile-time dependency to your Android module :file:`build.gradle.kts`: + If you use any part of the SDK inside the Android module, add the following compile-time dependencies to your module-level Gradle build file, typically found at :file:`/module/build.gradle`: .. code-block:: kotlin - :copyable: false + :caption: Android Module build.gradle dependencies { compileOnly("io.realm.kotlin:library-base:{+kotlin-sdk-version+}") @@ -175,19 +181,21 @@ Installation compileOnly("io.realm.kotlin:library-sync:{+kotlin-sdk-version+}") } - .. step:: Sync Gradle Files + .. step:: Sync Gradle Files After updating the Gradle configuration, resolve the dependencies by clicking :guilabel:`File` > :guilabel:`Sync Project with Gradle Files` in the Android Studio menu bar. You can now use the Kotlin SDK in your application. +.. _kotlin-supported-environments: Supported Target Environments ----------------------------- -Kotlin Multiplatform (KMP) supports a `wide range of application environments -`__. +Kotlin Multiplatform (KMP) supports a wide range of application environments +Refer also to Kotlin's `Multiplatform Gradle DSL reference: Targets +`__ documentation. Supported Environments ~~~~~~~~~~~~~~~~~~~~~~ @@ -239,3 +247,18 @@ The Kotlin SDK does *not* support the following environments: - :file:`watchosSimulatorArm64` - :file:`watchosX86` - :file:`watchosX64` + +Support for Experimental K2 Compiler +------------------------------------ + +.. versionadded:: 1.13.0 + Support for experimental K2 compilation with Kotlin v1.9.0 + +The Kotlin SDK version 1.13.0 and later supports the experimental K2 compiler +with Kotlin version 1.9.0. + +To use the K2 compiler in your project, add the following to your project-level +Gradle properties file: ``kotlin.experimental.tryK2=true``. + +For more information on the K2 compiler, including minimum requirements, refer to Kotlin's `Try the K2 compiler in your project +`__.