Skip to content

Commit

Permalink
Add project sample with moshi-kotlin-codegen enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
macisamuele committed Jan 22, 2020
1 parent a6c4427 commit 1a80090
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
56 changes: 56 additions & 0 deletions samples/kotlin-android-with-moshi-kotlin-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
plugins {
id("com.android.library") version "3.5.3"
kotlin("android") version "1.3.61"
id("com.yelp.codegen.plugin") version "1.3.0"
kotlin("kapt") version "1.3.61"
}

android {
compileSdkVersion(28)
defaultConfig {
minSdkVersion(21)
targetSdkVersion(28)
versionCode = 1
versionName = "1.0"
}
}

dependencies {
// Kotlin
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61")

// Moshi + OkHttp + Retrofit
implementation("com.squareup.moshi:moshi:1.9.2")
implementation("com.squareup.moshi:moshi-adapters:1.9.2")
implementation("com.squareup.moshi:moshi-kotlin:1.9.2")
implementation("com.squareup.okhttp3:okhttp:3.12.3")
implementation("com.squareup.retrofit2:retrofit:2.7.1")
implementation("com.squareup.retrofit2:converter-moshi:2.7.1")
implementation("com.squareup.retrofit2:adapter-rxjava2:2.7.1")

// moshi-kapt support (codegen generation of moshi json adapters)
kapt("com.squareup.moshi:moshi-kotlin-codegen:1.9.2")

// Date Support
implementation("com.jakewharton.threetenabp:threetenabp:1.2.2")

// RxJava
implementation("io.reactivex.rxjava2:rxjava:2.2.17")
implementation("io.reactivex.rxjava2:rxandroid:2.1.1")
}

generateSwagger {
platform = "kotlin"
packageName = "com.yelp.codegen.samples"
specName = "sample_specs"
specVersion = "1.0.0"
inputFile = file("../sample_specs.json")
outputDir = file("./src/main/java/")
features {
headersToRemove = arrayOf("Accept-Language")
}
}

repositories {
mavenCentral()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yelp.samplelibrary"/>
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pluginManagement {
include(":plugin",
":samples:junit-tests",
":samples:kotlin-android",
":samples:kotlin-android-with-moshi-kotlin-codegen",
":samples:kotlin-coroutines",
":samples:groovy-android",
":samples:generated-code")

0 comments on commit 1a80090

Please sign in to comment.