From f3692adb2bcc70e67a8980f53e0d8079ce8ba6ef Mon Sep 17 00:00:00 2001 From: Cole Snodgrass Date: Tue, 19 Mar 2024 08:42:08 -0700 Subject: [PATCH] set .editorconfig format for kotlin files (#11716) --- .editorconfig | 5 ++ airbyte-cron/build.gradle.kts | 121 +++++++++++++++++----------------- settings.gradle.kts | 88 ++++++++++++------------- 3 files changed, 111 insertions(+), 103 deletions(-) diff --git a/.editorconfig b/.editorconfig index 73b614047e4..7de29a1dfa8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -23,6 +23,11 @@ ij_json_spaces_within_braces = false ij_json_spaces_within_brackets = false ij_json_wrap_long_lines = false +[*.{kt,kts}] +indent_size = 2 +max_line_length = 150 +ij_kotlin_packages_to_use_import_on_demand = unset + [{*.markdown,*.md}] ij_markdown_force_one_space_after_blockquote_symbol = true ij_markdown_force_one_space_after_header_symbol = true diff --git a/airbyte-cron/build.gradle.kts b/airbyte-cron/build.gradle.kts index 706f2d5c2e4..032063cb4ab 100644 --- a/airbyte-cron/build.gradle.kts +++ b/airbyte-cron/build.gradle.kts @@ -1,77 +1,80 @@ import java.util.Properties plugins { - id("io.airbyte.gradle.jvm.app") - id("io.airbyte.gradle.docker") - id("io.airbyte.gradle.publish") - kotlin("jvm") - kotlin("kapt") + id("io.airbyte.gradle.jvm.app") + id("io.airbyte.gradle.docker") + id("io.airbyte.gradle.publish") + kotlin("jvm") + kotlin("kapt") } dependencies { - compileOnly(libs.lombok) - annotationProcessor(libs.lombok) // Lombok must be added BEFORE Micronaut - annotationProcessor(platform(libs.micronaut.platform)) - annotationProcessor(libs.bundles.micronaut.annotation.processor) - kapt(libs.bundles.micronaut.annotation.processor) + compileOnly(libs.lombok) + annotationProcessor(libs.lombok) // Lombok must be added BEFORE Micronaut + annotationProcessor(platform(libs.micronaut.platform)) + annotationProcessor(libs.bundles.micronaut.annotation.processor) + kapt(libs.bundles.micronaut.annotation.processor) - implementation(platform(libs.micronaut.platform)) - implementation(libs.bundles.micronaut) - implementation(libs.bundles.micronaut.cache) - implementation(libs.bundles.micronaut.metrics) - implementation(libs.bundles.kubernetes.client) - implementation(libs.bundles.temporal) - implementation(libs.bundles.datadog) - implementation(libs.failsafe) - implementation(libs.failsafe.okhttp) - implementation(libs.java.jwt) - implementation(libs.kotlin.logging) - implementation(libs.okhttp) - implementation(libs.sentry.java) - implementation(libs.lombok) - implementation(libs.commons.io) + implementation(platform(libs.micronaut.platform)) + implementation(libs.bundles.micronaut) + implementation(libs.bundles.micronaut.cache) + implementation(libs.bundles.micronaut.metrics) + implementation(libs.bundles.kubernetes.client) + implementation(libs.bundles.temporal) + implementation(libs.bundles.datadog) + implementation(libs.failsafe) + implementation(libs.failsafe.okhttp) + implementation(libs.java.jwt) + implementation(libs.kotlin.logging) + implementation(libs.okhttp) + implementation(libs.sentry.java) + implementation(libs.lombok) + implementation(libs.commons.io) - implementation(project(":airbyte-api")) - implementation(project(":airbyte-analytics")) - implementation(project(":airbyte-commons")) - implementation(project(":airbyte-commons-auth")) - implementation(project(":airbyte-commons-micronaut")) - implementation(project(":airbyte-commons-temporal")) - implementation(project(":airbyte-config:config-models")) - implementation(project(":airbyte-config:config-persistence")) - implementation(project(":airbyte-config:init")) - implementation(project(":airbyte-json-validation")) - implementation(project(":airbyte-data")) - implementation(project(":airbyte-db:db-lib")) - implementation(project(":airbyte-featureflag")) - implementation(project(":airbyte-metrics:metrics-lib")) - implementation(project(":airbyte-persistence:job-persistence")) + implementation(project(":airbyte-api")) + implementation(project(":airbyte-analytics")) + implementation(project(":airbyte-commons")) + implementation(project(":airbyte-commons-auth")) + implementation(project(":airbyte-commons-micronaut")) + implementation(project(":airbyte-commons-temporal")) + implementation(project(":airbyte-config:config-models")) + implementation(project(":airbyte-config:config-persistence")) + implementation(project(":airbyte-config:init")) + implementation(project(":airbyte-json-validation")) + implementation(project(":airbyte-data")) + implementation(project(":airbyte-db:db-lib")) + implementation(project(":airbyte-featureflag")) + implementation(project(":airbyte-metrics:metrics-lib")) + implementation(project(":airbyte-persistence:job-persistence")) - runtimeOnly(libs.snakeyaml) + runtimeOnly(libs.snakeyaml) - testImplementation(libs.bundles.junit) - testImplementation(libs.mockk) + testImplementation(libs.bundles.junit) + testImplementation(libs.mockk) } -val env = Properties().apply { +val env = + Properties().apply { load(rootProject.file(".env.dev").inputStream()) -} + } airbyte { - application { - mainClass = "io.airbyte.cron.MicronautCronRunner" - defaultJvmArgs = listOf("-XX:+ExitOnOutOfMemoryError", "-XX:MaxRAMPercentage=75.0") - @Suppress("UNCHECKED_CAST") - localEnvVars.putAll(env.toMap() as Map) - localEnvVars.putAll(mapOf( - "AIRBYTE_ROLE" to (System.getenv("AIRBYTE_ROLE") ?: "undefined"), - "AIRBYTE_VERSION" to env["VERSION"].toString(), - )) - } + application { + mainClass = "io.airbyte.cron.MicronautCronRunner" + defaultJvmArgs = listOf("-XX:+ExitOnOutOfMemoryError", "-XX:MaxRAMPercentage=75.0") + @Suppress("UNCHECKED_CAST") + localEnvVars.putAll(env.toMap() as Map) + localEnvVars.putAll( + mapOf( + "AIRBYTE_ROLE" to (System.getenv("AIRBYTE_ROLE") ?: "undefined"), + "AIRBYTE_VERSION" to env["VERSION"].toString(), + ), + ) + } - docker { - imageName = "cron" - } + docker { + imageName = "cron" + } } // The DuplicatesStrategy will be required while this module is mixture of kotlin and java _with_ lombok dependencies.) @@ -80,5 +83,5 @@ airbyte { // keepJavacAnnotationProcessors enabled, which causes duplicate META-INF files to be generated.) // Once lombok has been removed, this can also be removed.) tasks.withType().configureEach { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE + duplicatesStrategy = DuplicatesStrategy.EXCLUDE } diff --git a/settings.gradle.kts b/settings.gradle.kts index cd2372f686b..34e2d39ede7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,74 +1,74 @@ pluginManagement { - repositories { - // uncomment for local dev - // maven { - // name = "localPluginRepo" - // url = uri("../.gradle-plugins-local") - // } - maven(url = "https://airbyte.mycloudrepo.io/public/repositories/airbyte-public-jars") - gradlePluginPortal() - maven(url = "https://oss.sonatype.org/content/repositories/snapshots") - } - resolutionStrategy { - eachPlugin { - // We're using the 6.1.0-SNAPSHOT version of openapi-generator which contains a fix for generating nullable arrays (https://github.com/OpenAPITools/openapi-generator/issues/13025) - // The snapshot version isn"t available in the main Gradle Plugin Portal, so we added the Sonatype snapshot repository above. - // The useModule command below allows us to map from the plugin id, `org.openapi.generator`, to the underlying module (https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-gradle-plugin/6.1.0-SNAPSHOT/_ - if (requested.id.id == "org.openapi.generator") { - useModule("org.openapitools:openapi-generator-gradle-plugin:${requested.version}") - } - } + repositories { + // uncomment for local dev + // maven { + // name = "localPluginRepo" + // url = uri("../.gradle-plugins-local") + // } + maven(url = "https://airbyte.mycloudrepo.io/public/repositories/airbyte-public-jars") + gradlePluginPortal() + maven(url = "https://oss.sonatype.org/content/repositories/snapshots") + } + resolutionStrategy { + eachPlugin { + // We're using the 6.1.0-SNAPSHOT version of openapi-generator which contains a fix for generating nullable arrays (https://github.com/OpenAPITools/openapi-generator/issues/13025) + // The snapshot version isn"t available in the main Gradle Plugin Portal, so we added the Sonatype snapshot repository above. + // The useModule command below allows us to map from the plugin id, `org.openapi.generator`, to the underlying module (https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-gradle-plugin/6.1.0-SNAPSHOT/_ + if (requested.id.id == "org.openapi.generator") { + useModule("org.openapitools:openapi-generator-gradle-plugin:${requested.version}") + } } + } } // Configure the gradle enterprise plugin to enable build scans. Enabling the plugin at the top of the settings file allows the build scan to record // as much information as possible. plugins { - id("com.gradle.enterprise") version "3.15.1" - id("com.github.burrunan.s3-build-cache") version "1.5" + id("com.gradle.enterprise") version "3.15.1" + id("com.github.burrunan.s3-build-cache") version "1.5" } gradleEnterprise { - buildScan { - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" - } + buildScan { + termsOfServiceUrl = "https://gradle.com/terms-of-service" + termsOfServiceAgree = "yes" + } } val isCiServer = System.getenv().containsKey("CI") gradleEnterprise { - buildScan { - isUploadInBackground = !isCiServer // Disable async upload so that the containers doesn't terminate the upload - buildScanPublished { - file("scan-journal.log").writeText("${java.util.Date()} - $buildScanId - ${buildScanUri}\n") - } + buildScan { + isUploadInBackground = !isCiServer // Disable async upload so that the containers doesn't terminate the upload + buildScanPublished { + file("scan-journal.log").writeText("${java.util.Date()} - $buildScanId - ${buildScanUri}\n") } + } } buildCache { - remote { - region = "us-west-2" - bucket = "ab-ci-cache" - prefix = "platform-ci-cache/" - isPush = isCiServer - isEnabled = System.getenv().containsKey("S3_BUILD_CACHE_ACCESS_KEY_ID") - } + remote { + region = "us-west-2" + bucket = "ab-ci-cache" + prefix = "platform-ci-cache/" + isPush = isCiServer + isEnabled = System.getenv().containsKey("S3_BUILD_CACHE_ACCESS_KEY_ID") + } } rootProject.name = "airbyte" // definition for dependency resolution dependencyResolutionManagement { - repositories { - maven(url = "https://airbyte.mycloudrepo.io/public/repositories/airbyte-public-jars/") - } + repositories { + maven(url = "https://airbyte.mycloudrepo.io/public/repositories/airbyte-public-jars/") + } - versionCatalogs { - create("libs") { - from(files("deps.toml")) - } + versionCatalogs { + create("libs") { + from(files("deps.toml")) } + } } // todo (cgardens) - alphabetize