Skip to content

Commit

Permalink
Update website and docs to K2
Browse files Browse the repository at this point in the history
  • Loading branch information
lupuuss committed May 31, 2024
1 parent 33de0c3 commit bae73c3
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 37 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
</br>
</br>

[![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)

Expand Down
5 changes: 3 additions & 2 deletions website/docs/Guides/Spying.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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!**
Expand All @@ -16,4 +15,6 @@ val spiedRepository = spy<BookRepository>(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!
87 changes: 63 additions & 24 deletions website/docs/Setup.mdx
Original file line number Diff line number Diff line change
@@ -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"
}
```

<Tabs
groupId="kotlinVersion"
defaultValue="k2"
values={[
{label: 'K1', value: 'k1'},
{label: 'K2', value: 'k2'},
]}>
<TabItem value="k1">
```kotlin
plugins {
kotlin("multiplatform") version "1.9.24" // ...or any other Kotlin plugin
id("dev.mokkery") version "1.9.24-1.7.0"
}
```
</TabItem>
<TabItem value="k2">
```kotlin
plugins {
kotlin("multiplatform") version "2.0.0" // ...or any other Kotlin plugin
id("dev.mokkery") version "2.0.0"
}
```
</TabItem>
</Tabs>


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.
Expand Down Expand Up @@ -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"` |
<Tabs
groupId="kotlinVersion"
defaultValue="k2"
values={[
{label: 'K1', value: 'k1'},
{label: 'K2', value: 'k2'},
]}>
<TabItem value="k1">
| 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"` |
</TabItem>
<TabItem value="k2">
> **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+ |
</TabItem>
</Tabs>
34 changes: 28 additions & 6 deletions website/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
Expand Down Expand Up @@ -129,11 +134,28 @@ function WhyMokkeryTabs() {
</TabItem>
<TabItem value="setup" label="⌚&nbsp;Easy&nbsp;setup">
<h3 style={{fontWeight: "400"}}>Just apply Gradle plugin and...</h3>
<CodeBlock
language="kotlin"
showLineNumbers>
{setupTabBlock}
</CodeBlock>
<Tabs
groupId="kotlinVersion"
defaultValue="k2"
values={[
{label: 'K1', value: 'k1'},
{label: 'K2', value: 'k2'},
]}>
<TabItem value="k1">
<CodeBlock
language="kotlin"
showLineNumbers>
{setupTabBlockK1}
</CodeBlock>
</TabItem>
<TabItem value="k2">
<CodeBlock
language="kotlin"
showLineNumbers>
{setupTabBlockK2}
</CodeBlock>
</TabItem>
</Tabs>
<h3 style={{fontWeight: "400"}}>...that's it!</h3>
<h3 style={{fontWeight: "400"}}>Make sure that you have required repositories and compatible
Kotlin version!</h3>
Expand Down
4 changes: 2 additions & 2 deletions website/src/versions.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const kotlinVersion = "1.9.24"
export const mokkeryVersion = `${kotlinVersion}-1.7.0`
export const kotlinVersion = "2.0.0"
export const mokkeryVersion = "2.0.0"

0 comments on commit bae73c3

Please sign in to comment.