-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
215 lines (198 loc) · 8.58 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
import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
plugins {
id 'io.seqera.wave.java-library-conventions'
id 'io.seqera.wave.groovy-application-conventions'
id "com.github.johnrengelman.shadow" version "8.1.1"
id "io.micronaut.minimal.application" version "4.1.1"
id "com.google.cloud.tools.jib" version "3.4.2"
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'jacoco'
}
String gitVersion() {
def p = new ProcessBuilder() .command('sh','-c','git rev-parse --short HEAD') .start()
def r = p.waitFor()
return r==0 ? p.text.trim() : '(unknown)'
}
group "io.seqera"
version "${rootProject.file('VERSION').text.trim()}"
ext.commitId = gitVersion()
repositories {
mavenCentral()
maven { url = 'https://s3-eu-west-1.amazonaws.com/maven.seqera.io/releases' }
maven { url = 'https://s3-eu-west-1.amazonaws.com/maven.seqera.io/snapshots' }
}
dependencies {
annotationProcessor 'io.micronaut.validation:micronaut-validation-processor'
annotationProcessor 'io.micronaut:micronaut-http-validation'
compileOnly 'io.micronaut.data:micronaut-data-processor'
compileOnly 'io.micronaut:micronaut-inject-groovy'
compileOnly 'io.micronaut:micronaut-http-validation'
implementation 'jakarta.persistence:jakarta.persistence-api:3.0.0'
api 'io.seqera:lib-mail:1.2.1'
api 'io.seqera:lib-pool:1.0.0'
api 'io.seqera:wave-api:0.14.0'
api 'io.seqera:wave-utils:0.15.0'
implementation 'io.seqera:lib-crypto:1.0.0'
implementation 'io.micronaut:micronaut-http-client'
implementation 'io.micronaut:micronaut-jackson-databind'
implementation 'io.micronaut.groovy:micronaut-runtime-groovy'
implementation 'io.micronaut.reactor:micronaut-reactor'
implementation 'io.micronaut.reactor:micronaut-reactor-http-client'
implementation 'jakarta.annotation:jakarta.annotation-api'
implementation 'io.micronaut.validation:micronaut-validation'
implementation 'io.micronaut.security:micronaut-security'
implementation 'io.micronaut:micronaut-websocket'
implementation 'org.apache.groovy:groovy-json'
implementation 'org.apache.groovy:groovy-nio'
implementation 'com.google.guava:guava:33.3.1-jre'
implementation 'dev.failsafe:failsafe:3.1.0'
implementation 'io.micronaut.reactor:micronaut-reactor'
implementation 'io.micronaut.reactor:micronaut-reactor-http-client'
implementation 'org.apache.commons:commons-compress:1.27.1'
implementation 'org.apache.commons:commons-lang3:3.17.0'
implementation 'io.kubernetes:client-java:21.0.1'
implementation 'io.kubernetes:client-java-api-fluent:21.0.1'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml'
implementation 'com.squareup.moshi:moshi:1.15.1'
implementation 'com.squareup.moshi:moshi-adapters:1.15.1'
implementation 'redis.clients:jedis:5.1.3'
implementation 'io.github.resilience4j:resilience4j-ratelimiter:0.17.0'
implementation 'io.micronaut:micronaut-retry'
// caching deps
implementation 'io.micronaut.cache:micronaut-cache-core'
implementation 'io.micronaut.cache:micronaut-cache-caffeine'
implementation 'io.micronaut.aws:micronaut-aws-parameter-store'
implementation 'software.amazon.awssdk:ecr'
implementation 'software.amazon.awssdk:ecrpublic'
implementation 'software.amazon.awssdk:ses'
implementation 'org.yaml:snakeyaml:2.2'
implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8'
implementation 'org.luaj:luaj-jse:3.0.1'
//object storage dependency
implementation 'io.micronaut.objectstorage:micronaut-object-storage-aws'
// include sts to allow the use of service account role - https://stackoverflow.com/a/73306570
// this sts dependency is require by micronaut-aws-parameter-store,
// not directly used by the app, for this reason keeping `runtimeOnly`
runtimeOnly 'software.amazon.awssdk:sts'
runtimeOnly 'io.netty:netty-tcnative-boringssl-static:2.0.0.Final'
runtimeOnly 'javax.xml.bind:jaxb-api:2.3.1'
testImplementation 'org.testcontainers:testcontainers'
testImplementation 'org.testcontainers:mysql:1.17.3'
// --
implementation 'ch.qos.logback:logback-classic:1.5.13'
// rate limit
implementation 'com.coveo:spillway:3.0.0'
// monitoring
implementation 'io.micronaut.micrometer:micronaut-micrometer-core'
implementation 'io.micronaut.micrometer:micronaut-micrometer-registry-prometheus'
// Also required to enable endpoint
implementation 'io.micronaut:micronaut-management'
//views
implementation 'io.micronaut.views:micronaut-views-handlebars'
// upgrade indirect dependencies
runtimeOnly 'org.bouncycastle:bcpkix-jdk18on:1.78'
runtimeOnly 'org.bitbucket.b_c:jose4j:0.9.4'
runtimeOnly 'io.netty:netty-bom:4.1.115.Final'
runtimeOnly 'com.google.protobuf:protobuf-java:4.27.5'
}
application {
mainClass.set("io.seqera.wave.Application")
}
micronaut {
runtime("netty")
testRuntime("spock2")
processing {
incremental(true)
annotations("io.seqera.*")
}
}
//
// Build container image with JIB
// https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin
//
jib {
from {
image = 'cr.seqera.io/public/nf-jdk:corretto-21-al2023-jemalloc'
platforms {
platform { architecture = 'amd64'; os = 'linux' }
}
}
to {
image = findProperty("jibRepo") ?: "195996028523.dkr.ecr.eu-west-1.amazonaws.com/wave/app:$version"
}
container {
creationTime = "${OffsetDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME)}"
filesModificationTime = "${OffsetDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME)}"
ports = ['9090']
entrypoint = '/bin/sh'
args = ['/launch.sh'] // copied from `src/main/jib` directory
environment = [
'MICRONAUT_ENVIRONMENTS': 'prod'
]
}
extraDirectories {
paths {
path { from = file('src/main/jib'); }
path { from = file('.'); includes = ['config.yml'] }
}
permissions = ['/launch.sh': '755']
}
allowInsecureRegistries= findProperty("jibRepo")?.toString()?.indexOf('localhost') != -1
}
run{
def envs = findProperty('micronautEnvs')
def args = ["-Dmicronaut.environments=$envs","-Djdk.tracePinnedThreads=short", "--add-opens","java.base/java.lang=ALL-UNNAMED"]
if( environment['JVM_OPTS'] ) args.add(environment['JVM_OPTS'])
jvmArgs args
systemProperties 'DOCKER_USER': project.findProperty('DOCKER_USER') ?: environment['DOCKER_USER'],
'DOCKER_PAT': project.findProperty('DOCKER_PAT') ?: environment['DOCKER_PAT'],
'QUAY_USER': project.findProperty('QUAY_USER') ?: environment['QUAY_USER'],
'QUAY_PAT': project.findProperty('QUAY_PAT') ?: environment['QUAY_PAT']
}
test {
testLogging {
outputs.upToDateWhen {false}
showStandardStreams = true
}
environment 'DOCKER_USER', project.findProperty('DOCKER_USER') ?: environment['DOCKER_USER']
environment 'DOCKER_PAT', project.findProperty('DOCKER_PAT') ?: environment['DOCKER_PAT']
environment 'QUAY_USER', project.findProperty('QUAY_USER') ?: environment['QUAY_USER']
environment 'QUAY_PAT', project.findProperty('QUAY_PAT') ?: environment['QUAY_PAT']
}
/** Update version number for backend app and modules */
task buildInfo { doLast {
def info = """\
name=${project.name}
group=${project.group}
version=${version}
commitId=${project.property('commitId')}
""".stripIndent().toString()
def f = file("${buildDir}/resources/main/META-INF/build-info.properties")
f.parentFile.mkdirs()
f.text = info
} }
buildInfo.dependsOn processResources
compileGroovy.dependsOn buildInfo
jacoco {
toolVersion '0.8.12'
}
/**
* Code coverage with JaCoCo.
* See: https://www.jacoco.org/; https://docs.gradle.org/current/userguide/jacoco_plugin.html
*/
// Code coverage report is always generated after tests run
test { finalizedBy jacocoTestReport }
jacocoTestReport {
// Tests are required to run before generating the code coverage report
dependsOn test
// Remove closure classes from the report, as they are already covered by the enclosing class coverage stats adding only noise.
// See: https://stackoverflow.com/questions/39453696
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect { dir ->
fileTree(dir: dir, excludes: ['**/*$*_closure*'])
}))
}
}