Skip to content

Commit d15b5ff

Browse files
authored
Merge pull request #127 from macisamuele/maci-issue-83-remove-moshi-reflective
Drop support for moshi-kotlin (reflective approach for JSON encoding/decoding)
2 parents 14724fa + 2d94233 commit d15b5ff

File tree

12 files changed

+8
-149
lines changed

12 files changed

+8
-149
lines changed

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,15 @@ We're looking forward to more platforms to support in the future. Contributions
7676

7777
You can find some **examples** in this repository to help you set up your generator environment.
7878

79-
* [samples/groovy-android](/samples/groovy-android)<sup>*</sup> Contains an example of an Android Library configured with a `build.gradle` file, using the classical Gradle/Groovy as scripting language.
79+
* [samples/groovy-android](/samples/groovy-android) Contains an example of an Android Library configured with a `build.gradle` file, using the classical Gradle/Groovy as scripting language.
8080

81-
* [samples/kotlin-android](/samples/kotlin-android)<sup>*</sup> Contains an example of an Android Library configured with a `build.gradle.kts` file, using Kotlin as scripting language.
81+
* [samples/kotlin-android](/samples/kotlin-android) Contains an example of an Android Library configured with a `build.gradle.kts` file, using Kotlin as scripting language.
8282

83-
* [samples/kotlin-android-moshi-codegen](/samples/kotlin-android-moshi-codegen) Based on samples/kotlin-android but the configuration is using [`moshi-codegen`](https://github.com/square/moshi#codegen) for improved parsing performances and it defines proguard rules.
84-
85-
* [samples/kotlin-coroutines](/samples/kotlin-coroutines)<sup>*</sup> Contains an example of an Android Library configured to output Kotlin Coroutines capable code.
83+
* [samples/kotlin-coroutines](/samples/kotlin-coroutines) Contains an example of an Android Library configured to output Kotlin Coroutines capable code.
8684

8785
* [samples/junit-tests](/samples/junit-tests) This sample contains specs used to test edge cases and scenarios that have been reported in the issue tracker or that are worth testing. Tests are executed using [`moshi-codegen`](https://github.com/square/moshi#codegen).
8886
It does also contains all the generated code inside the `/scr/main/java` folder. You can use this example to see how the generated code will _look like_ (like [here](/samples/junit-tests/src/main/java/com/yelp/codegen/generatecodesamples/apis/ResourceApi.kt)).
8987

90-
<sup>*</sup>: The project is using [`moshi-reflect`](https://github.com/square/moshi#reflection) to convert your Kotlin classes to and from JSON.
91-
9288

9389
## How the generated code will look like
9490

@@ -138,7 +134,7 @@ Here a list of all the supported features:
138134

139135
| Feature | Description | Command line |
140136
| -------- | ----------- | ------------ |
141-
| `headersToRemove` | List of headers that needs to be ignored for every endpoints. The headers in this list will be dropped and not generated as parameters for the endpoints. | `--featureHeaderToRemove=` |
137+
| `headersToRemove` | List of headers that needs to be ignored for every endpoints. The headers in this list will be dropped and not generated as parameters for the endpoints. | `-ignoreheaders=` |
142138

143139

144140
## Building

gradle-plugin/plugin/src/main/resources/kotlin/tools/GeneratedCodeConverters.kt.mustache

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package {{packageName}}.tools
22

33
import com.squareup.moshi.Moshi
4-
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
54
import retrofit2.Converter
65
import retrofit2.converter.moshi.MoshiConverterFactory
76

87
object GeneratedCodeConverters {
98
private val moshi = Moshi.Builder()
109
.add(XNullableAdapterFactory())
11-
.add(KotlinJsonAdapterFactory())
1210
.add(TypesAdapterFactory())
1311
.build()
1412

samples/groovy-android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id("com.android.library")
33
id("kotlin-android")
44
id("com.yelp.codegen.plugin")
5+
id("kotlin-kapt")
56
}
67

78
android {
@@ -17,16 +18,15 @@ android {
1718
dependencies {
1819
// Kotlin
1920
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.70"
20-
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.70"
2121

2222
// Moshi + OkHttp + Retrofit
2323
implementation "com.squareup.moshi:moshi:1.9.2"
2424
implementation "com.squareup.moshi:moshi-adapters:1.9.2"
25-
implementation "com.squareup.moshi:moshi-kotlin:1.9.2"
2625
implementation "com.squareup.okhttp3:okhttp:3.12.3"
2726
implementation "com.squareup.retrofit2:retrofit:2.7.1"
2827
implementation "com.squareup.retrofit2:converter-moshi:2.7.1"
2928
implementation "com.squareup.retrofit2:adapter-rxjava2:2.7.1"
29+
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.9.2"
3030

3131
// Date Support
3232
implementation "com.jakewharton.threetenabp:threetenabp:1.2.2"

samples/junit-tests/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ android {
1919
dependencies {
2020
// Kotlin
2121
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.70"
22-
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.70"
2322

2423
// Moshi + OkHttp + Retrofit
2524
implementation "com.squareup.moshi:moshi:1.9.2"
2625
implementation "com.squareup.moshi:moshi-adapters:1.9.2"
27-
implementation "com.squareup.moshi:moshi-kotlin:1.9.2"
2826
implementation "com.squareup.okhttp3:okhttp:3.12.3"
2927
implementation "com.squareup.retrofit2:retrofit:2.7.1"
3028
implementation "com.squareup.retrofit2:converter-moshi:2.7.1"

samples/junit-tests/src/main/java/com/yelp/codegen/generatecodesamples/tools/GeneratedCodeConverters.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package com.yelp.codegen.generatecodesamples.tools
22

33
import com.squareup.moshi.Moshi
4-
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
54
import retrofit2.Converter
65
import retrofit2.converter.moshi.MoshiConverterFactory
76

87
object GeneratedCodeConverters {
98
private val moshi = Moshi.Builder()
109
.add(XNullableAdapterFactory())
11-
.add(KotlinJsonAdapterFactory())
1210
.add(TypesAdapterFactory())
1311
.build()
1412

samples/kotlin-android-moshi-codegen/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

samples/kotlin-android-moshi-codegen/build.gradle.kts

Lines changed: 0 additions & 60 deletions
This file was deleted.

samples/kotlin-android-moshi-codegen/moshi.pro

Lines changed: 0 additions & 65 deletions
This file was deleted.

samples/kotlin-android-moshi-codegen/src/main/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
This file was deleted.

samples/kotlin-android/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ android {
1717
dependencies {
1818
// Kotlin
1919
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.70")
20-
implementation("org.jetbrains.kotlin:kotlin-reflect:1.3.70")
2120

2221
// Moshi + OkHttp + Retrofit
2322
implementation("com.squareup.moshi:moshi:1.9.2")
2423
implementation("com.squareup.moshi:moshi-adapters:1.9.2")
25-
implementation("com.squareup.moshi:moshi-kotlin:1.9.2")
2624
implementation("com.squareup.okhttp3:okhttp:3.12.3")
2725
implementation("com.squareup.retrofit2:retrofit:2.7.1")
2826
implementation("com.squareup.retrofit2:converter-moshi:2.7.1")

0 commit comments

Comments
 (0)