@@ -66,40 +66,6 @@ private fun loadConfigFields(
6666 }
6767}
6868
69- // Data class for fields from generated class
70- private data class LoadedConfigFields (
71- val supported : Set <String >,
72- val aliasMapping : Map <String , String > = emptyMap()
73- )
74-
75- // Cache for fields from generated class
76- private var cachedConfigFields: LoadedConfigFields ? = null
77-
78- // Helper function to load fields from the generated class
79- private fun loadConfigFields (
80- mainSourceSetOutput : org.gradle.api.file.FileCollection ,
81- generatedClassName : String
82- ): LoadedConfigFields {
83- return cachedConfigFields ? : run {
84- val urls = mainSourceSetOutput.files.map { it.toURI().toURL() }.toTypedArray()
85- URLClassLoader (urls, LoadedConfigFields ::class .java.classLoader).use { cl ->
86- val clazz = Class .forName(generatedClassName, true , cl)
87-
88- val supportedField = clazz.getField(" SUPPORTED" ).get(null )
89- @Suppress(" UNCHECKED_CAST" )
90- val supportedSet = when (supportedField) {
91- is Set <* > -> supportedField as Set <String >
92- is Map <* , * > -> supportedField.keys as Set <String >
93- else -> throw IllegalStateException (" SUPPORTED field must be either Set<String> or Map<String, Any>, but was ${supportedField?.javaClass} " )
94- }
95-
96- @Suppress(" UNCHECKED_CAST" )
97- val aliasMappingMap = clazz.getField(" ALIAS_MAPPING" ).get(null ) as Map <String , String >
98- LoadedConfigFields (supportedSet, aliasMappingMap)
99- }.also { cachedConfigFields = it }
100- }
101- }
102-
10369/* * Registers `logEnvVarUsages` (scan for DD_/OTEL_ tokens and fail if unsupported). */
10470private fun registerLogEnvVarUsages (target : Project , extension : SupportedTracerConfigurations ) {
10571 val ownerPath = extension.configOwnerPath
0 commit comments