-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
206 lines (189 loc) · 8.1 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
import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
plugins {
id 'java-library'
id 'io.seqera.wave.groovy-application-conventions'
id "com.github.johnrengelman.shadow" version "7.1.1"
id "io.micronaut.minimal.application" version "3.7.0"
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' }
maven { url = 'https://jitpack.io' }
}
dependencies {
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.0.0'
api 'io.seqera:wave-api:0.13.3'
api 'io.seqera:wave-utils:0.14.1'
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:micronaut-validation")
implementation 'io.micronaut.security:micronaut-security'
implementation "org.codehaus.groovy:groovy-json"
implementation "org.codehaus.groovy:groovy-nio"
implementation 'com.google.guava:guava:32.1.2-jre'
implementation 'dev.failsafe:failsafe:3.1.0'
implementation('io.projectreactor:reactor-core')
implementation("io.seqera:tower-crypto:22.4.0-watson") { transitive = false } // to be replaced with 22.4.0 once released
implementation 'org.apache.commons:commons-compress:1.27.1'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'io.kubernetes:client-java:19.0.0'
implementation 'io.kubernetes:client-java-api-fluent:18.0.1'
implementation 'com.google.code.gson:gson:2.9.0'
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml'
implementation 'com.squareup.moshi:moshi:1.14.0'
implementation 'com.squareup.moshi:moshi-adapters:1.14.0'
implementation 'redis.clients:jedis:5.0.2'
implementation "io.github.resilience4j:resilience4j-ratelimiter:0.17.0"
// 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.0'
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.4.8")
// rate limit
implementation 'com.coveo:spillway:3.0.0'
// monitoring
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")
}
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')
// note: "--enable-preview" is required to use virtual threads on Java 19 and 20
def args = ["-Dmicronaut.environments=$envs","--enable-preview"]
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*'])
}))
}
}