Skip to content

Commit

Permalink
update oss to use gradle-plugins (#7593)
Browse files Browse the repository at this point in the history
Co-authored-by: Jose Pefaur <[email protected]>
Co-authored-by: Chandler Prall <[email protected]>
  • Loading branch information
3 people committed Jul 14, 2023
1 parent acfe713 commit e79bbc1
Show file tree
Hide file tree
Showing 91 changed files with 1,186 additions and 1,741 deletions.
13 changes: 10 additions & 3 deletions airbyte-analytics/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
plugins {
id 'java-library'
id "io.airbyte.gradle.jvm.lib"
id "io.airbyte.gradle.publish"
}

dependencies {
api libs.segment.java.analytics
api libs.micronaut.http

implementation libs.bundles.jackson
implementation libs.guava

implementation project(':airbyte-commons')
implementation project(':airbyte-config:config-models')
implementation project(':airbyte-config:config-persistence')
implementation project(':airbyte-json-validation')
}

Task publishArtifactsTask = getPublishArtifactsTask("$rootProject.ext.version", project)
testRuntimeOnly libs.junit.jupiter.engine
testImplementation libs.bundles.junit
testImplementation libs.assertj.core
testImplementation libs.junit.pioneer
}
31 changes: 19 additions & 12 deletions airbyte-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask

plugins {
id "java-library"
alias(libs.plugins.openapi.generator)
id "io.airbyte.gradle.jvm.lib"
id "io.airbyte.gradle.publish"
id "org.openapi.generator"
}

def specFile = "$projectDir/src/main/openapi/config.yaml"

tasks.register('generateApiServer', GenerateTask) {
def genApiServer = tasks.register("generateApiServer", GenerateTask) {
def serverOutputDir = "$buildDir/generated/api/server"

inputs.file specFile
Expand Down Expand Up @@ -36,9 +37,9 @@ tasks.register('generateApiServer', GenerateTask) {
generateApiDocumentation = false

configOptions = [
dateLibrary : "java8",
generatePom : "false",
interfaceOnly: "true",
dateLibrary : "java8",
generatePom : "false",
interfaceOnly : "true",
/*
JAX-RS generator does not respect nullable properties defined in the OpenApi Spec.
It means that if a field is not nullable but not set it is still returning a null value for this field in the serialized json.
Expand All @@ -49,11 +50,11 @@ tasks.register('generateApiServer', GenerateTask) {
additionalModelTypeAnnotations: "\n@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)",

// Generate separate classes for each endpoint "domain"
useTags: "true"
useTags : "true"
]
}

tasks.register('generateApiClient', GenerateTask) {
def genApiClient = tasks.register("generateApiClient", GenerateTask) {
def clientOutputDir = "$buildDir/generated/api/client"

inputs.file specFile
Expand Down Expand Up @@ -89,7 +90,7 @@ tasks.register('generateApiClient', GenerateTask) {
]
}

tasks.register('generateApiDocs', GenerateTask) {
def genApiDocs = tasks.register("generateApiDocs", GenerateTask) {
def docsOutputDir = "$buildDir/generated/api/docs"

generatorName = "html"
Expand Down Expand Up @@ -120,15 +121,23 @@ tasks.register('generateApiDocs', GenerateTask) {
]
}

compileJava.dependsOn tasks.generateApiServer, tasks.generateApiClient, tasks.generateApiDocs
compileJava.dependsOn genApiDocs, genApiClient, genApiServer

dependencies {
implementation libs.guava
implementation libs.commons.io
implementation libs.slf4j.api
implementation libs.jackson.datatype
implementation libs.swagger.annotations
implementation libs.javax.annotation.api
implementation libs.javax.ws.rs.api
implementation libs.javax.validation.api
implementation libs.openapi.jackson.databind.nullable

testRuntimeOnly libs.junit.jupiter.engine
testImplementation libs.bundles.junit
testImplementation libs.assertj.core
testImplementation libs.junit.pioneer
}

sourceSets {
Expand All @@ -141,5 +150,3 @@ sourceSets {
}
}
}

Task publishArtifactsTask = getPublishArtifactsTask("$rootProject.ext.version", project)
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ public static <T> T retryWithJitter(final Callable<T> call,
try {
return retryWithJitterThrows(call, desc, jitterMaxIntervalSecs, finalIntervalSecs, maxTries);
} catch (final Exception e) {
LOGGER.error("retryWithJitter caught and ignoring exception:\n{}: {}", desc, e.getMessage(), e);
// Swallowing exception on purpose
return null;
}
Expand Down
13 changes: 2 additions & 11 deletions airbyte-bootloader/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
ARG JDK_IMAGE=airbyte/airbyte-base-java-image:2.0.3
FROM ${JDK_IMAGE}

ARG VERSION=0.50.7

ENV APPLICATION airbyte-bootloader
ENV VERSION ${VERSION}

WORKDIR /app

ADD bin/${APPLICATION}-${VERSION}.tar /app


ENTRYPOINT ["/bin/bash", "-c", "${APPLICATION}-${VERSION}/bin/${APPLICATION}"]
ADD airbyte-app.tar /app
ENTRYPOINT ["/bin/bash", "-c", "airbyte-app/bin/airbyte-bootloader"]
52 changes: 25 additions & 27 deletions airbyte-bootloader/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
plugins {
id 'application'
id "io.airbyte.gradle.jvm.app"
id "io.airbyte.gradle.docker"
id "io.airbyte.gradle.publish"
}

configurations.all {
Expand All @@ -16,6 +18,9 @@ dependencies {
implementation libs.bundles.micronaut
implementation libs.flyway.core
implementation libs.jooq
implementation libs.guava
compileOnly libs.lombok
annotationProcessor libs.lombok

implementation project(':airbyte-commons')
implementation project(':airbyte-config:init')
Expand All @@ -30,41 +35,34 @@ dependencies {
testAnnotationProcessor platform(libs.micronaut.bom)
testAnnotationProcessor libs.bundles.micronaut.test.annotation.processor

testCompileOnly libs.lombok
testAnnotationProcessor libs.lombok

testImplementation libs.bundles.micronaut.test
testImplementation libs.bundles.junit
testImplementation libs.junit.jupiter.system.stubs
testImplementation libs.platform.testcontainers.postgresql
}

application {
applicationName = project.name
mainClass = 'io.airbyte.bootloader.Application'
applicationDefaultJvmArgs = ['-XX:+ExitOnOutOfMemoryError', '-XX:MaxRAMPercentage=75.0']
testRuntimeOnly libs.junit.jupiter.engine
testImplementation libs.bundles.junit
testImplementation libs.assertj.core
testImplementation libs.junit.pioneer
}

Properties env = new Properties()
rootProject.file('.env.dev').withInputStream { env.load(it) }

run {
// default for running on local machine.
env.each { entry ->
environment entry.getKey(), entry.getValue()
airbyte {
application {
mainClass = 'io.airbyte.bootloader.Application'
defaultJvmArgs = ['-XX:+ExitOnOutOfMemoryError', '-XX:MaxRAMPercentage=75.0']
localEnvVars = env + [
"AIRBYTE_ROLE" : System.getenv("AIRBYTE_ROLE") ?: "undefined",
"AIRBYTE_VERSION": env.VERSION,
"DATABASE_URL" : 'jdbc:postgresql://localhost:5432/airbyte'
] as Map<String, String>
}

environment 'AIRBYTE_ROLE', System.getenv('AIRBYTE_ROLE')
environment 'AIRBYTE_VERSION', env.VERSION
environment 'DATABASE_URL', 'jdbc:postgresql://localhost:5432/airbyte'
}

// produce reproducible archives
// (see https://docs.gradle.org/current/userguide/working_with_files.html#sec:reproducible_archives)
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}

tasks.named("buildDockerImage") {
dependsOn copyGeneratedTar
docker {
imageName = "bootloader"
}
}

Task publishArtifactsTask = getPublishArtifactsTask("$rootProject.ext.version", project)
1 change: 0 additions & 1 deletion airbyte-bootloader/gradle.properties

This file was deleted.

10 changes: 5 additions & 5 deletions airbyte-bootloader/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ datasources:
connection-test-query: SELECT 1
connection-timeout: 30000
idle-timeout: 600000
initialization-fail-timeout: -1 # Disable fail fast checking to avoid issues due to other pods not being started in time
initialization-fail-timeout: -1 # Disable fail fast checking to avoid issues due to other pods not being started in time
maximum-pool-size: 5
minimum-idle: 0
url: ${DATABASE_URL}
Expand All @@ -60,7 +60,7 @@ datasources:
connection-test-query: SELECT 1
connection-timeout: 30000
idle-timeout: 600000
initialization-fail-timeout: -1 # Disable fail fast checking to avoid issues due to other pods not being started in time
initialization-fail-timeout: -1 # Disable fail fast checking to avoid issues due to other pods not being started in time
maximum-pool-size: 5
minimum-idle: 0
url: ${DATABASE_URL}
Expand Down Expand Up @@ -100,11 +100,11 @@ flyway:
config:
enabled: false
locations:
- 'classpath:io/airbyte/db/instance/configs/migrations'
- "classpath:io/airbyte/db/instance/configs/migrations"
jobs:
enabled: false
locations:
- 'classpath:io/airbyte/db/instance/jobs/migrations'
- "classpath:io/airbyte/db/instance/jobs/migrations"

jpa:
default:
Expand All @@ -124,4 +124,4 @@ jooq:
logger:
levels:
# Uncomment to help resolve issues with conditional beans
# io.micronaut.context.condition: DEBUG
# io.micronaut.context.condition: DEBUG
10 changes: 7 additions & 3 deletions airbyte-commons-converters/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id "java-library"
id "io.airbyte.gradle.jvm.lib"
id "io.airbyte.gradle.publish"
}

dependencies {
Expand Down Expand Up @@ -27,6 +28,9 @@ dependencies {
testAnnotationProcessor libs.jmh.annotations

testImplementation libs.bundles.micronaut.test
}
testRuntimeOnly libs.junit.jupiter.engine
testImplementation libs.bundles.junit
testImplementation libs.assertj.core

Task publishArtifactsTask = getPublishArtifactsTask("$rootProject.ext.version", project)
testImplementation libs.junit.pioneer
}
5 changes: 2 additions & 3 deletions airbyte-commons-micronaut/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id "java-library"
id "io.airbyte.gradle.jvm.lib"
id "io.airbyte.gradle.publish"
}

dependencies {
Expand All @@ -22,5 +23,3 @@ dependencies {
test {
maxHeapSize = '2g'
}

Task publishArtifactsTask = getPublishArtifactsTask("$rootProject.ext.version", project)
18 changes: 16 additions & 2 deletions airbyte-commons-protocol/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
id "io.airbyte.gradle.jvm"
id "io.airbyte.gradle.publish"
}

dependencies {
annotationProcessor libs.bundles.micronaut.annotation.processor
testAnnotationProcessor libs.bundles.micronaut.test.annotation.processor
Expand All @@ -8,6 +13,15 @@ dependencies {
implementation project(':airbyte-commons')
implementation libs.airbyte.protocol
implementation project(':airbyte-json-validation')
}
implementation libs.guava
compileOnly libs.lombok
annotationProcessor libs.lombok

Task publishArtifactsTask = getPublishArtifactsTask("$rootProject.ext.version", project)
implementation libs.bundles.jackson

testRuntimeOnly libs.junit.jupiter.engine
testImplementation libs.bundles.junit
testImplementation libs.assertj.core

testImplementation libs.junit.pioneer
}
15 changes: 12 additions & 3 deletions airbyte-commons-server/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id "java-library"
id "io.airbyte.gradle.jvm.lib"
id "io.airbyte.gradle.publish"
}

configurations.all {
Expand Down Expand Up @@ -43,16 +44,24 @@ dependencies {
implementation project(':airbyte-worker-models')
implementation project(':airbyte-notification')

implementation libs.bundles.apache
implementation libs.slugify
implementation libs.quartz.scheduler
implementation libs.temporal.sdk
implementation libs.swagger.annotations
implementation libs.bundles.log4j
implementation libs.commons.io
compileOnly libs.lombok
annotationProcessor libs.lombok

testImplementation project(':airbyte-test-utils')
testImplementation libs.postgresql
testImplementation libs.platform.testcontainers.postgresql
testImplementation libs.mockwebserver
testImplementation libs.mockito.inline
}

Task publishArtifactsTask = getPublishArtifactsTask("$rootProject.ext.version", project)
testRuntimeOnly libs.junit.jupiter.engine
testImplementation libs.bundles.junit
testImplementation libs.assertj.core
testImplementation libs.junit.pioneer
}
14 changes: 11 additions & 3 deletions airbyte-commons-temporal/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id "java-library"
id "io.airbyte.gradle.jvm.lib"
id "io.airbyte.gradle.publish"
}

dependencies {
Expand All @@ -25,9 +26,16 @@ dependencies {
implementation project(':airbyte-api')
implementation project(':airbyte-json-validation')

compileOnly libs.lombok
annotationProcessor libs.lombok
implementation libs.bundles.apache

testImplementation libs.temporal.testing
// Needed to be able to mock final class
testImplementation libs.mockito.inline
}
testRuntimeOnly libs.junit.jupiter.engine
testImplementation libs.bundles.junit
testImplementation libs.assertj.core

Task publishArtifactsTask = getPublishArtifactsTask("$rootProject.ext.version", project)
testImplementation libs.junit.pioneer
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private void callNotificationWorkflow(final UUID connectionId,
}
try {
notificationWorkflow.sendNotification(connectionId, SCHEMA_CHANGE_SUBJECT, message,
containsBreakingChange ? NotificationEvent.onBreakingChange : NotificationEvent.onNonBreakingChange);
containsBreakingChange ? NotificationEvent.ON_BREAKING_CHANGE : NotificationEvent.ON_NON_BREAKING_CHANGE);
} catch (final RuntimeException e) {
log.error("There was an error while sending a Schema Change Notification", e);
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void testCallNewNotifyWorkflow() {

notificationClient.sendSchemaChangeNotification(connectionId, CONNECTION_NAME, SOURCE_NAME, "", false);

verify(notificationWorkflow).sendNotification(eq(connectionId), any(), any(), eq(NotificationEvent.onNonBreakingChange));
verify(notificationWorkflow).sendNotification(eq(connectionId), any(), any(), eq(NotificationEvent.ON_NON_BREAKING_CHANGE));
}

@Test
Expand Down
Loading

0 comments on commit e79bbc1

Please sign in to comment.