1
0
mirror of synced 2025-12-19 18:14:56 -05:00

gradle: add kotlin support in all projects, warnings as errors (#36018)

This commit is contained in:
Marius Posta
2024-03-13 08:56:17 -07:00
committed by GitHub
parent d403d9b8d2
commit ef473c5338
13 changed files with 47 additions and 29 deletions

View File

@@ -1,8 +1,3 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.9.22'
}
final var cdkVersion = {
var props = new Properties()
@@ -10,13 +5,9 @@ final var cdkVersion = {
return props.getProperty('version', 'undefined')
}()
allprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'java-test-fixtures'
apply plugin: 'org.jetbrains.kotlin.jvm'
group 'io.airbyte.cdk'
@@ -53,19 +44,6 @@ allprojects {
}
}
}
compileKotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
languageVersion = KotlinVersion.KOTLIN_1_9
}
}
compileTestKotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
languageVersion = KotlinVersion.KOTLIN_1_9
}
}
}
project.configurations {

View File

@@ -26,6 +26,10 @@ jsonSchema2Pojo {
includeSetters = true
}
tasks.register('generate').configure {
dependsOn tasks.named('generateJsonSchema2Pojo')
}
dependencies {
implementation project(':airbyte-cdk:java:airbyte-cdk:dependencies')

View File

@@ -40,6 +40,7 @@ interface MinimumDestinationState {
return needsSoftReset
}
@Suppress("UNCHECKED_CAST")
override fun <T : MinimumDestinationState> withSoftReset(needsSoftReset: Boolean): T {
return copy(needsSoftReset = true) as T
}

View File

@@ -1,6 +1,5 @@
plugins {
id 'airbyte-java-connector'
id 'org.jetbrains.kotlin.jvm' version '1.9.22'
}
airbyteJavaConnector {

View File

@@ -1,6 +1,5 @@
plugins {
id 'airbyte-java-connector'
id 'org.jetbrains.kotlin.jvm' version '1.9.22'
}
airbyteJavaConnector {

View File

@@ -1,6 +1,5 @@
plugins {
id 'airbyte-java-connector'
id 'org.jetbrains.kotlin.jvm' version '1.9.22'
}
airbyteJavaConnector {

View File

@@ -11,6 +11,7 @@ data class PostgresState(val needsSoftReset: Boolean) : MinimumDestinationState
return needsSoftReset
}
@Suppress("UNCHECKED_CAST")
override fun <T : MinimumDestinationState> withSoftReset(needsSoftReset: Boolean): T {
return copy(needsSoftReset = needsSoftReset) as T
}

View File

@@ -1,7 +1,6 @@
plugins {
id 'application'
id 'airbyte-java-connector'
id 'org.jetbrains.kotlin.jvm' version '1.9.22'
}
airbyteJavaConnector {

View File

@@ -11,6 +11,7 @@ data class RedshiftState(val needsSoftReset: Boolean) : MinimumDestinationState
return needsSoftReset
}
@Suppress("UNCHECKED_CAST")
override fun <T : MinimumDestinationState> withSoftReset(needsSoftReset: Boolean): T {
return copy(needsSoftReset = needsSoftReset) as T
}

View File

@@ -1,6 +1,5 @@
plugins {
id 'airbyte-java-connector'
id 'org.jetbrains.kotlin.jvm' version '1.9.22'
}
airbyteJavaConnector {

View File

@@ -13,6 +13,7 @@ data class SnowflakeState(val needsSoftReset: Boolean) : MinimumDestinationState
return needsSoftReset
}
@Suppress("UNCHECKED_CAST")
override fun <T : MinimumDestinationState> withSoftReset(needsSoftReset: Boolean): T {
return copy(needsSoftReset = needsSoftReset) as T
}

View File

@@ -1,6 +1,5 @@
plugins {
id 'airbyte-java-connector'
id 'org.jetbrains.kotlin.jvm' version '1.9.22'
}
airbyteJavaConnector {

View File

@@ -1,10 +1,13 @@
import com.github.spotbugs.snom.Confidence
import com.github.spotbugs.snom.Effort
import com.github.spotbugs.snom.SpotBugsTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
plugins {
id 'base'
id 'com.github.spotbugs' version '6.0.7'
id 'com.github.spotbugs' version '6.0.7' apply false
id 'org.jetbrains.kotlin.jvm' version '1.9.22' apply false
}
allprojects {
@@ -12,6 +15,7 @@ allprojects {
apply plugin: 'java'
apply plugin: 'java-test-fixtures'
apply plugin: 'com.github.spotbugs'
apply plugin: 'org.jetbrains.kotlin.jvm'
// By default gradle uses directory as the project name. That works very well in a single project environment but
// projects clobber each other in an environments with subprojects when projects are in directories named identically.
@@ -58,6 +62,40 @@ allprojects {
}
}
compileKotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
languageVersion = KotlinVersion.KOTLIN_1_9
allWarningsAsErrors = true
freeCompilerArgs = ["-Xjvm-default=all"]
}
dependsOn {
tasks.matching { it.name == 'generate' }
}
}
compileTestKotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
languageVersion = KotlinVersion.KOTLIN_1_9
allWarningsAsErrors = true
freeCompilerArgs = ["-Xjvm-default=all"]
}
dependsOn {
tasks.matching { it.name == 'generate' }
}
}
compileTestFixturesKotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
languageVersion = KotlinVersion.KOTLIN_1_9
allWarningsAsErrors = true
freeCompilerArgs = ["-Xjvm-default=all"]
}
dependsOn {
tasks.matching { it.name == 'generate' }
}
}
spotbugs {
ignoreFailures = false
effort = Effort.valueOf(System.getProperty('skipSlowTests', 'false') == 'false' ? 'MAX' : 'MIN')