Commit Graph

70 Commits

Author SHA1 Message Date
renovate[bot]
e6110de8c3 Update plugin spotless to v6.14.0 (#1620)
* Update plugin spotless to v6.14.0

* Update Spotless version and apply

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Wharton <jw@squareup.com>
2023-01-30 14:03:50 +00:00
Zac Sweers
e95af32df8 Update dependencies + Kotlin 1.7 + KotlinPoet 1.12.0 (#1543) 2022-06-13 17:02:27 -04:00
Sampath
8b30dacd1d Converted the read json list Java file to Kotlin (#1495) 2022-01-11 10:14:24 -05:00
Zac Sweers
e2c346e1de Convert util package to Kotlin (#1461)
* Rename .java to .kt

* Convert NonNullJsonAdapter

* Rename .java to .kt

* Convert NullSafeJsonAdapter

* Fix missing null-check

* Rename .java to .kt

* Convert Util (initial pass)

* Push to top-level Util

* Use extensions and properties where possible

* Use knownNotNull

* Spotless

* Clean up impl type classes a bit

* Update code gen

* Use extension for resolving

* Spotless

* Fix master conflicts

* Rename to toStringWithAnnotations()

* for (t in args.indices) {

* for (i in interfaces.indices) {

* Template
2022-01-06 14:54:13 -05:00
Jesse Wilson
7578984f25 Change the directory structure to match our modules (#1451) 2021-12-08 23:52:51 -05:00
Jesse Wilson
d5d172c3bb Switch to the Vanniktech base plugin for publishing (#1450)
* Switch to the Vanniktech base plugin for publishing

Move configuration out of build.gradle files and into build.gradle.kts files.
Sign published builds.
Support publishing release builds from GitHub actions.

* Update build.gradle.kts

Co-authored-by: Zac Sweers <zac.sweers@gmail.com>

Co-authored-by: Zac Sweers <zac.sweers@gmail.com>
2021-12-08 23:35:49 -05:00
Jesse Wilson
75abba37ef Use functions in Util where possible (#1444) 2021-12-04 17:22:12 -05:00
Zac Sweers
954ca46b9e Add @Json.ignore (#1417)
* Default Json.name to an unset value

* Promote shared transient tests to DualKotlinTest

* Add new ignore property to Json

* Support it in ClassJsonAdapter

* Mention no enum/record support

* Support in KotlinJsonAdapter

* Rework code gen API to know of "ignored"

* Support in apt code gen

* Support in KSP

* Update old non-working transient example test

* Synthetic holders

* Use field on both
2021-11-08 11:16:57 -05:00
Zac Sweers
6947ab00d0 Modernize build a bit (#1383) 2021-08-23 17:09:59 -04:00
Zac Sweers
95250b0359 Implement reflective support for Java Records (#1381)
* Standardize around JDK 8

* Update GJF to support newer JDKs

* Fix misc java 8 issues in tests

* Prepare java 16/records checking at runtime

* Implement real RecordJsonAdapter

* Spotless

* Prepare build for JDK 16+

* Fix property name for kapt

* Small cleanup

* Make FallbackEnum java-8 happy

* Remove animalsniffer

* Fix format

* Add opens for ExtendsPlatformClassWithProtectedFields

* Return null every time in shim for main tests

* Use JDK 16 + release 8 to replace animalsniffer

* Simplify accessor accessible handling

* Remove manifest attrs

* Fix typo

* Fix KCT tests + upgrade it

* Cover another

* Try explicit kotlin daemon args for java 17?

* Disable 17-ea for now until kotlin 1.5.30

* Add JsonQualifier and Json(name) tests + fix qualifiers

* Ensure constructor is accessible

* GJF it properly

* GJF 1.11

* Unwrap InvocationTargetException

* Use MethodHandle for constructor

* Use MethodHandle for accessor too

* Revert "Remove manifest attrs"

This reverts commit 3eb768fd6904bb5c979aa01c3c182e0fb9329d62.

* Proper MR jar

* *actually* fix GJF, which wasn't getting applied before

We can just enable this everywhere now since we require JDK 16 anyway

* Make IDE happy about modules access

* Fixup records tests to play nice with modules

Gotta be public

* Add complex smoke test

* Remove comment

Not a regression test in this case
2021-08-23 12:00:06 -04:00
Zac Sweers
6e5bb3a29b Prepare project for Kotlin migration (#1257) 2021-02-02 13:11:38 -05:00
Zac Sweers
bc85227f29 Add JsonString recipe to examples (#1230)
* Start recipes module with JsonString recipe

* Make recipes a kotlin project

* Move JsonString sample to examples

* Add license

* Include all java modules

* Add kotlin options

* Spotless

* Remove jvmtarget

I was today years old when I found out 1.7 isn't a valid target

* Make gradle happy

* Add codegen

* Spotless
2020-09-25 22:51:05 -04:00
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
Jesse Wilson
0a78ed4cb1 Moshi.Builder.addLast() (#1233)
This is mostly useful for KotlinJsonAdapterFactory.
2020-09-21 09:36:55 -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
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
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
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
b287596c60 [maven-release-plugin] prepare for next development iteration 2019-11-17 09:53:53 -05:00
Jesse Wilson
89a254d644 [maven-release-plugin] prepare release moshi-parent-1.9.2 2019-11-17 09:53:46 -05:00
Jesse Wilson
878e9a86d6 [maven-release-plugin] prepare for next development iteration 2019-10-30 23:26:50 -04:00
Jesse Wilson
0af27a39a6 [maven-release-plugin] prepare release moshi-parent-1.9.1 2019-10-30 23:26:43 -04:00
Jesse Wilson
4637950bab [maven-release-plugin] prepare for next development iteration 2019-10-29 07:57:56 -04:00
Jesse Wilson
0c8005bcee [maven-release-plugin] prepare release moshi-parent-1.9.0 2019-10-29 07:57:49 -04:00
Eric Cochran
a83a9b79e4 Use peekJson in the DefaultOnDataMismatchAdapter example. (#809) 2019-02-15 17:09:50 -08:00
Jesse Wilson
6b6c1af907 [maven-release-plugin] prepare for next development iteration 2018-11-09 10:04:52 +11:00
Jesse Wilson
eb7110bf59 [maven-release-plugin] prepare release moshi-parent-1.8.0 2018-11-09 10:04:36 +11:00
Jesse Wilson
2cb81857ac [maven-release-plugin] prepare for next development iteration 2018-09-24 22:55:49 -04:00
Jesse Wilson
9a652f8788 [maven-release-plugin] prepare release moshi-parent-1.7.0 2018-09-24 22:55:35 -04:00
Jesse Wilson
31ef245eeb [maven-release-plugin] prepare for next development iteration 2018-05-14 23:00:15 -04:00
Jesse Wilson
bf4d1f8693 [maven-release-plugin] prepare release moshi-parent-1.6.0 2018-05-14 23:00:02 -04:00
Jesse Wilson
986cc4c794 [maven-release-plugin] prepare for next development iteration 2018-05-06 21:50:45 -04:00
Jesse Wilson
c2f890879c [maven-release-plugin] prepare release moshi-parent-1.6.0-RC1 2018-05-06 21:50:39 -04:00
Jesse Wilson
c4e4e8582d Add an example that decodes multiple formats 2018-04-10 22:08:31 -04:00
Eric Cochran
dbdf48777c Simplify example code. (#483)
* Simplify example code.

This was copied code from a different example that used the delegate annotations.

* Make brackets consistent.
2018-04-05 11:05:40 -07:00
Eric Cochran
fbe95fe51e Add example for custom qualifier with an element. 2018-04-04 18:41:15 -07:00
Jesse Wilson
5ad9d31bd8 Move modules into their own packages.
This sets the Automatic-Module-Name for moshi, moshi-adapters, and moshi-kotlin.
It moves moshi-adapters into its own .adapters package and forwards the existing
adapter. It moves the moshi-kotlin into its own .kotlin package and forwards the
existing adapter.

I'm not certain this is necessary or sufficient, but I think it's the right idea
for JPMS compatibility.
2018-02-07 04:41:06 -05:00
Jesse Wilson
5d12c22f44 ByteStrings example. (#419)
Closes: https://github.com/square/moshi/issues/31
2018-01-07 23:04:25 -05:00
Jesse Wilson
7205690bf5 Add a standard example for JSON adapter factories. (#420)
Closes: https://github.com/square/moshi/issues/136
2018-01-07 23:04:07 -05:00
Jesse Wilson
8dfe9edc00 Merge pull request #352 from emmaguy/emmaguy/add-recipe-type-adapter-delegate
Add an example custom Adapter which delegates
2017-09-25 13:31:20 -04:00
Eric Cochran
eed3295495 Fix not writing value to JsonWriter in example. 2017-09-25 13:02:36 -04:00
Emma Guy
816f6f81c6 Add an example custom adapter which delegates 2017-09-24 13:40:01 +01:00
jwilson
798f14bda5 [maven-release-plugin] prepare for next development iteration 2017-05-14 22:20:00 -04:00
jwilson
f42ae45f4c [maven-release-plugin] prepare release moshi-parent-1.5.0 2017-05-14 22:19:55 -04:00
Jesse Wilson
c65b3bf1cb Import jsr305 and use it to mark @Nullable stuff. (#297) 2017-05-06 20:31:24 -04:00
jwilson
0ea1959b7e Enable Checkstyle 7.7. 2017-05-06 14:48:55 -04:00
jwilson
49092ece96 [maven-release-plugin] prepare for next development iteration 2017-02-04 15:20:11 -05:00
jwilson
d075a3e56a [maven-release-plugin] prepare release moshi-parent-1.4.0 2017-02-04 15:20:05 -05:00