From bae73c3e39b37345d8b54d9c4ec301943abf93a2 Mon Sep 17 00:00:00 2001 From: lupuuss Date: Sat, 1 Jun 2024 00:07:33 +0200 Subject: [PATCH] Update website and docs to K2 --- README.md | 5 +- website/docs/Guides/Spying.mdx | 5 +- website/docs/Setup.mdx | 87 ++++++++++++++++++++++++---------- website/src/pages/index.js | 34 ++++++++++--- website/src/versions.js | 4 +- 5 files changed, 98 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 30e41083..6b9e14f7 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,8 @@

-[![Gradle Plugin Portal Beta](https://img.shields.io/gradle-plugin-portal/v/dev.mokkery?versionPrefix=2)](https://plugins.gradle.org/plugin/dev.mokkery/2.0.0-RC1) -[![Gradle Plugin Portal Stable](https://img.shields.io/gradle-plugin-portal/v/dev.mokkery?versionPrefix=1)](https://plugins.gradle.org/plugin/dev.mokkery/1.9.24-1.7.0) -[![Kotlin](https://img.shields.io/badge/kotlin-1.9.24-blue.svg?logo=kotlin)](http://kotlinlang.org) +[![Gradle Plugin Portal Stable](https://img.shields.io/gradle-plugin-portal/v/dev.mokkery)](https://plugins.gradle.org/plugin/dev.mokkery) +[![Kotlin](https://img.shields.io/badge/kotlin-2.0.0-blue.svg?logo=kotlin)](http://kotlinlang.org) [![GitHub](https://img.shields.io/github/license/lupuuss/Mokkery)](https://github.com/lupuuss/Mokkery/blob/main/LICENSE) [![Docs](https://img.shields.io/static/v1?label=api&message=reference&labelColor=gray&color=blueviolet&logo=gitbook&logoColor=white)](https://mokkery.dev/api_reference) diff --git a/website/docs/Guides/Spying.mdx b/website/docs/Guides/Spying.mdx index bbf1038e..d497c06a 100644 --- a/website/docs/Guides/Spying.mdx +++ b/website/docs/Guides/Spying.mdx @@ -4,8 +4,7 @@ description: Easily create a spy from a real object! # Spying -Similarly to `mock`, `spy` tracks method calls. However, it is not possible to change spy behavior. It always calls spied object -method. +To create a spy use `spy` with spied object as a parameter. > :warning: **Please read [limitations](../Limitations) section!** @@ -16,4 +15,6 @@ val spiedRepository = spy(repository) Ensure that you specify a type for the `spy`. In previous example inferred type would be `BookRepositoryImpl`, which is very likely to be a final class, and it is not supported to spy them! +By default, spy delegates all calls to spied object. However, you can change methods behaviour in [the same way as with mocks](../Guides/Mocking). + Read [verifying](../Guides/Verifying) section to learn how to verify calls on spy! diff --git a/website/docs/Setup.mdx b/website/docs/Setup.mdx index bee9f765..1aaaec7e 100644 --- a/website/docs/Setup.mdx +++ b/website/docs/Setup.mdx @@ -1,15 +1,40 @@ --- description: How to add Mokkery to your Gradle project rapidly! --- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + # Setup 1. Apply Gradle plugin: -```kotlin -plugins { - kotlin("multiplatform") version "1.9.24" // ...or any other Kotlin plugin - id("dev.mokkery") version "1.9.24-1.7.0" -} -``` + + + + ```kotlin + plugins { + kotlin("multiplatform") version "1.9.24" // ...or any other Kotlin plugin + id("dev.mokkery") version "1.9.24-1.7.0" + } + ``` + + + ```kotlin + plugins { + kotlin("multiplatform") version "2.0.0" // ...or any other Kotlin plugin + id("dev.mokkery") version "2.0.0" + } + ``` + + + + 2. Ensure that your Mokkery version is compatible with Kotlin version. Refer to [compatibility](#compatibility) section. 3. Check [targets](#targets) section to make sure that all targets from you multiplatform project are supported. @@ -59,21 +84,35 @@ You can refer to [this file](https://github.com/lupuuss/Mokkery/blob/master/buil ### Compatibility -> **Warning** -> Mokkery 2.0.0 pre-releases are not locked to specific Kotlin pre-release and optimistically assume that compiler -> API is not going to change. However, breaking changes might happen and result in compile-time errors. - -| Mokkery version | Supported Kotlin version | Plugin version | -|------------------------------------|--------------------------------------------------------|--------------------------| -| 2.0.0-RC1 | 2.0.0-RC2+ | `"2.0.0-RC1"` | -| 1.7.0 | 1.9.24, 1.9.23 | `"$kotlinVersion-1.7.0"` | -| 1.6.1 | 1.9.23 | `"$kotlinVersion-1.6.1"` | -| 1.6.0 | 1.9.23 | `"$kotlinVersion-1.6.0"` | -| 1.5.0 | 1.9.23, 1.9.22 | `"$kotlinVersion-1.5.0"` | -| 1.4.0 | 1.9.22, 1.9.21, 1.9.20 | `"$kotlinVersion-1.4.0"` | -| 1.3.2 | 1.9.22, 1.9.21, 1.9.20 | `"$kotlinVersion-1.3.2"` | -| 1.3.1 | 1.9.22, 1.9.21, 1.9.20 | `"$kotlinVersion-1.3.1"` | -| 1.3.0 | 1.9.20, 1.9.10, 1.9.0, 1.8.22, 1.8.21, 1.8.20 | `"$kotlinVersion-1.3.0"` | -| 1.2.0 | 1.9.0, 1.8.22, 1.8.21, 1.8.20 | `"$kotlinVersion-1.2.0"` | -| 1.1.0 | 1.9.0, 1.8.22, 1.8.21, 1.8.20 | `"$kotlinVersion-1.1.0"` | -| 1.0.1 | 1.9.0, 1.8.22, 1.8.21, 1.8.20 | `"$kotlinVersion-1.0.1"` | + + + | Mokkery version | Supported Kotlin version | Plugin version | + |------------------------------------|--------------------------------------------------------|--------------------------| + | 1.7.0 | 1.9.24, 1.9.23 | `"$kotlinVersion-1.7.0"` | + | 1.6.1 | 1.9.23 | `"$kotlinVersion-1.6.1"` | + | 1.6.0 | 1.9.23 | `"$kotlinVersion-1.6.0"` | + | 1.5.0 | 1.9.23, 1.9.22 | `"$kotlinVersion-1.5.0"` | + | 1.4.0 | 1.9.22, 1.9.21, 1.9.20 | `"$kotlinVersion-1.4.0"` | + | 1.3.2 | 1.9.22, 1.9.21, 1.9.20 | `"$kotlinVersion-1.3.2"` | + | 1.3.1 | 1.9.22, 1.9.21, 1.9.20 | `"$kotlinVersion-1.3.1"` | + | 1.3.0 | 1.9.20, 1.9.10, 1.9.0, 1.8.22, 1.8.21, 1.8.20 | `"$kotlinVersion-1.3.0"` | + | 1.2.0 | 1.9.0, 1.8.22, 1.8.21, 1.8.20 | `"$kotlinVersion-1.2.0"` | + | 1.1.0 | 1.9.0, 1.8.22, 1.8.21, 1.8.20 | `"$kotlinVersion-1.1.0"` | + | 1.0.1 | 1.9.0, 1.8.22, 1.8.21, 1.8.20 | `"$kotlinVersion-1.0.1"` | + + + > **Warning** + > Mokkery 2.* versions are not locked to specific Kotlin 2.* versions and optimistically assume that compiler + > API is not going to change. However, breaking changes might happen and result in compile-time errors. You can track compiler API stability [here](https://youtrack.jetbrains.com/issue/KT-49508/Stabilize-the-K2-Compiler-Plugin-API). + + | Mokkery version | Supported Kotlin versions | + |------------------------------------|--------------------------------------------------------| + | 2.0.0 | 2.0.0+ | + + diff --git a/website/src/pages/index.js b/website/src/pages/index.js index 7288deae..a3997af3 100644 --- a/website/src/pages/index.js +++ b/website/src/pages/index.js @@ -25,7 +25,12 @@ const simpleTabBlock = `class BookServiceTest { } } }` -const setupTabBlock = `plugins { +const setupTabBlockK1 = `plugins { + kotlin("multiplatform") version "1.9.24" // ...or any other Kotlin plugin + id("dev.mokkery") version "1.9.24-1.7.0" +} +` +const setupTabBlockK2 = `plugins { kotlin("multiplatform") version "${kotlinVersion}" // ...or any other Kotlin plugin id("dev.mokkery") version "${mokkeryVersion}" } @@ -129,11 +134,28 @@ function WhyMokkeryTabs() {

Just apply Gradle plugin and...

- - {setupTabBlock} - + + + + {setupTabBlockK1} + + + + + {setupTabBlockK2} + + +

...that's it!

Make sure that you have required repositories and compatible Kotlin version!

diff --git a/website/src/versions.js b/website/src/versions.js index 4aa6108d..a5755601 100644 --- a/website/src/versions.js +++ b/website/src/versions.js @@ -1,2 +1,2 @@ -export const kotlinVersion = "1.9.24" -export const mokkeryVersion = `${kotlinVersion}-1.7.0` \ No newline at end of file +export const kotlinVersion = "2.0.0" +export const mokkeryVersion = "2.0.0" \ No newline at end of file