forked from inspectIT/inspectit-ocelot-eum-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
197 lines (160 loc) · 7.04 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
plugins {
id "org.springframework.boot" version "${springBootVersion}"
id "com.palantir.docker" version "${palantirDockerVersion}"
id "org.cyclonedx.bom" version "${cyclonedxBomVersion}"
id "io.spring.dependency-management" version "${springDependencyManangementVersion}"
id "org.owasp.dependencycheck" version "${owaspDependencyCheckVersion}"
}
repositories {
mavenCentral()
}
apply plugin: "java"
apply plugin: "jacoco"
group = "rocks.inspectit.ocelot"
sourceCompatibility = "1.8"
if (!project.hasProperty("buildVersion") || project.getProperty("buildVersion").empty) {
ext.buildVersion = "SNAPSHOT"
}
version = "$buildVersion"
task downloadBoomerangjs() {
logger.info("Downloading Boomerangjs version {}.", boomerangVersion)
ext.dest = new File(buildDir, "boomerang-source-${boomerangVersion}.tgz")
outputs.files(ext.dest)
doLast {
def f = ext.dest
new URL("https://registry.npmjs.org/boomerangjs/-/boomerangjs-${boomerangVersion}.tgz")
.withInputStream { i -> f.withOutputStream { it << i } }
}
}
task deleteBoomerangjs(type: Delete) {
delete new File(project.buildDir, "boomerangjs-${boomerangVersion}")
}
task downloadAndExtractBoomerang(dependsOn: [deleteBoomerangjs, downloadBoomerangjs], type: Copy) {
from tarTree(downloadBoomerangjs.dest)
into new File(project.buildDir, "boomerangjs-${boomerangVersion}")
filter { line -> line.replaceAll("%boomerang_version%", "${boomerangVersion}") }
}
task generateVersionFile {
ext.versionFile = new File(project.buildDir, "eum-version.info")
doLast {
def currentDate = new Date().toString()
ext.versionFile.withWriter("UTF-8") { writer ->
writer << "$version\n$currentDate\n$boomerangVersion"
}
}
}
task downloadOpenTelemetryPlugin() {
ext.dest = new File(buildDir, "boomerang-opentelemetry.js")
outputs.files(ext.dest)
doLast {
def f = ext.dest
new URL("https://github.com/NovatecConsulting/boomerang-opentelemetry-plugin/releases/download/$boomerangOpenTelemetryPluginVersion/boomerang-opentelemetry.js")
.withInputStream { i -> f.withOutputStream { it << i } }
}
}
bootJar {
dependsOn generateVersionFile
dependsOn downloadAndExtractBoomerang
dependsOn downloadOpenTelemetryPlugin
archivesBaseName = "inspectit-ocelot-eum-server"
version = "${buildVersion}"
manifest {
attributes "Start-Class": "rocks.inspectit.oce.eum.server.EUMServerApplication"
}
// include version file
from generateVersionFile.versionFile
// include boomerang
from("$buildDir/boomerangjs-${boomerangVersion}/package") {
include "plugins/*.js"
include "boomerang.js"
into "static/boomerang"
}
//include boomerang opentelemetry
from("$buildDir") {
include "boomerang-opentelemetry.js"
into "static/boomerang"
}
}
cyclonedxBom {
includeConfigs = ["runtimeClasspath"]
schemaVersion = "1.4"
projectType = "application"
}
test {
useJUnitPlatform()
testLogging {
exceptionFormat = "full"
}
}
dependencies {
implementation(
"org.springframework.boot:spring-boot-starter-web",
"org.springframework.boot:spring-boot-starter-actuator",
"org.springframework.boot:spring-boot-starter-validation",
"org.springframework.boot:spring-boot-starter-security",
"org.yaml:snakeyaml:${snakeYamlVersion}",
// pin Prometheus client to 0.6.0 to prevent auto prefixing counter metrics with "_total"
// see: https://github.com/prometheus/client_java/issues/640, https://github.com/prometheus/client_java/pull/653
"io.prometheus:simpleclient:${prometheusClientVersion}",
"io.prometheus:simpleclient_common:${prometheusClientVersion}",
"io.prometheus:simpleclient_httpserver:${prometheusClientVersion}",
"io.opencensus:opencensus-api:${openCensusVersion}",
"io.opencensus:opencensus-impl:${openCensusVersion}",
"io.opencensus:opencensus-exporter-stats-prometheus:${openCensusVersion}",
"io.grpc:grpc-netty-shaded:${grpcVersion}",
"io.grpc:grpc-protobuf:${grpcVersion}",
"io.grpc:grpc-stub:${grpcVersion}",
platform("io.opentelemetry:opentelemetry-bom-alpha:${openTelemetryAlphaVersion}"),
"io.opentelemetry:opentelemetry-semconv",
platform("io.opentelemetry:opentelemetry-bom:${openTelemetryVersion}"),
"io.opentelemetry:opentelemetry-exporter-otlp",
"io.opentelemetry:opentelemetry-exporter-jaeger",
"io.opentelemetry:opentelemetry-exporter-jaeger-thrift",
"io.opentelemetry:opentelemetry-sdk",
"io.opentelemetry:opentelemetry-proto:${openTelemetryProtoVersion}",
"com.fasterxml.jackson.dataformat:jackson-dataformat-yaml",
"com.google.protobuf:protobuf-java:${protobufVersion}",
"com.google.protobuf:protobuf-java-util:${protobufVersion}",
"com.google.guava:guava:${guavaVersion}",
"com.maxmind.geoip2:geoip2:${geoip2Version}",
"commons-net:commons-net:${commonsNetVersion}",
"org.apache.commons:commons-lang3",
"org.apache.commons:commons-math3:${commonsMath3Version}",
"commons-io:commons-io:${commonsIoVersion}",
"org.influxdb:influxdb-java:${influxdbJavaVersion}",
"rocks.inspectit:opencensus-influxdb-exporter:${opencensusInfluxdbExporterVersion}",
)
compileOnly "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testImplementation(
"org.springframework.boot:spring-boot-starter-test",
"io.opencensus:opencensus-impl:${openCensusVersion}",
"org.apache.httpcomponents:httpclient",
"org.mockito:mockito-core",
"org.junit.jupiter:junit-jupiter-api",
"org.awaitility:awaitility",
"org.mockito:mockito-junit-jupiter",
// ServerExtension
"com.linecorp.armeria:armeria-junit5:${armeriaVersion}",
"com.linecorp.armeria:armeria-grpc-protocol:${armeriaVersion}",
"io.opentelemetry:opentelemetry-semconv:${openTelemetryAlphaVersion}",
// for docker test containers
"org.testcontainers:testcontainers:${testContainersVersion}",
"org.testcontainers:junit-jupiter:${testContainersVersion}"
)
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
}
task copyServerJar(type: Copy) {
dependsOn bootJar
from("${buildDir}/libs/inspectit-ocelot-eum-server-${version}.jar")
into("${buildDir}/docker-jar")
rename("inspectit-ocelot-eum-server-${version}\\.jar",
"inspectit-ocelot-eum-server.jar")
}
docker {
dependsOn copyServerJar
name "inspectit/inspectit-ocelot-eum-server"
tags "${version}"
dockerfile file("docker/Dockerfile")
files "docker/entrypoint.sh", "$buildDir/docker-jar/inspectit-ocelot-eum-server.jar"
}