Commit Graph

868 Commits

Author SHA1 Message Date
Zac Sweers
44fa05bce1 Prepare dokka (#1238)
* Prepare dokka

This updates to Dokka 1.4.10 and prepares for a future with Kotlin rewrite and mkdocs

* Spotless
2020-09-25 22:37:13 -04:00
Zac Sweers
a1852a7315 Finish spotless license header configuration (#1231)
* Update spotless and enable copyright header bits again

* Reformat square copyright headers

* Create separate format configuration for external files

* Update CI to use java 15 final

* include stacktrace in ci failures

* Update ktlint to 0.39

* Disable java formatting on JDK 15

* Fix google header
2020-09-25 22:18:51 -04:00
Lachlan McKee
bf72ce8ade Introduced tags to reader/writers (#1227)
* Introduced tags to reader/writers

* Removed getTags method

* Added type safety to tag methods

* Changed to explicit class comparison

* Removed ? extends for tags

* Switched to LinkedHashMap

* Allowed polymorphism for tag values

* Simplified tags tests
2020-09-22 08:56:51 -04:00
Jesse Wilson
53c1bf0cac Fix problems discovered using nextSource() to implement skipValue (#1236) 2020-09-21 23:50:38 -04:00
Jesse Wilson
0a78ed4cb1 Moshi.Builder.addLast() (#1233)
This is mostly useful for KotlinJsonAdapterFactory.
2020-09-21 09:36:55 -04:00
Zac Sweers
517ea36fe5 Fix shadow packaging in code gen artifact (#1214)
* Update to shadow 6.0

* Exclude kotlinpoet core artifact from shading

* Replace runtime scopes with compile

* Opportunistically fix old artifact() dep

Gradle 6.6 supports providers now

* Use api instead

* Add link

* Remove accidental gradle plugin config

This only applies to gradle plugins
2020-09-18 21:43:11 -04:00
Jesse Wilson
9ee711adce Merge pull request #1225 from square/jwilson.0914.nextSourceHacks
Small improvements to JsonReader.nextSource
2020-09-14 23:53:45 -04:00
Jesse Wilson
a09f0a5c26 Small improvements to JsonReader.nextSource
Defer doing I/O until strictly necessary.

Remove some unnecessary branching in doPeek(), which is in the
inner loop of all JSON parsing.
2020-09-14 22:05:27 -04:00
Jesse Wilson
99245ef18f Merge pull request #1224 from square/jwilson.0913.json_value_source
New public API, JsonReader.nextSource()
2020-09-14 19:53:49 -04:00
Jesse Wilson
6c01c34ecf New public API, JsonReader.nextSource()
The streaming side of https://github.com/square/moshi/issues/675

We can still add a nicer wrapper on top to read the JSON value as
a string.
2020-09-13 12:04:47 -04:00
Jesse Wilson
19a0fcdf38 Merge pull request #1222 from square/jwilson.0912.json_value_source
JsonValueSource: a brace-matching implementation of okio.Source
2020-09-13 00:33:45 -04:00
Jesse Wilson
47d1037175 JsonValueSource: a brace-matching implementation of okio.Source
This will read one JSON object and then stop.

This is a part of https://github.com/square/moshi/issues/675
2020-09-12 22:37:03 -04:00
Jesse Wilson
106d47122f Merge pull request #1220 from ZacSweers/z/kotlin1410
Update to Kotlin 1.4.10
2020-09-11 07:50:42 -04:00
Zac Sweers
861071c3e8 Update to Kotlin 1.4.10
Just a bunch of small bugfixes
2020-09-11 00:24:22 -04:00
Zac Sweers
56af4c3f89 Fix KotlinJsonAdapterFactory ref in error message (#1217) 2020-09-10 15:53:42 -04:00
Zac Sweers
5284851b08 Clean up old checkstyle references (#1205)
* Clean up old checkstyle references

* Update CONTRIBUTING.md

Co-authored-by: Jake Wharton <github@jakewharton.com>

Co-authored-by: Jake Wharton <github@jakewharton.com>
2020-09-07 22:18:02 -04:00
Jake Wharton
032db2ae30 Publish from 1.8 build 2020-09-01 15:55:27 -04:00
Jake Wharton
95421e7817 Delete deploy_snapshot.sh 2020-09-01 15:53:27 -04:00
Zac Sweers
5c07341977 Switch to Github Actions for CI 2020-09-01 15:48:33 -04:00
Jake Wharton
aa1f514157 Merge pull request #1211 from ZacSweers/z/appendLnFixes
Switch to new appendLine APIs
2020-09-01 09:17:38 -04:00
Zac Sweers
ecca5122a0 Switch to new appendLine APIs
appendLn is deprecated in kotlin 1.4
2020-09-01 01:13:55 -04:00
Zac Sweers
42f1d18f64 Update Okio and kotlin-compile-testing dependencies (#1198)
* Update Okio to latest

* Update kotlin-compile-testing to 1.2.10

* Update to KtLint 0.38.1

No changes affecting moshi, just support for mixing multiple kotlin versions in a project

* Opportunistic disable kotlin-dsl warning

This is noisy on every build

* Update maven publish to 0.12.0
2020-08-28 07:28:58 -04:00
Zac Sweers
538890e8c0 Switch to spotless and format code (#1196)
* Add spotless configuration

* Reformat!

* Add copyright config for build.gradle.kts files

* Add toeholds for headers
2020-08-27 23:40:15 -04:00
Zac Sweers
701d6ba968 Minor gradle cleanups (#1197)
* Update to Gradle 6.6

* Remove stdlib deps

No longer necessary in Kotlin 1.4.0

* Gradle 6.6.1
2020-08-27 23:01:51 -04:00
Zac Sweers
4dd4a9d222 Migrate to Gradle (#1159)
* Start gradle root

* Clean up test API ambiguities

These don't compile in gradle anymore and the team[] warns

* Exclude .gradle dirs in git

* Set up moshi module

* Set up moshi-adapters

* Add repositories to subprojects

* Set target/source compatibility

* Set up examples

* Fix location of reflect/test dir

* Set up moshi-kotlin

* Set up code gen

* Opportunistic update code gen deps

* Fix up with code gen

* Set up kotlin tests

* Update snapshots

* Update travis build

* Configure checkstyle

* Cache gradle

* Finish fixing up checkstyle

* Now disable checkstyle until we can fix them all :|

* Update contributing

* Fix tests in codegen

* Remove unnecessary annotation

* Remove maven stuff!

* Suppress warning

* Remove jcenter

* Consolidate dependencies

* Revert "Clean up test API ambiguities"

This reverts commit 3ead69b844b5d7f66134b721e95581f5df1cccd6.

* Fix incap dep

* Opportunistically fix some small kotlinpoet deprecations

* Automatically apply the stdlib to all kotlin projects

* Opportunistic move to opt-in and remove unnecessary annotations

The kotlin maven plugin didn't handle these well in the IDE, gradle does

* Fix Type doc warning

* Fix okio version

* Fix dokka support

* Fix copypasta

* Use new snapshot

* Kotlin 1.4.0
2020-08-27 16:50:28 -04:00
Jesse Wilson
24c0c49858 Merge pull request #1195 from ZacSweers/patch-4
Add missing 1.10 bits to changelog
2020-08-27 05:40:06 -04:00
Zac Sweers
99c8745130 Add missing 1.10 bits to changelog
Some were cherrypicked to 1.9.3, this adds (I think) everything else that's fixed or new in 1.10
2020-08-27 03:22:21 -04:00
Jesse Wilson
28831b04cf [maven-release-plugin] prepare for next development iteration 2020-08-26 21:38:44 -04:00
Jesse Wilson
cff20193c2 [maven-release-plugin] prepare release moshi-parent-1.10.0 2020-08-26 21:38:36 -04:00
Jesse Wilson
c370385fdc Update changelog for 1.10.0 2020-08-26 21:36:09 -04:00
Zac Sweers
a5dbc1d642 Update to Kotlin 1.4.0 (#1191)
* Update to Kotlin 1.4.0

* Remove moshi-kotlin rules in favor of Kotlin's

* Ignore tests for now

* Update to OptIn

* Update test for kotlin 1.4 behavior
2020-08-25 22:51:44 -04:00
Jesse Wilson
1283ceed94 Merge pull request #1185 from square/jwilson.0801.public_promoteNameToValue
Make JsonReader.promoteNameToValue() a public API
2020-08-05 11:10:24 -04:00
Jesse Wilson
1dd9cd0b3b Make JsonReader.promoteNameToValue() a public API 2020-08-05 10:23:24 -04:00
Jesse Wilson
50d09d476b Merge pull request #1182 from square/jwilson.0730.simplify
Simplify the internals of PolymorphicJsonAdapterFactory
2020-07-30 23:12:37 -04:00
Zac Sweers
aa18c6857c Expose getStrings() option on JsonReader.Options (#1180)
* Expose getStrings() option on JsonReader.Options

Resolves #1173

* Fix clone

Co-authored-by: Jake Wharton <github@jakewharton.com>

* Add mutation check

* Use set and make it unmodifiable

* Back to list

* strings()

* No clone()

Co-authored-by: Jake Wharton <github@jakewharton.com>
2020-07-30 23:10:41 -04:00
Jesse Wilson
2b5b3b5f8e Simplify the internals of PolymorphicJsonAdapterFactory
We don't need a custom JsonAdapter subclass - we can just call through
unconditionally and fail if the type is unexpected.
2020-07-30 22:34:09 -04:00
Samuele Maci
cd31e5ce52 Extend PolymorphicJsonAdapterFactory to allow custom handling of unknown labels (#1094)
* PolymorphicJsonAdapter uses JsonAdapter as fallback value instead of defaultValue

* PolymorphicJsonAdapterFactory uses fallbackJsonAdapter instead of (defaultValue, defaultValueSet)

* Add testing coverage
2020-07-30 22:01:42 -04:00
Jesse Wilson
61e5ff34cc Merge pull request #1152 from Tolriq/R8_fix
Fix R8 keeping all Kotlin metadata when using Moshi.
2020-07-30 21:41:54 -04:00
Jesse Wilson
d6d9b5d8bc Merge pull request #1181 from ZacSweers/patch-4
Update README notes about R8/proguard
2020-07-30 21:39:41 -04:00
Zac Sweers
3eb95f277c Update README notes about R8/proguard
Resolves #1166
2020-07-29 00:07:41 -04:00
Jesse Wilson
7f2630daee Merge pull request #1168 from vladimirov001/kotlin_verify_error_on_android_kitkat_devices
R8 triggers VerifyError on KitKat devices
2020-06-26 07:27:15 -04:00
Oleg Vladimirov
6eb65908e0 bugfix 2020-06-26 13:28:00 +03:00
Jake Wharton
7462d32d9d Merge pull request #1161 from ZacSweers/patch-3
Fix typo in 1.9.3 changelog notes
2020-06-15 09:41:26 -04:00
Zac Sweers
d55248b4ab Fix typo in 1.9.3 changelog notes 2020-06-15 02:35:13 -04:00
Jake Wharton
7829f9a65b Prepare version 1.9.3
(cherry picked from commit c7d0766c03842a411d52d691de343dd4f874f1d7)
2020-06-12 11:42:08 -04:00
Jake Wharton
d07040ce17 Merge pull request #1155 from square/jw/wrapper/2020-06-08
Add Maven wrapper
2020-06-10 08:32:38 -04:00
Jake Wharton
c63f7cc5d0 Add Maven wrapper 2020-06-08 20:09:58 -04:00
Tolriq
8c8c5977a7 R8 now have automatic detection of Class.forName and auto generate keep rules.
This makes application build with Moshi to keep unwanted Kotlin Metadata that have a huge impact on APK size.

After discussion with R8 team, there's currently no solution to avoid this other than using the trick in this PR.

Fixes https://github.com/square/moshi/issues/1115
2020-06-04 18:09:10 +02:00
Ryan Harter
dd8611a1d9 Merge pull request #1080 from square/z/resolveRealTypes
Fix resolution of types in superclass settable properties
2020-05-26 17:53:45 -05:00
Jake Wharton
0c85eae34a Merge pull request #1142 from sarthakz9/patch-1
small correction in given example
2020-05-18 09:46:41 -04:00