Skip to content

Commit ba38b70

Browse files
README: Hide old Gradle plugin instructions, clear up setup flow (#2470)
1 parent 9dab3f4 commit ba38b70

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ Kotlin serialization consists of a compiler plugin, that generates visitor code
2323
* [Introduction and references](#introduction-and-references)
2424
* [Setup](#setup)
2525
* [Gradle](#gradle)
26-
* [Using the `plugins` block](#using-the-plugins-block)
27-
* [Using `apply plugin` (the old way)](#using-apply-plugin-the-old-way)
28-
* [Dependency on the JSON library](#dependency-on-the-json-library)
26+
* [Setting up the serialization plugin](#1-setting-up-the-serialization-plugin)
27+
* [Dependency on the JSON library](#2-dependency-on-the-json-library)
2928
* [Android](#android)
3029
* [Multiplatform (Common, JS, Native)](#multiplatform-common-js-native)
3130
* [Maven](#maven)
@@ -83,9 +82,13 @@ Make sure you have the corresponding Kotlin plugin installed in the IDE, no addi
8382

8483
### Gradle
8584

86-
#### Using the `plugins` block
85+
To set up kotlinx.serialization, you have to do two things:
86+
1) Add the **[serialization plugin](#1-setting-up-the-serialization-plugin)**.
87+
2) Add the **[serialization library dependency](#2-dependency-on-the-json-library)**.
8788

88-
You can set up the serialization plugin with the Kotlin plugin using
89+
#### 1) Setting up the serialization plugin
90+
91+
You can set up the serialization plugin with the Kotlin plugin using the
8992
[Gradle plugins DSL](https://docs.gradle.org/current/userguide/plugins.html#sec:plugins_block):
9093

9194
Kotlin DSL:
@@ -106,9 +109,10 @@ plugins {
106109
}
107110
```
108111

109-
> Kotlin versions before 1.4.0 are not supported by the stable release of Kotlin serialization
112+
> Kotlin versions before 1.4.0 are not supported by the stable release of Kotlin serialization.
110113
111-
#### Using `apply plugin` (the old way)
114+
<details>
115+
<summary>Using <code>apply plugin</code> (the old way)</summary>
112116

113117
First, you have to add the serialization plugin to your classpath as the other [compiler plugins](https://kotlinlang.org/docs/reference/compiler-plugins.html):
114118

@@ -145,10 +149,11 @@ Then you can `apply plugin` (example in Groovy):
145149
apply plugin: 'kotlin' // or 'kotlin-multiplatform' for multiplatform projects
146150
apply plugin: 'kotlinx-serialization'
147151
```
152+
</details>
148153

149-
#### Dependency on the JSON library
154+
#### 2) Dependency on the JSON library
150155

151-
After setting up the plugin one way or another, you have to add a dependency on the serialization library.
156+
After setting up the plugin, you have to add a dependency on the serialization library.
152157
Note that while the plugin has version the same as the compiler one, runtime library has different coordinates, repository and versioning.
153158

154159
Kotlin DSL:

0 commit comments

Comments
 (0)