forked from airbytehq/airbyte-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
174 lines (159 loc) · 7.38 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
// 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.37.0" apply false
id "io.airbyte.gradle.jvm.app" version "0.37.0" apply false
id "io.airbyte.gradle.jvm.lib" version "0.37.0" apply false
id "io.airbyte.gradle.docker" version "0.37.0" apply false
id "io.airbyte.gradle.publish" version "0.37.0" apply false
id "io.airbyte.gradle.kube-reload" version "0.37.0" apply false
// uncomment for testing plugin locally
// id "io.airbyte.gradle.jvm" version "local-test" apply false
// id "io.airbyte.gradle.jvm.app" version "local-test" apply false
// id "io.airbyte.gradle.jvm.lib" version "local-test" apply false
// id "io.airbyte.gradle.docker" version "local-test" apply false
// id "io.airbyte.gradle.publish" version "local-test" apply false
}
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
}
}
}
ext {
// used for publishing jars
oss_version = System.getenv("VERSION")
// todo (cgardens) - remove the implicit behavior so it doesn't require an explanatory comment.
// for cloud (prod + stage) this is going to be an image_tag (see build-artifacts.yaml). for OSS this is going to be the oss version.
webapp_version = 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"}"
// todo (cgardens) - separate oss version and artifact version
version = oss_version
configurations.all {
resolutionStrategy {
// Ensure that the versions defined in deps.toml are used
// instead of versions from transitive dependencies
// Force to avoid updated version brought in transitively from Micronaut 3.8+
force(libs.flyway.core,
libs.jooq,
libs.s3,
libs.aws.java.sdk.s3,
libs.sts,
libs.aws.java.sdk.sts,
libs.elasticsearch,
libs.apache.mime4j.core, // Force upgrade to remediate GHSA-jw7r-rxff-gv24
libs.platform.testcontainers.postgresql)
}
}
}
// For internal use we call this from the root of the project. In the project
// mirrored to open-source, this project is the root. That means that its name
// is different by default. In the internal repo it is project(:oss) and in
// oss it is the rootProject. We create this closure and then expose it to all
// submodules so that they have a canonical way of referring to this gradle
// module.
def ossRootActual = project
subprojects {
ext {
ossRootProject = ossRootActual
}
}
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")
}
}
}
tasks.register('generate-docker') {
dependsOn(':airbyte-bootloader:assemble')
dependsOn(':airbyte-workers:assemble')
dependsOn(':airbyte-webapp:assemble')
dependsOn(':airbyte-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')
}
// todo (cgardens) - move this into the plugin.
// By default ./gradlew :oss:build doesn't do anything, so we need to manually set the dependencies.
def taskNames = ['assemble', 'build', 'check', 'clean', 'format', 'jar', 'publishToMavenLocal', 'test', 'integrationTest']
// For tasks that don't exist gradle by default, we need to register them first.
tasks.register('format')
tasks.register('jar')
tasks.register('publishToMavenLocal')
tasks.register('test')
tasks.register('integrationTest')
// For each task type register its subprojects instance of that task type as a dependency. It is
// equivalent to doing something like this:
// tasks.named('assemble') {
// dependsOn subprojects.collect { it.getTasksByName('assemble', true) }
//}
taskNames.each { taskName ->
tasks.named(taskName) {
dependsOn subprojects.collect { it.getTasksByName(taskName, true) }
}
}