Extensions for Moshi including IR plugins, moshi-sealed, and more.
APACHE-2.0 License
Bot releases are hidden (Show)
This release updates to K2, aka Kotlin 2.0.0
. This also builds against KSP 2.0.0-1.0.21
.
org.jetbrains.kotlin:kotlin-metadata-jvm:2.0.0
.Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.26.0...0.27.0
Published by ZacSweers 5 months ago
moshi-immutable-adapters
artifact with support for kotlinx.collections.immutable.Gradle dependency
dependencies {
implementation("dev.zacsweers.moshix:moshi-immutable-adapters:<version>")
}
In code
val moshi = Moshi.Builder().add(ImmutableCollectionsJsonAdapterFactory()).build()
Supported types
ImmutableCollection
ImmutableList
ImmutableSet
ImmutableMap
PersistentCollection
PersistentList
PersistentSet
PersistentMap
1.15.1
.0.9.0
.1.16.0
.1.9.24
.1.9.24-1.0.20
.33.2.0-jre
.8.7
.Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.25.1...0.26.0
Published by ZacSweers 11 months ago
1.9.21
.1.9.20-1.0.14
.1.15.1
.Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.25.0...0.25.1
Published by ZacSweers 12 months ago
1.9.20
. moshi-ir now requires Kotlin 1.9.20
.1.9.20-1.0.13
.32.1.3-jre
.8.4
.Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.24.3...0.25.0
Published by ZacSweers about 1 year ago
Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.24.2...0.24.3
Published by ZacSweers about 1 year ago
Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.24.1...0.24.2
Published by ZacSweers about 1 year ago
KotlinCompilation
's implementation
configuration in KMP projects. Note that Moshi still only supports JVM/Android.Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.24.0...0.24.1
Published by ZacSweers about 1 year ago
New: Move proguard rule generation to a standalone KSP processor.
This is necessary in order to support both K2 and avoid incremental compilation issues in Kotlin 1.9.x.
For moshi-sealed KSP users, there should be no changes necessary.
For moshi-ir users, you must now apply the KSP gradle plugin as well as the moshix plugin. MoshiX's gradle plugin does not directly declare a transitive dependency on the KSP plugin to avoid Gradle classloader conflicts.
plugins {
// Other plugins
id("dev.zacsweers.moshix") version "x.y.z"
+ id("com.google.devtools.ksp") version "x.y.z"
}
If you don't want this or don't need proguard rule generation, you can opt out by setting the moshix.generateProguardRules
gradle property to false
.
1.9.0-1.0.12
.1.14.2
.0.7.0
.32.1.1-jre
.Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.23.0...0.24.0
Published by ZacSweers over 1 year ago
New: Move proguard rule generation to a standalone KSP processor.
This is necessary in order to support both K2 and avoid incremental compilation issues in Kotlin 1.9.x.
For moshi-sealed KSP users, there should be no changes necessary.
For moshi-ir users, you must now apply the KSP gradle plugin as well as the moshix plugin. MoshiX's gradle plugin does not directly declare a transitive dependency on the KSP plugin to avoid Gradle classloader conflicts.
plugins {
// Other plugins
id("dev.zacsweers.moshix") version "x.y.z"
+ id("com.google.devtools.ksp") version "x.y.z"
}
If you don't want this or don't need proguard rule generation, you can opt out by setting the moshix.generateProguardRules
gradle property to false
.
This first release is an RC release to ensure there are no issues with the new standalone processor. If you encounter any issues, please file them!
Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.23.0...0.24.0-RC
Published by ZacSweers over 1 year ago
1.9.0
. The moshi-ir plugin now requires 1.9.0
.kotlinx-metadata
to 0.6.2
.2.4.6
.1.15.0
.1.9.0-1.0.11
.Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.22.1...0.23.0
moshi-sealed
Keep signatures for typed annotated with @NestedSealed
. This ensures that the annotation, itself isn't stripped from the use on the class.
This is done via this keep rule in moshi-sealed-runtime's embedded proguard rules, which should still allow strinking/optimization of the class itself.
-keepnames @dev.zacsweers.moshix.sealed.annotations.NestedSealed class **
Published by ZacSweers over 1 year ago
1.8.20
. Kotlin 1.8.20 or later is required for moshi-ir
.1.8.20-1.0.10
.0.6.0
.Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.21.0...0.22.0
Published by ZacSweers almost 2 years ago
2022-12-28
1.8.0
.CompilerPluginRegistrar
entrypoint API.Note this comes with several caveats:
In short, this is only really to unblock anyone doing their own testing of K2 and don't want this
plugin to disable it. If you see any issues, please file a bug here and disable K2 in your project
in the meantime.
11
.compiler-utils
to 2.4.3
.Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.20.0...0.21.0
Published by ZacSweers almost 2 years ago
@FallbackJsonAdapter
moshi-sealed now supports a new @FallbackJsonAdapter
. This is a proxy to Moshi's PolymorphicJsonAdapter.withFallbackJsonAdapter()
. This allows you to specify a custom JsonAdapter
to handle cases of unrecognized type labels in decoding. It's advanced usage and not recommended for regular cases.
The specified JsonAdapter
must have a public constructor with no parameters or a single Moshi
parameter.
@FallbackJsonAdapter(FrogFallbackJsonAdapter::class)
@JsonClass(generateAdapter = true, generator = "sealed:type")
sealed class Frog {
@JsonClass(generateAdapter = true)
@TypeLabel("original", null)
data class OriginalFrog(...)
@JsonClass(generateAdapter = true)
@TypeLabel("poisonous")
data class PoisonousFrog(...)
class FrogFallbackJsonAdapter(moshi: Moshi) : JsonAdapter<Frog>() {
private val delegate = moshi.adapter<OriginalFrog>()
override fun fromJson(reader: JsonReader): Frog? {
// Default to original frog
return delegate.fromJson(reader)
}
//...
}
}
Edit: this isn't usable in this release, don't try to use it!
@NestedSealed
types to prevent R8 from inlining the parent sealed type into the subtype in some cases.@NestedSealed
types as originating files in moshi-sealed KSP.1.7.22
.1.7.22-1.0.8
.@FallbackJsonAdapter
by @ZacSweers in https://github.com/ZacSweers/MoshiX/pull/350
Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.19.0...0.20.0
Published by ZacSweers about 2 years ago
1.7.20
.1.7.20-1.0.6
.Note this release requires Kotlin 1.7.20 or newer.
Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.18.3...0.19.0
Published by ZacSweers over 2 years ago
@Json.ignore
in MetadataKotlinJsonAdapterFactory
.@Json.ignore
in MetadataKotlinJsonAdapterFactory by @ZacSweers in https://github.com/ZacSweers/MoshiX/pull/306
Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.18.2...0.18.3
Published by ZacSweers over 2 years ago
Full Changelog: https://github.com/ZacSweers/MoshiX/compare/0.18.1...0.18.2