summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Aigner <SebastianAigner@users.noreply.github.com>2023-10-12 10:27:48 +0200
committerGitHub <noreply@github.com>2023-10-12 10:27:48 +0200
commitba38b7099e502c16efd30386d18174e3a7aefb3a (patch)
treea3ead0c3aca2d68ee3f5fc53af6efe4d55d03cd5
parent9dab3f422dfd5935351e494d0dbdf2f3be7718c9 (diff)
downloadkotlinx.serialization-ba38b7099e502c16efd30386d18174e3a7aefb3a.tar.gz
README: Hide old Gradle plugin instructions, clear up setup flow (#2470)
-rw-r--r--README.md23
1 files changed, 14 insertions, 9 deletions
diff --git a/README.md b/README.md
index a6269dc1..da21f8f0 100644
--- a/README.md
+++ b/README.md
@@ -23,9 +23,8 @@ Kotlin serialization consists of a compiler plugin, that generates visitor code
* [Introduction and references](#introduction-and-references)
* [Setup](#setup)
* [Gradle](#gradle)
- * [Using the `plugins` block](#using-the-plugins-block)
- * [Using `apply plugin` (the old way)](#using-apply-plugin-the-old-way)
- * [Dependency on the JSON library](#dependency-on-the-json-library)
+ * [Setting up the serialization plugin](#1-setting-up-the-serialization-plugin)
+ * [Dependency on the JSON library](#2-dependency-on-the-json-library)
* [Android](#android)
* [Multiplatform (Common, JS, Native)](#multiplatform-common-js-native)
* [Maven](#maven)
@@ -83,9 +82,13 @@ Make sure you have the corresponding Kotlin plugin installed in the IDE, no addi
### Gradle
-#### Using the `plugins` block
+To set up kotlinx.serialization, you have to do two things:
+1) Add the **[serialization plugin](#1-setting-up-the-serialization-plugin)**.
+2) Add the **[serialization library dependency](#2-dependency-on-the-json-library)**.
-You can set up the serialization plugin with the Kotlin plugin using
+#### 1) Setting up the serialization plugin
+
+You can set up the serialization plugin with the Kotlin plugin using the
[Gradle plugins DSL](https://docs.gradle.org/current/userguide/plugins.html#sec:plugins_block):
Kotlin DSL:
@@ -106,9 +109,10 @@ plugins {
}
```
-> Kotlin versions before 1.4.0 are not supported by the stable release of Kotlin serialization
+> Kotlin versions before 1.4.0 are not supported by the stable release of Kotlin serialization.
-#### Using `apply plugin` (the old way)
+<details>
+ <summary>Using <code>apply plugin</code> (the old way)</summary>
First, you have to add the serialization plugin to your classpath as the other [compiler plugins](https://kotlinlang.org/docs/reference/compiler-plugins.html):
@@ -145,10 +149,11 @@ Then you can `apply plugin` (example in Groovy):
apply plugin: 'kotlin' // or 'kotlin-multiplatform' for multiplatform projects
apply plugin: 'kotlinx-serialization'
```
+</details>
-#### Dependency on the JSON library
+#### 2) Dependency on the JSON library
-After setting up the plugin one way or another, you have to add a dependency on the serialization library.
+After setting up the plugin, you have to add a dependency on the serialization library.
Note that while the plugin has version the same as the compiler one, runtime library has different coordinates, repository and versioning.
Kotlin DSL: