From 7d154c988c134cc1cb61180fd085007012ca2756 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sat, 23 Sep 2023 12:32:25 +0800 Subject: [PATCH] [kotlin-client] add spotless plugin (#16645) * add spotless plugin to kotlin client * add spotless plugin to kotlin client * use 6.13.0 --- .../kotlin-client/build.gradle.mustache | 24 +++++++++++++++++++ .../build.gradle | 24 +++++++++++++++++++ .../kotlin-allOff-discriminator/build.gradle | 24 +++++++++++++++++++ .../build.gradle | 24 +++++++++++++++++++ .../build.gradle | 24 +++++++++++++++++++ .../build.gradle | 24 +++++++++++++++++++ .../build.gradle | 24 +++++++++++++++++++ .../build.gradle | 24 +++++++++++++++++++ .../build.gradle | 24 +++++++++++++++++++ .../kotlin-enum-default-value/build.gradle | 24 +++++++++++++++++++ .../client/petstore/kotlin-gson/build.gradle | 24 +++++++++++++++++++ .../petstore/kotlin-jackson/build.gradle | 24 +++++++++++++++++++ .../kotlin-json-request-string/build.gradle | 24 +++++++++++++++++++ .../petstore/kotlin-jvm-jackson/build.gradle | 24 +++++++++++++++++++ .../kotlin-jvm-ktor-gson/build.gradle | 24 +++++++++++++++++++ .../kotlin-jvm-ktor-jackson/build.gradle | 24 +++++++++++++++++++ .../build.gradle | 24 +++++++++++++++++++ .../build.gradle | 24 +++++++++++++++++++ .../build.gradle | 24 +++++++++++++++++++ .../build.gradle | 24 +++++++++++++++++++ .../kotlin-jvm-vertx-gson/build.gradle | 24 +++++++++++++++++++ .../build.gradle | 24 +++++++++++++++++++ .../kotlin-jvm-vertx-jackson/build.gradle | 24 +++++++++++++++++++ .../kotlin-jvm-vertx-moshi/build.gradle | 24 +++++++++++++++++++ .../petstore/kotlin-modelMutable/build.gradle | 24 +++++++++++++++++++ .../kotlin-moshi-codegen/build.gradle | 24 +++++++++++++++++++ .../build.gradle | 24 +++++++++++++++++++ .../petstore/kotlin-nonpublic/build.gradle | 24 +++++++++++++++++++ .../petstore/kotlin-nullable/build.gradle | 24 +++++++++++++++++++ .../petstore/kotlin-okhttp3/build.gradle | 24 +++++++++++++++++++ .../build.gradle | 24 +++++++++++++++++++ .../kotlin-retrofit2-rx3/build.gradle | 24 +++++++++++++++++++ .../petstore/kotlin-retrofit2/build.gradle | 24 +++++++++++++++++++ .../petstore/kotlin-string/build.gradle | 24 +++++++++++++++++++ .../petstore/kotlin-threetenbp/build.gradle | 24 +++++++++++++++++++ .../kotlin-uppercase-enum/build.gradle | 24 +++++++++++++++++++ samples/client/petstore/kotlin/build.gradle | 24 +++++++++++++++++++ 37 files changed, 888 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache index b863ab98bc3..63dc33d1dbe 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/build.gradle.mustache @@ -37,6 +37,7 @@ buildscript { {{/useSpringBoot3}} ext.reactor_version = "3.5.6" {{/jvm-spring-webclient}} + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } @@ -46,6 +47,7 @@ buildscript { {{#kotlinx_serialization}} classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" {{/kotlinx_serialization}} + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } @@ -63,6 +65,7 @@ apply plugin: 'kotlinx-serialization' apply plugin: 'idea' {{/idea}} apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' {{^useSettingsGradle}} repositories { @@ -70,6 +73,27 @@ repositories { } {{/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() } diff --git a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/build.gradle b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/build.gradle index da2286f5db4..ef3c9f3e56e 100644 --- a/samples/client/others/kotlin-jvm-okhttp-parameter-tests/build.gradle +++ b/samples/client/others/kotlin-jvm-okhttp-parameter-tests/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-allOff-discriminator/build.gradle b/samples/client/petstore/kotlin-allOff-discriminator/build.gradle index da2286f5db4..ef3c9f3e56e 100644 --- a/samples/client/petstore/kotlin-allOff-discriminator/build.gradle +++ b/samples/client/petstore/kotlin-allOff-discriminator/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp3/build.gradle b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp3/build.gradle index fb6ed41cddf..89355e8ec3b 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp3/build.gradle +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp3/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/build.gradle b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/build.gradle index da2286f5db4..ef3c9f3e56e 100644 --- a/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/build.gradle +++ b/samples/client/petstore/kotlin-array-simple-string-jvm-okhttp4/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/build.gradle b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/build.gradle index da2286f5db4..ef3c9f3e56e 100644 --- a/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/build.gradle +++ b/samples/client/petstore/kotlin-bigdecimal-default-okhttp4/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-default-values-jvm-okhttp3/build.gradle b/samples/client/petstore/kotlin-default-values-jvm-okhttp3/build.gradle index fb6ed41cddf..89355e8ec3b 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-okhttp3/build.gradle +++ b/samples/client/petstore/kotlin-default-values-jvm-okhttp3/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/build.gradle b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/build.gradle index da2286f5db4..ef3c9f3e56e 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-okhttp4/build.gradle +++ b/samples/client/petstore/kotlin-default-values-jvm-okhttp4/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/build.gradle b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/build.gradle index be9c38498e5..6bf361e782a 100644 --- a/samples/client/petstore/kotlin-default-values-jvm-retrofit2/build.gradle +++ b/samples/client/petstore/kotlin-default-values-jvm-retrofit2/build.gradle @@ -9,22 +9,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' ext.retrofitVersion = '2.9.0' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-enum-default-value/build.gradle b/samples/client/petstore/kotlin-enum-default-value/build.gradle index da2286f5db4..ef3c9f3e56e 100644 --- a/samples/client/petstore/kotlin-enum-default-value/build.gradle +++ b/samples/client/petstore/kotlin-enum-default-value/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-gson/build.gradle b/samples/client/petstore/kotlin-gson/build.gradle index f9c643efd5b..c3f04c5a8a6 100644 --- a/samples/client/petstore/kotlin-gson/build.gradle +++ b/samples/client/petstore/kotlin-gson/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-jackson/build.gradle b/samples/client/petstore/kotlin-jackson/build.gradle index 2b6af9d0297..6c93cb98f2a 100644 --- a/samples/client/petstore/kotlin-jackson/build.gradle +++ b/samples/client/petstore/kotlin-jackson/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-json-request-string/build.gradle b/samples/client/petstore/kotlin-json-request-string/build.gradle index aaddcd6b2be..e7abb9b24ba 100644 --- a/samples/client/petstore/kotlin-json-request-string/build.gradle +++ b/samples/client/petstore/kotlin-json-request-string/build.gradle @@ -8,6 +8,7 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } @@ -15,6 +16,7 @@ buildscript { dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } @@ -22,11 +24,33 @@ apply plugin: 'kotlin' apply plugin: 'kotlin-parcelize' apply plugin: 'kotlinx-serialization' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-jvm-jackson/build.gradle b/samples/client/petstore/kotlin-jvm-jackson/build.gradle index ac97eba4b2d..303a58910c4 100644 --- a/samples/client/petstore/kotlin-jvm-jackson/build.gradle +++ b/samples/client/petstore/kotlin-jvm-jackson/build.gradle @@ -9,22 +9,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' ext.retrofitVersion = '2.9.0' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/build.gradle b/samples/client/petstore/kotlin-jvm-ktor-gson/build.gradle index c5b6848fd20..0acb298375b 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/build.gradle +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/build.gradle @@ -9,22 +9,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' ext.ktor_version = '2.1.3' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/build.gradle b/samples/client/petstore/kotlin-jvm-ktor-jackson/build.gradle index c363bccd951..7843999a8ff 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/build.gradle +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/build.gradle @@ -9,22 +9,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' ext.ktor_version = '2.1.3' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/build.gradle b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/build.gradle index ae9db1a0e75..602a3d7d96e 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/build.gradle +++ b/samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/build.gradle @@ -9,6 +9,7 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' ext.ktor_version = '2.1.3' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } @@ -16,17 +17,40 @@ buildscript { dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'kotlinx-serialization' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/build.gradle b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/build.gradle index 945679fc225..4580dc8bf83 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/build.gradle +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/build.gradle b/samples/client/petstore/kotlin-jvm-spring-2-webclient/build.gradle index 25e92ccf92a..8558ab13de1 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/build.gradle +++ b/samples/client/petstore/kotlin-jvm-spring-2-webclient/build.gradle @@ -10,22 +10,46 @@ buildscript { ext.kotlin_version = '1.8.10' ext.spring_boot_version = "2.7.12" ext.reactor_version = "3.5.6" + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/build.gradle b/samples/client/petstore/kotlin-jvm-spring-3-webclient/build.gradle index 50a422fd945..ed53c80e476 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/build.gradle +++ b/samples/client/petstore/kotlin-jvm-spring-3-webclient/build.gradle @@ -10,22 +10,46 @@ buildscript { ext.kotlin_version = '1.8.10' ext.spring_boot_version = "3.1.0" ext.reactor_version = "3.5.6" + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-jvm-vertx-gson/build.gradle b/samples/client/petstore/kotlin-jvm-vertx-gson/build.gradle index 99d01076c26..6ef0c5dfc95 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/build.gradle +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/build.gradle @@ -9,22 +9,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' ext.vertx_version = "4.3.3" + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/build.gradle b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/build.gradle index b1983802efc..86cef4fdcaa 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/build.gradle +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/build.gradle @@ -9,22 +9,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' ext.vertx_version = "4.3.3" + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson/build.gradle b/samples/client/petstore/kotlin-jvm-vertx-jackson/build.gradle index f86910fe9de..ad4b251d4e9 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/build.gradle +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/build.gradle @@ -9,22 +9,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' ext.vertx_version = "4.3.3" + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-jvm-vertx-moshi/build.gradle b/samples/client/petstore/kotlin-jvm-vertx-moshi/build.gradle index ce4b5e69b33..d7dea91eb2b 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/build.gradle +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/build.gradle @@ -9,22 +9,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' ext.vertx_version = "4.3.3" + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-modelMutable/build.gradle b/samples/client/petstore/kotlin-modelMutable/build.gradle index da2286f5db4..ef3c9f3e56e 100644 --- a/samples/client/petstore/kotlin-modelMutable/build.gradle +++ b/samples/client/petstore/kotlin-modelMutable/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-moshi-codegen/build.gradle b/samples/client/petstore/kotlin-moshi-codegen/build.gradle index e3a37382c2e..ad6631f1d60 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/build.gradle +++ b/samples/client/petstore/kotlin-moshi-codegen/build.gradle @@ -8,23 +8,47 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'kotlin-kapt' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-name-parameter-mappings/build.gradle b/samples/client/petstore/kotlin-name-parameter-mappings/build.gradle index da2286f5db4..ef3c9f3e56e 100644 --- a/samples/client/petstore/kotlin-name-parameter-mappings/build.gradle +++ b/samples/client/petstore/kotlin-name-parameter-mappings/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-nonpublic/build.gradle b/samples/client/petstore/kotlin-nonpublic/build.gradle index da2286f5db4..ef3c9f3e56e 100644 --- a/samples/client/petstore/kotlin-nonpublic/build.gradle +++ b/samples/client/petstore/kotlin-nonpublic/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-nullable/build.gradle b/samples/client/petstore/kotlin-nullable/build.gradle index da2286f5db4..ef3c9f3e56e 100644 --- a/samples/client/petstore/kotlin-nullable/build.gradle +++ b/samples/client/petstore/kotlin-nullable/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-okhttp3/build.gradle b/samples/client/petstore/kotlin-okhttp3/build.gradle index fb6ed41cddf..89355e8ec3b 100644 --- a/samples/client/petstore/kotlin-okhttp3/build.gradle +++ b/samples/client/petstore/kotlin-okhttp3/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/build.gradle b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/build.gradle index 42af71594bc..67bc628c41c 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/build.gradle +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/build.gradle @@ -9,6 +9,7 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' ext.retrofitVersion = '2.9.0' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } @@ -16,17 +17,40 @@ buildscript { dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'kotlinx-serialization' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/build.gradle b/samples/client/petstore/kotlin-retrofit2-rx3/build.gradle index dd7a1df263a..125709ed277 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/build.gradle +++ b/samples/client/petstore/kotlin-retrofit2-rx3/build.gradle @@ -10,22 +10,46 @@ buildscript { ext.kotlin_version = '1.8.10' ext.retrofitVersion = '2.9.0' ext.rxJava3Version = '3.0.12' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-retrofit2/build.gradle b/samples/client/petstore/kotlin-retrofit2/build.gradle index bce04721bfe..0a56883036c 100644 --- a/samples/client/petstore/kotlin-retrofit2/build.gradle +++ b/samples/client/petstore/kotlin-retrofit2/build.gradle @@ -9,22 +9,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' ext.retrofitVersion = '2.9.0' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-string/build.gradle b/samples/client/petstore/kotlin-string/build.gradle index da2286f5db4..ef3c9f3e56e 100644 --- a/samples/client/petstore/kotlin-string/build.gradle +++ b/samples/client/petstore/kotlin-string/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-threetenbp/build.gradle b/samples/client/petstore/kotlin-threetenbp/build.gradle index a7037fc3da8..fc7210c7174 100644 --- a/samples/client/petstore/kotlin-threetenbp/build.gradle +++ b/samples/client/petstore/kotlin-threetenbp/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin-uppercase-enum/build.gradle b/samples/client/petstore/kotlin-uppercase-enum/build.gradle index 06ed9a687c7..71e8bc81773 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/build.gradle +++ b/samples/client/petstore/kotlin-uppercase-enum/build.gradle @@ -8,6 +8,7 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } @@ -15,17 +16,40 @@ buildscript { dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'kotlinx-serialization' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() } diff --git a/samples/client/petstore/kotlin/build.gradle b/samples/client/petstore/kotlin/build.gradle index da2286f5db4..ef3c9f3e56e 100644 --- a/samples/client/petstore/kotlin/build.gradle +++ b/samples/client/petstore/kotlin/build.gradle @@ -8,22 +8,46 @@ wrapper { buildscript { ext.kotlin_version = '1.8.10' + ext.spotless_version = "6.13.0" repositories { maven { url "https://repo1.maven.org/maven2" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" } } apply plugin: 'kotlin' apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' repositories { maven { url "https://repo1.maven.org/maven2" } } +// 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() }