This repository has been archived by the owner on Mar 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added kotlinx-serialization support.
- Loading branch information
Showing
8 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
apply plugin: 'kotlin-platform-common' | ||
apply plugin: 'kotlinx-serialization' | ||
|
||
dependencies { | ||
compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-common', version: kotlinVersion | ||
compileOnly group: 'org.jetbrains.kotlinx', name: 'kotlinx-serialization-runtime', version: kotlinSerializationVersion | ||
testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-common', version: kotlinVersion | ||
testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-annotations-common', version: kotlinVersion | ||
} |
12 changes: 12 additions & 0 deletions
12
common/src/main/kotlin/com/github/czyzby/example/common/Common.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
package com.github.czyzby.example.common | ||
|
||
import kotlinx.serialization.SerialId | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* Must be implemented by all modules and return the one and only answer Answer to the Ultimate Question of Life, | ||
* the Universe, and Everything. This is not the best example of a multi-platform usage, since we expect it to | ||
* return the same number on all platforms, but you get the idea. | ||
*/ | ||
expect fun getAnswer(): Int | ||
|
||
|
||
// kotlinx-serialization usage example: | ||
|
||
@Serializable | ||
data class CommonData( | ||
@SerialId(1) val id: Int, | ||
@SerialId(2) val name: String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
javaVersion=1.8 | ||
kotlinVersion=1.2.21 | ||
kotlinSerializationVersion=0.4.1 | ||
junitVersion=4.12 | ||
nodePluginVersion=1.2.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters