@@ -6,8 +6,7 @@ plugins {
66base.archivesName.set(" opentelemetry-spring-boot-autoconfigure" )
77group = " io.opentelemetry.instrumentation"
88
9- val springBootVersion =
10- " 2.7.18" // AutoConfiguration is added in 2.7.0, but can be used with older versions
9+ val springBootVersion = " 2.7.18" // AutoConfiguration is added in 2.7.0, but can be used with older versions
1110
1211// r2dbc-proxy is shadowed to prevent org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration
1312// from being loaded by Spring Boot (by the presence of META-INF/services/io.r2dbc.spi.ConnectionFactoryProvider) - even if the user doesn't want to use R2DBC.
@@ -42,12 +41,7 @@ dependencies {
4241 implementation(project(" :instrumentation-annotations-support" ))
4342 implementation(project(" :instrumentation:kafka:kafka-clients:kafka-clients-2.6:library" ))
4443 implementation(project(" :instrumentation:mongo:mongo-3.1:library" ))
45- compileOnly(
46- project(
47- path = " :instrumentation:r2dbc-1.0:library-instrumentation-shaded" ,
48- configuration = " shadow"
49- )
50- )
44+ compileOnly(project(path = " :instrumentation:r2dbc-1.0:library-instrumentation-shaded" , configuration = " shadow" ))
5145 implementation(project(" :instrumentation:spring:spring-kafka-2.7:library" ))
5246 implementation(project(" :instrumentation:spring:spring-web:spring-web-3.1:library" ))
5347 implementation(project(" :instrumentation:spring:spring-webmvc:spring-webmvc-5.3:library" ))
@@ -113,14 +107,8 @@ dependencies {
113107 add(" javaSpring3CompileOnly" , files(sourceSets.main.get().output.classesDirs))
114108 add(" javaSpring3CompileOnly" , " org.springframework.boot:spring-boot-starter-web:3.2.4" )
115109 add(" javaSpring3CompileOnly" , " io.opentelemetry:opentelemetry-sdk-extension-autoconfigure" )
116- add(
117- " javaSpring3CompileOnly" ,
118- project(" :instrumentation:spring:spring-web:spring-web-3.1:library" )
119- )
120- add(
121- " javaSpring3CompileOnly" ,
122- project(" :instrumentation:spring:spring-webmvc:spring-webmvc-6.0:library" )
123- )
110+ add(" javaSpring3CompileOnly" , project(" :instrumentation:spring:spring-web:spring-web-3.1:library" ))
111+ add(" javaSpring3CompileOnly" , project(" :instrumentation:spring:spring-webmvc:spring-webmvc-6.0:library" ))
124112
125113 // tests don't work with spring boot 4 yet
126114 latestDepTestLibrary(" org.springframework.boot:spring-boot-starter-test:3.+" ) // documented limitation
@@ -142,10 +130,8 @@ if (latestDepTest) {
142130 }
143131}
144132
145- val testJavaVersion =
146- gradle.startParameter.projectProperties[" testJavaVersion" ]?.let (JavaVersion ::toVersion)
147- val testSpring3 =
148- (testJavaVersion == null || testJavaVersion.compareTo(JavaVersion .VERSION_17 ) >= 0 )
133+ val testJavaVersion = gradle.startParameter.projectProperties[" testJavaVersion" ]?.let (JavaVersion ::toVersion)
134+ val testSpring3 = (testJavaVersion == null || testJavaVersion.compareTo(JavaVersion .VERSION_17 ) >= 0 )
149135
150136testing {
151137 suites {
@@ -220,65 +206,7 @@ configurations.configureEach {
220206 }
221207}
222208
223- val buildGraalVmReflectionJson = tasks.register(" buildGraalVmReflectionJson" ) {
224- val targetFile = File (
225- projectDir,
226- " src/main/resources/META-INF/native-image/io.opentelemetry.instrumentation/opentelemetry-spring-boot/reflect-config.json"
227- )
228-
229- onlyIf { ! targetFile.exists() }
230-
231- doLast {
232- val sourcePackage =
233- " io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model"
234- val sourcePackagePath = sourcePackage.replace(" ." , " /" )
235-
236- val incubatorJar = configurations.compileClasspath.get()
237- .filter { it.name.contains(" opentelemetry-sdk-extension-incubator" ) && it.name.endsWith(" .jar" ) }
238- .singleFile
239-
240- val classes = mutableListOf<String >()
241- zipTree(incubatorJar).matching {
242- include(" $sourcePackagePath /**" )
243- }.forEach {
244- val path = it.path
245-
246- val className = path
247- .substringAfter(sourcePackagePath)
248- .removePrefix(" /" )
249- .removeSuffix(" .class" )
250- .replace(" /" , " ." )
251- classes.add(" $sourcePackage .$className " )
252- }
253-
254- // write into targetFile in json format
255- // todo either write to generated sources or add to SDK extension incubator build process
256- targetFile.parentFile.mkdirs()
257- targetFile.bufferedWriter().use { writer ->
258- writer.write(" [\n " )
259- classes.forEachIndexed { index, className ->
260- writer.write(" {\n " )
261- writer.write(" \" name\" : \" $className \" ,\n " )
262- writer.write(" \" allDeclaredMethods\" : true,\n " )
263- writer.write(" \" allDeclaredFields\" : true,\n " )
264- writer.write(" \" allDeclaredConstructors\" : true\n " )
265- writer.write(" }" )
266- if (index < classes.size - 1 ) {
267- writer.write(" ,\n " )
268- } else {
269- writer.write(" \n " )
270- }
271- }
272- writer.write(" ]\n " )
273- }
274- }
275- }
276-
277209tasks {
278- compileJava {
279- dependsOn(buildGraalVmReflectionJson)
280- }
281-
282210 compileTestJava {
283211 options.compilerArgs.add(" -parameters" )
284212 }
0 commit comments