Removed: The moshi-ksp artifact has been upstreamed to Moshi itself as is no longer published.
Removed: The moshi-records-reflect artifact has been upstreamed to Moshi itself as is no longer published.
Update to Kotlin 1.6.0
Update to KotlinPoet 1.10.2
0.14.1
Build against JDK 17.
This means that moshi-sealed-java-sealed-reflect's support of sealed classes in Java is now out of preview and requires Java 17 to use.
moshi-records-reflect still targets Java 16 for maximum compatibility.
All other artifacts still target Java 8.
Update Kotlin to 1.5.31
Update KotlinPoet to 1.10.1
0.14.0
Update KSP to 1.5.30-1.0.0 stable!
moshi-sealed-ksp has now been merged into moshi-sealed-codegen. This artifact can be used for both kapt and
ksp.
moshi-ksp is now soft-deprecated and will be fully deprecated once Moshi's next release is out with formal support.
0.13.0
Update Kotlin to 1.5.30.
Update KSP to 1.5.30-1.0.0-beta08.
Enhancement:RecordsJsonAdapterFactory is now aligned with the upstreamed implementation on Moshi itself.
Note that this is now soft-deprecated and will be fully deprecated once Moshi's next release is out with formal support.
This includes using a few more modern language APIs like MethodHandle and better unpacking of different runtime exceptions. Full details can be found in the PR.
Fix: Avoid implicitly converting elements to KotlinPoet in CodeBlocks to avoid noisy logging.
Fix: Improve self-referencing type variables parsing in moshi-ksp (see #125 and #151).
Special thanks to @yigit for contributing to this release!
0.12.2
Fix:RecordsJsonAdapterFactory now properly respects @JsonQualifier annotations on components.
Fix:RecordsJsonAdapterFactory now supports non-public constructors (i.e. package or file-private).
Fix: Crash in moshi-ksp when dealing with generic typealias properties.
0.12.1
Update to KSP 1.5.21-1.0.0-beta07.
Fix: Previously if you had a @JsonClass-annotated Java file with a custom generator, moshi-ksp would error
out anyway due to it not being a Kotlin class. This is now fixed and it will safely ignore these files.
Fix: Generate missing @OptIn(ExperimentalStdLibApi::class) annotations in moshi-sealed when object
adapters are used, as we use Moshi's reified addAdapter extension.
An experimental Kotlin IR implementation of Moshi code gen and moshi-sealed code gen.
The goal of this is to have functional parity with their native Kapt/KSP code gen analogues but run as a fully
embedded IR plugin.
Benefits
Significantly faster build times.
No extra Kapt or KSP tasks, no extra source files to compile. This runs directly in kotlinc and generates IR that is
lowered directly into bytecode.
No reflection required at runtime to support default parameter values.
Feature parity with Moshi's native code gen.
More detailed error messages for unexpected null values and missing properties. Now all errors are accumulated and
reported at the end, rather than failing eagerly with just the first one encountered.
No support for Proguard file generation for now #193. You will
need to add this manually to your rules if you use R8/Proguard.
One option is to use IR in debug builds and Kapt/KSP in release builds, the latter of which do still generate
proguard rules.
# Keep names for JsonClass-annotated classes
-keepnames class @com.squareup.moshi.JsonClass **
Keep generated adapter classes' constructors
-keepclassmembers class *JsonAdapter {
public <init>(...);
}
Kotlin IR is not a stable API and may change in future Kotlin versions. While I'll try to publish quickly to adjust to
these, you should be aware. If you have any issues, you can always fall back to Kapt/KSP.
Installation
Simply apply the Gradle plugin in your project to use it. You can enable moshi-sealed code gen via the moshi
extension.
The Gradle plugin is published to Maven Central, so ensure you have mavenCentral() visible to your buildscript
classpath.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps moshi-sealed-codegen from 0.12.0 to 0.16.0.
Release notes
Sourced from moshi-sealed-codegen's releases.
Changelog
Sourced from moshi-sealed-codegen's changelog.
... (truncated)
Commits
80a1f3e
Prepare for release 0.16.0.7650423
Implement IR implementation for moshi-sealed (#192)705eccf
Implement golden mask fast path (#191)653cbfa
Accumulate errors (#190)4b19809
Add moshi dependency in the gradle plugin (#188)eca21a6
Fixup some naming + spotless42fe685
Clean up some MutableSet params4205bfe
Use indices52b9538
Clean up commentffcb4c2
More IR cleanup (#184)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)