-
Notifications
You must be signed in to change notification settings - Fork 205
/
Copy pathbuild.gradle.kts
122 lines (107 loc) · 4.5 KB
/
build.gradle.kts
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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
plugins {
`java-platform`
id("com.github.ben-manes.versions")
}
data class DependencySet(val group: String, val version: String, val modules: List<String>)
val dependencyVersions = hashMapOf<String, String>()
rootProject.extra["versions"] = dependencyVersions
val otelSdkVersion = "1.47.0"
val otelInstrumentationAlphaVersion = "2.13.1-alpha"
val otelInstrumentationVersion = "2.13.1"
val otelContribVersion = "1.43.0"
rootProject.extra["otelInstrumentationVersion"] = otelInstrumentationVersion
rootProject.extra["otelInstrumentationAlphaVersion"] = otelInstrumentationAlphaVersion
val DEPENDENCY_BOMS = listOf(
"com.fasterxml.jackson:jackson-bom:2.18.2",
"io.opentelemetry:opentelemetry-bom:${otelSdkVersion}",
"io.opentelemetry:opentelemetry-bom-alpha:${otelSdkVersion}-alpha",
"io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:${otelInstrumentationVersion}",
"io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:${otelInstrumentationAlphaVersion}",
"com.azure:azure-sdk-bom:1.2.31",
"io.netty:netty-bom:4.1.118.Final",
"org.junit:junit-bom:5.11.4",
"org.testcontainers:testcontainers-bom:1.20.5",
)
val autoServiceVersion = "1.1.1"
val autoValueVersion = "1.11.0"
val errorProneVersion = "2.36.0"
val jmhVersion = "1.37"
val mockitoVersion = "4.11.0"
val slf4jVersion = "2.0.16"
val CORE_DEPENDENCIES = listOf(
"io.opentelemetry:opentelemetry-semconv:1.30.1-alpha",
"io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-incubator:${otelInstrumentationAlphaVersion}",
"com.google.auto.service:auto-service:${autoServiceVersion}",
"com.google.auto.service:auto-service-annotations:${autoServiceVersion}",
"com.google.auto.value:auto-value:${autoValueVersion}",
"com.google.auto.value:auto-value-annotations:${autoValueVersion}",
"com.google.errorprone:error_prone_annotations:${errorProneVersion}",
"com.google.errorprone:error_prone_core:${errorProneVersion}",
"org.openjdk.jmh:jmh-core:${jmhVersion}",
"org.openjdk.jmh:jmh-generator-bytecode:${jmhVersion}",
"org.mockito:mockito-core:${mockitoVersion}",
"org.mockito:mockito-junit-jupiter:${mockitoVersion}",
"org.mockito:mockito-inline:${mockitoVersion}",
"org.slf4j:slf4j-api:${slf4jVersion}",
"org.slf4j:log4j-over-slf4j:${slf4jVersion}",
"org.slf4j:jcl-over-slf4j:${slf4jVersion}",
"org.slf4j:jul-to-slf4j:${slf4jVersion}",
"io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api:${otelInstrumentationAlphaVersion}",
"io.opentelemetry.javaagent:opentelemetry-javaagent-bootstrap:${otelInstrumentationAlphaVersion}",
"io.opentelemetry.javaagent:opentelemetry-javaagent-tooling:${otelInstrumentationAlphaVersion}",
)
val DEPENDENCIES = listOf(
"ch.qos.logback:logback-classic:1.3.15", // logback 1.4+ requires Java 11+
"ch.qos.logback.contrib:logback-json-classic:0.1.5",
"com.uber.nullaway:nullaway:0.12.3",
"commons-codec:commons-codec:1.18.0",
"org.apache.commons:commons-text:1.13.0",
"com.google.code.gson:gson:2.12.1",
"com.azure:azure-core-test:1.26.2", // this is not included in azure-sdk-bom
"org.assertj:assertj-core:3.27.3",
"org.awaitility:awaitility:4.2.2",
"io.github.hakky54:logcaptor:2.10.1",
"io.opentelemetry.contrib:opentelemetry-jfr-connection:${otelContribVersion}-alpha",
"io.opentelemetry.contrib:opentelemetry-runtime-attach-core:${otelContribVersion}-alpha",
"com.google.code.findbugs:jsr305:3.0.2",
"com.github.spotbugs:spotbugs-annotations:4.9.1"
)
javaPlatform {
allowDependencies()
}
dependencies {
for (bom in DEPENDENCY_BOMS) {
api(enforcedPlatform(bom))
val split = bom.split(':')
dependencyVersions[split[0]] = split[2]
}
constraints {
for (dependency in CORE_DEPENDENCIES) {
api(dependency)
val split = dependency.split(':')
dependencyVersions[split[0]] = split[2]
}
for (dependency in DEPENDENCIES) {
api(dependency)
val split = dependency.split(':')
dependencyVersions[split[0]] = split[2]
}
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isGuava = version.endsWith("-jre")
val isStable = stableKeyword || regex.matches(version) || isGuava
return isStable.not()
}
tasks {
named<DependencyUpdatesTask>("dependencyUpdates") {
revision = "release"
checkConstraints = true
rejectVersionIf {
isNonStable(candidate.version)
}
}
}