All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kotlin-client.build.gradle.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
group '{{groupId}}'
version '{{artifactVersion}}'
{{^omitGradleWrapper}}

wrapper {
    gradleVersion = '7.5'
    distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
{{/omitGradleWrapper}}

buildscript {
    ext.kotlin_version = '1.8.10'
    {{#jvm-ktor}}
    ext.ktor_version = '2.2.3'
    {{/jvm-ktor}}
    {{#jvm-retrofit2}}
    ext.retrofitVersion = '2.9.0'
    {{/jvm-retrofit2}}
    {{#useRxJava}}
    ext.rxJavaVersion = '1.3.8'
    {{/useRxJava}}
    {{#useRxJava2}}
    ext.rxJava2Version = '2.2.21'
    {{/useRxJava2}}
    {{#useRxJava3}}
    ext.rxJava3Version = '3.0.12'
    {{/useRxJava3}}
    {{#jvm-vertx}}
    ext.vertx_version = "4.3.3"
    {{/jvm-vertx}}
    {{#jvm-spring}}
    {{#useSpringBoot3}}
    ext.spring_boot_version = "3.2.0"
    {{/useSpringBoot3}}
    {{^useSpringBoot3}}
    ext.spring_boot_version = "2.7.12"
    {{/useSpringBoot3}}
    {{#jvm-spring-webclient}}
    ext.reactor_version = "3.5.6"
    {{/jvm-spring-webclient}}
    {{/jvm-spring}}
    ext.spotless_version = "6.13.0"

    repositories {
        maven { url "https://repo1.maven.org/maven2" }
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        {{#kotlinx_serialization}}
        classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
        {{/kotlinx_serialization}}
        classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version"
    }
}

apply plugin: 'kotlin'
{{#moshiCodeGen}}
apply plugin: 'kotlin-kapt'
{{/moshiCodeGen}}
{{#parcelizeModels}}
apply plugin: 'kotlin-parcelize'
{{/parcelizeModels}}
{{#kotlinx_serialization}}
apply plugin: 'kotlinx-serialization'
{{/kotlinx_serialization}}
{{#idea}}
apply plugin: 'idea'
{{/idea}}
apply plugin: 'maven-publish'
apply plugin: 'com.diffplug.spotless'
{{^useSettingsGradle}}

repositories {
    maven { url "https://repo1.maven.org/maven2" }
}
{{/useSettingsGradle}}

// Use spotless plugin to automatically format code, remove unused import, etc
// To apply changes directly to the file, run `gradlew spotlessApply`
// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle
spotless {
    // comment out below to run spotless as part of the `check` task
    enforceCheck false

    format 'misc', {
        // define the files (e.g. '*.gradle', '*.md') to apply `misc` to
        target '.gitignore'

        // define the steps to apply to those files
        trimTrailingWhitespace()
        indentWithSpaces() // Takes an integer argument if you don't like 4
        endWithNewline()
    }
    kotlin {
        ktfmt()
    }
}

test {
    useJUnitPlatform()
}
{{#idea}}

idea {
    module {
        sourceDirs += file('src/main/kotlin')
        testSourceDirs += file('src/test/kotlin')
    }
}
{{/idea}}
{{#jvm-spring-webclient}}{{#useSpringBoot3}}
kotlin {
    jvmToolchain {
        languageVersion.set(JavaLanguageVersion.of(17))
    }
}
{{/useSpringBoot3}}{{/jvm-spring-webclient}}
{{#jvm-spring-restclient}}
kotlin {
    jvmToolchain {
        languageVersion.set(JavaLanguageVersion.of(17))
    }
}
{{/jvm-spring-restclient}}
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    {{^doNotUseRxAndCoroutines}}
    {{#useCoroutines}}
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
    {{/useCoroutines}}
    {{/doNotUseRxAndCoroutines}}
    {{#moshi}}
    {{^moshiCodeGen}}
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    implementation "com.squareup.moshi:moshi-kotlin:1.14.0"
    implementation "com.squareup.moshi:moshi-adapters:1.14.0"
    {{/moshiCodeGen}}
    {{#moshiCodeGen}}
    implementation "com.squareup.moshi:moshi:1.14.0"
    implementation "com.squareup.moshi:moshi-adapters:1.14.0"
    kapt "com.squareup.moshi:moshi-kotlin-codegen:1.14.0"
    {{/moshiCodeGen}}
    {{/moshi}}
    {{#gson}}
    implementation "com.google.code.gson:gson:2.9.0"
    {{/gson}}
    {{#jackson}}
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.14.3"
    implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.3"
    {{/jackson}}
    {{#kotlinx_serialization}}
    implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1"
    {{/kotlinx_serialization}}
    {{#jvm-ktor}}
    implementation "io.ktor:ktor-client-core:$ktor_version"
    implementation "io.ktor:ktor-client-content-negotiation:$ktor_version"
    {{#gson}}
    implementation "io.ktor:ktor-serialization-gson:$ktor_version"
    implementation "io.ktor:ktor-client-gson:$ktor_version"
    {{/gson}}
    {{#jackson}}
    implementation "io.ktor:ktor-client-jackson:$ktor_version"
    implementation "io.ktor:ktor-serialization-jackson:$ktor_version"
    {{/jackson}}
    {{/jvm-ktor}}
    {{#jvm-okhttp3}}
    implementation "com.squareup.okhttp3:okhttp:3.12.13"
    {{/jvm-okhttp3}}
    {{#jvm-okhttp4}}
    implementation "com.squareup.okhttp3:okhttp:4.11.0"
    {{/jvm-okhttp4}}
    {{#jvm-spring-webclient}}
    implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version"
    implementation "io.projectreactor:reactor-core:$reactor_version"
    {{/jvm-spring-webclient}}
    {{#jvm-spring-restclient}}
    implementation "org.springframework.boot:spring-boot-starter-web:$spring_boot_version"
    {{/jvm-spring-restclient}}
    {{#threetenbp}}
    implementation "org.threeten:threetenbp:1.6.8"
    {{/threetenbp}}
    {{#kotlinx-datetime}}
    implementation "org.jetbrains.kotlinx:kotlinx-datetime:0.4.0"
    {{/kotlinx-datetime}}
    {{#jvm-retrofit2}}
    {{#hasOAuthMethods}}
    implementation "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2"
    {{/hasOAuthMethods}}
    implementation "com.squareup.okhttp3:logging-interceptor:4.10.0"
    {{#useRxJava}}
    implementation "io.reactivex:rxjava:$rxJavaVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion"
    {{/useRxJava}}
    {{#useRxJava2}}
    implementation "io.reactivex.rxjava2:rxjava:$rxJava2Version"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
    {{/useRxJava2}}
    {{#useRxJava3}}
    implementation "io.reactivex.rxjava3:rxjava:$rxJava3Version"
    implementation "com.squareup.retrofit2:adapter-rxjava3:2.9.0"
    {{/useRxJava3}}
    implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
    {{#gson}}
    implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
    {{/gson}}
    {{#moshi}}
    implementation "com.squareup.retrofit2:converter-moshi:$retrofitVersion"
    {{/moshi}}
    {{#kotlinx_serialization}}
    implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
    {{/kotlinx_serialization}}
    {{#jackson}}
    implementation "com.squareup.retrofit2:converter-jackson:$retrofitVersion"
    {{/jackson}}
    implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
    {{/jvm-retrofit2}}
    testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
    {{#jvm-vertx}}
    implementation "io.vertx:vertx-web-client:$vertx_version"
    implementation "io.vertx:vertx-core:$vertx_version"
    implementation "io.vertx:vertx-lang-kotlin:$vertx_version"
    implementation "io.vertx:vertx-uri-template:$vertx_version"
    {{#useCoroutines}}
    implementation "io.vertx:vertx-lang-kotlin-coroutines:$vertx_version"
    {{/useCoroutines}}
    {{/jvm-vertx}}
}
{{#kotlinx_serialization}}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
    kotlinOptions {
        freeCompilerArgs += "-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi"
    }
}
{{/kotlinx_serialization}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy