Skip to content

Commit 09d9a4f

Browse files
authored
Merge pull request #138 from agologan/master
2 parents e5b4835 + 3ca69f0 commit 09d9a4f

File tree

13 files changed

+47
-35
lines changed

13 files changed

+47
-35
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ Here the list of the supported platforms:
6767

6868
| Platform | Description |
6969
| -------- | ------------------------------------------ |
70-
| `kotlin` | Generates Kotlin code and Retrofit interfaces, with RxJava2 for async calls, Moshi for serialization and ThreeTenABP for Data management |
71-
| `kotlin-coroutines` | Generates Kotlin code and Retrofit interfaces, with [Kotlin Coroutines](https://kotlinlang.org/docs/reference/coroutines-overview.html) for async calls, Moshi for serialization and ThreeTenABP for Data management |
70+
| `kotlin` | Generates Kotlin code and Retrofit interfaces, with RxJava2 for async calls and Moshi for serialization |
71+
| `kotlin-coroutines` | Generates Kotlin code and Retrofit interfaces, with [Kotlin Coroutines](https://kotlinlang.org/docs/reference/coroutines-overview.html) for async calls and Moshi for serialization |
7272

7373
We're looking forward to more platforms to support in the future. Contributions are more than welcome.
7474

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ val preMerge = tasks.register("preMerge") {
5555
}
5656

5757
plugins {
58-
id("com.android.library").version("3.5.3").apply(false)
58+
id("com.android.library").version("4.0.1").apply(false)
5959
id("com.yelp.codegen.plugin").version("1.4.1").apply(false)
6060
id("io.gitlab.arturbosch.detekt").version("1.9.0").apply(false)
6161
kotlin("android").version("1.3.70").apply(false)

gradle-plugin/plugin/src/main/java/com/yelp/codegen/utils/KotlinLangUtils.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ object KotlinLangUtils {
138138
"Long" to "kotlin.Long",
139139
"Double" to "kotlin.Double",
140140
"BigDecimal" to "java.math.BigDecimal",
141-
"LocalDate" to "org.threeten.bp.LocalDate",
142-
"ZonedDateTime" to "org.threeten.bp.ZonedDateTime",
141+
"LocalDate" to "java.time.LocalDate",
142+
"ZonedDateTime" to "java.time.ZonedDateTime",
143143
"File" to "java.io.File",
144144
"List" to "kotlin.collections.List",
145145
"List<Byte>" to "kotlin.collections.List",

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import com.squareup.moshi.Moshi
77
import com.squareup.moshi.internal.Util
88
import java.lang.reflect.Type
99
import java.math.BigDecimal
10-
import org.threeten.bp.DateTimeException
11-
import org.threeten.bp.LocalDate
12-
import org.threeten.bp.LocalDateTime
13-
import org.threeten.bp.ZoneId
14-
import org.threeten.bp.ZonedDateTime
15-
import org.threeten.bp.format.DateTimeFormatter
10+
import java.time.DateTimeException
11+
import java.time.LocalDate
12+
import java.time.LocalDateTime
13+
import java.time.ZoneId
14+
import java.time.ZonedDateTime
15+
import java.time.format.DateTimeFormatter
1616

1717
/**
1818
* Moshi Factory to handle all the custom types we want to support,

gradle-plugin/plugin/src/test/java/com/yelp/codegen/KotlinGeneratorTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ class KotlinGeneratorTest {
244244
@Test
245245
fun toModelName_withImportMapping() {
246246
val generator = KotlinGenerator()
247-
generator.importMapping()["threeten"] = "org.threeten.bp.LocalDate"
248-
assertEquals("threeten", generator.toModelName("threeten"))
247+
generator.importMapping()["Instant"] = "java.time.Instant"
248+
assertEquals("Instant", generator.toModelName("Instant"))
249249
}
250250

251251
@Test

samples/groovy-android/build.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ android {
1313
versionCode = 1
1414
versionName = "1.0"
1515
}
16+
compileOptions {
17+
coreLibraryDesugaringEnabled true
18+
sourceCompatibility JavaVersion.VERSION_1_8
19+
targetCompatibility JavaVersion.VERSION_1_8
20+
}
1621
}
1722

1823
dependencies {
@@ -28,8 +33,8 @@ dependencies {
2833
implementation "com.squareup.retrofit2:adapter-rxjava2:2.7.1"
2934
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.9.2"
3035

31-
// Date Support
32-
implementation "com.jakewharton.threetenabp:threetenabp:1.2.2"
36+
// Date Support via Desugaring
37+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.9'
3338

3439
// RxJava
3540
implementation "io.reactivex.rxjava2:rxjava:2.2.17"

samples/junit-tests/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ dependencies {
1818
implementation "com.squareup.retrofit2:adapter-rxjava2:2.7.1"
1919
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.9.2"
2020

21-
// Date Support
22-
implementation "com.jakewharton.threetenabp:threetenabp:1.2.2"
23-
2421
// RxJava
2522
implementation "io.reactivex.rxjava2:rxjava:2.2.17"
2623
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"

samples/junit-tests/src/main/java/com/yelp/codegen/generatecodesamples/models/FormatResponses.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ package com.yelp.codegen.generatecodesamples.models
88

99
import com.squareup.moshi.Json
1010
import com.squareup.moshi.JsonClass
11-
import org.threeten.bp.LocalDate
12-
import org.threeten.bp.ZonedDateTime
11+
import java.time.LocalDate
12+
import java.time.ZonedDateTime
1313

1414
/**
1515
* @property dateProperty

samples/junit-tests/src/main/java/com/yelp/codegen/generatecodesamples/models/XnullableFormatResponses.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ package com.yelp.codegen.generatecodesamples.models
99
import com.squareup.moshi.Json
1010
import com.squareup.moshi.JsonClass
1111
import com.yelp.codegen.generatecodesamples.tools.XNullable
12-
import org.threeten.bp.LocalDate
13-
import org.threeten.bp.ZonedDateTime
12+
import java.time.LocalDate
13+
import java.time.ZonedDateTime
1414

1515
/**
1616
* @property dateProperty

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import com.squareup.moshi.JsonReader
55
import com.squareup.moshi.JsonWriter
66
import com.squareup.moshi.Moshi
77
import com.squareup.moshi.internal.Util
8-
import org.threeten.bp.DateTimeException
9-
import org.threeten.bp.LocalDate
10-
import org.threeten.bp.LocalDateTime
11-
import org.threeten.bp.ZoneId
12-
import org.threeten.bp.ZonedDateTime
13-
import org.threeten.bp.format.DateTimeFormatter
148
import java.lang.reflect.Type
159
import java.math.BigDecimal
10+
import java.time.DateTimeException
11+
import java.time.LocalDate
12+
import java.time.LocalDateTime
13+
import java.time.ZoneId
14+
import java.time.ZonedDateTime
15+
import java.time.format.DateTimeFormatter
1616

1717
/**
1818
* Moshi Factory to handle all the custom types we want to support,

0 commit comments

Comments
 (0)