forked from airbytehq/airbyte-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
252 lines (218 loc) · 10.6 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
// The buildscript block defines dependencies in order for .gradle file evaluation.
// This is separate from application dependencies.
// See https://stackoverflow.com/questions/17773817/purpose-of-buildscript-block-in-gradle.
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
// classpath 'com.bmuschko:gradle-docker-plugin:8.0.0'
// // 6.x version of OpenApi generator is only compatible with jackson-core 2.13.x onwards.
// // This conflicts with the jackson depencneis the bmuschko plugin is pulling in.
// // Since api generation is only used in the airbyte-api module and the base gradle files
// // are loaded in first, Gradle is not able to intelligently resolve this before loading in
// // the bmuschko plugin and thus placing an older jackson version on the class path.
// // The alternative is to import the openapi plugin for all modules.
// // This might need to be updated when we change openapi plugin versions.
// classpath 'com.fasterxml.jackson.core:jackson-core:2.13.0'
//
classpath 'org.codehaus.groovy:groovy-yaml:3.0.3'
}
}
plugins {
id "base"
id "com.dorongold.task-tree" version "2.1.1"
id "io.airbyte.gradle.jvm" version "0.23.2" apply false
id "io.airbyte.gradle.jvm.app" version "0.23.2" apply false
id "io.airbyte.gradle.jvm.lib" version "0.23.2" apply false
id "io.airbyte.gradle.docker" version "0.23.2" apply false
id "io.airbyte.gradle.publish" version "0.23.2" apply false
id "jacoco-report-aggregation"
}
repositories {
mavenCentral()
maven {
url 'https://airbyte.mycloudrepo.io/public/repositories/airbyte-public-jars/'
}
maven {
name = 'cloudrepo'
url = 'https://airbyte.mycloudrepo.io/repositories/airbyte-public-jars'
credentials {
username System.getenv('CLOUDREPO_USER')
password System.getenv('CLOUDREPO_PASSWORD')
}
}
}
if (System.getProperty("ciMode", "false") == "true") {
gradle.startParameter.logLevel = LogLevel.QUIET
def logFile = new FileOutputStream('gradle.log', true)
gradle.services.get(LoggingManager).addStandardOutputListener(logFile)
gradle.services.get(LoggingManager).addStandardErrorListener(logFile)
allprojects {
tasks.withType(JavaCompile) {
options.deprecation = false
options.warnings = false
}
}
}
reporting {
reports {
testAggregateTestReport(JacocoCoverageReport) {
testType = TestSuiteType.UNIT_TEST
}
}
}
dependencies {
jacocoAggregation project(":airbyte-commons")
jacocoAggregation project(":airbyte-api")
jacocoAggregation project(":airbyte-api-server")
jacocoAggregation project(":airbyte-commons-protocol")
jacocoAggregation project(":airbyte-config:specs")
jacocoAggregation project(":airbyte-config:init")
jacocoAggregation project(":airbyte-config:config-models") // reused by acceptance tests in connector base.
jacocoAggregation project(":airbyte-db:db-lib") // reused by acceptance tests in connector base.
jacocoAggregation project(":airbyte-json-validation")
jacocoAggregation project(":airbyte-metrics:metrics-lib")
jacocoAggregation project(":airbyte-oauth")
jacocoAggregation project(":airbyte-test-utils")
jacocoAggregation project(":airbyte-analytics") // transitively used by airbyte-workers.
jacocoAggregation project(":airbyte-commons-temporal")
jacocoAggregation project(":airbyte-commons-converters")
jacocoAggregation project(":airbyte-commons-worker")
jacocoAggregation project(":airbyte-config:config-persistence") // transitively used by airbyte-workers.
jacocoAggregation project(":airbyte-featureflag")
jacocoAggregation project(":airbyte-db:jooq") // transitively used by airbyte-workers.
jacocoAggregation project(":airbyte-notification") // transitively used by airbyte-workers.
jacocoAggregation project(":airbyte-persistence:job-persistence") // transitively used by airbyte-workers.
jacocoAggregation project(":airbyte-worker-models")
jacocoAggregation project(":airbyte-bootloader")
jacocoAggregation project(":airbyte-commons-auth")
jacocoAggregation project(":airbyte-commons-license")
jacocoAggregation project(":airbyte-commons-micronaut")
jacocoAggregation project(":airbyte-commons-server")
jacocoAggregation project(":airbyte-commons-with-dependencies")
jacocoAggregation project(":airbyte-connector-builder-server")
jacocoAggregation project(":airbyte-container-orchestrator")
jacocoAggregation project(":airbyte-cron")
jacocoAggregation project(":airbyte-keycloak")
jacocoAggregation project(":airbyte-keycloak-setup")
jacocoAggregation project(":airbyte-metrics:reporter")
jacocoAggregation project(":airbyte-proxy")
jacocoAggregation project(":airbyte-server")
jacocoAggregation project(":airbyte-temporal")
jacocoAggregation project(":airbyte-tests")
jacocoAggregation project(":airbyte-webapp")
jacocoAggregation project(":airbyte-workers")
}
tasks.named("check") {
dependsOn tasks.named("testAggregateTestReport", JacocoReport)
}
Properties env = new Properties()
rootProject.file('.env.dev').withInputStream { env.load(it) }
if (!env.containsKey('VERSION')) {
throw new Exception('Version not specified in .env file...')
}
// `version` is used as the application build version for artifacts like jars
// `image_tag` is used as the docker tag applied to built images.
// These values are the same for building an specific Airbyte release or branch via the 'VERSION' environment variable.
// For local development builds, the 'VERSION' environment variable is unset, and built images are tagged with 'dev'.
ext {
version = System.getenv("VERSION") ?: env.VERSION
image_tag = System.getenv("VERSION") ?: 'dev'
}
allprojects {
// 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.
def sub = rootDir.relativePath(projectDir.parentFile).replace('/', '.')
group = "io.airbyte${sub.isEmpty() ? '' : ".$sub"}"
version = rootProject.ext.version
}
tasks.register('archiveReports', Tar) {
dependsOn subprojects.collect { it.getTasksByName('checkstyleMain', true) }
dependsOn subprojects.collect { it.getTasksByName('checkstyleTest', true) }
dependsOn subprojects.collect { it.getTasksByName('jacocoTestReport', true) }
dependsOn subprojects.collect { it.getTasksByName('pmdMain', true) }
dependsOn subprojects.collect { it.getTasksByName('pmdTest', true) }
dependsOn subprojects.collect { it.getTasksByName('spotbugsMain', true) }
dependsOn subprojects.collect { it.getTasksByName('spotbugsTest', true) }
dependsOn subprojects.collect { it.getTasksByName('test', true) }
dependsOn subprojects.collect { it.getTasksByName('checkstyleAcceptanceTests', true) }
dependsOn subprojects.collect { it.getTasksByName('pmdAcceptanceTests', true) }
dependsOn subprojects.collect { it.getTasksByName('spotbugsAcceptanceTests', true) }
archiveFileName = "${project.name}-reports.tar"
destinationDirectory = layout.buildDirectory.dir('dist')
// Collect reports from each subproject
subprojects.each { subproject ->
from("${subproject.buildDir}/reports") {
into("${subproject.name}/reports")
}
}
}
subprojects { sp ->
// airbyte-webapp has not been converted to the gradle plugins
if (sp.name != "airbyte-webapp") {
return
}
apply plugin: 'base'
// configurations {
// runtimeClasspath
// }
tasks.register("copyDocker", Copy) {
from "${project.projectDir}/Dockerfile"
into "build/docker/"
}
// Although this task is defined for every subproject with the dockerImageName property,
// It is not necessarily used for all subprojects. Non-TAR producing projects can ignore this.
tasks.register("copyGeneratedTar", Copy) {
dependsOn tasks.named("copyDocker")
// dependsOn copyWellKnownTypes
dependsOn tasks.named("distTar")
from('build/distributions') {
// Assume that tars are named <parent-project-name>-<child-project-name>-*.tar.
// Because we only have a handle to the child project, and to keep things simple,
// use a * regex to catch all prefixes.
include "*$sp.name-*.tar"
}
into 'build/docker/bin'
}
tasks.register("buildDockerImage", com.bmuschko.gradle.docker.tasks.image.DockerBuildImage) {
// This is currently only used for connectors.
def jdkVersion = System.getenv('JDK_VERSION') ?: '17.0.4'
def arch = System.getenv('BUILD_ARCH') ?: System.getProperty("os.arch").toLowerCase()
def isArm64 = arch == "aarch64" || arch == "arm64"
def buildArch = System.getenv('DOCKER_BUILD_ARCH') ?: isArm64 ? 'arm64' : 'amd64'
def buildPlatform = System.getenv('DOCKER_BUILD_PLATFORM') ?: isArm64 ? 'linux/arm64' : 'linux/amd64'
def alpineImage = System.getenv('ALPINE_IMAGE') ?: isArm64 ? 'arm64v8/alpine:3.14' : 'amd64/alpine:3.14'
def nginxImage = System.getenv('NGINX_IMAGE') ?: isArm64 ? 'arm64v8/nginx:alpine' : 'amd64/nginx:alpine'
// Used by the platform -- Must be an Amazon Corretto-based image for build to work without modification to Dockerfile instructions
def openjdkImage = System.getenv('JDK_IMAGE') ?: 'airbyte/airbyte-base-java-image:2.1.0'
platform = buildPlatform
images.add("airbyte/$sp.dockerImageName:$rootProject.ext.image_tag")
buildArgs.put('JDK_VERSION', jdkVersion)
buildArgs.put('DOCKER_BUILD_ARCH', buildArch)
buildArgs.put('ALPINE_IMAGE', alpineImage)
buildArgs.put('NGINX_IMAGE', nginxImage)
buildArgs.put('JDK_IMAGE', openjdkImage)
buildArgs.put('VERSION', rootProject.ext.version)
}
tasks.named("assemble") {
dependsOn tasks.named("buildDockerImage")
}
tasks.register("dockerBuildImage") {
dependsOn tasks.named("buildDockerImage")
}
}
tasks.register('generate-docker') {
dependsOn(':airbyte-bootloader:assemble')
dependsOn(':airbyte-workers:assemble')
dependsOn(':airbyte-webapp:assemble')
dependsOn(':airbyte-server:assemble')
dependsOn(':airbyte-api-server:assemble')
dependsOn(':airbyte-db:db-lib:assemble')
dependsOn(':airbyte-config:init:assemble')
dependsOn(':airbyte-temporal:assemble')
dependsOn(':airbyte-keycloak:assemble')
dependsOn(':airbyte-keycloak-setup:assemble')
}