Skip to content

Commit d205c49

Browse files
dependabot[bot]xiang17trask
authored
Bump io.opentelemetry.instrumentation:gradle-plugins from 2.19.0-alpha to 2.26.1-alpha (#4652)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sean Li <xili9@microsoft.com> Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
1 parent 0b66e7a commit d205c49

File tree

5 files changed

+42
-12
lines changed

5 files changed

+42
-12
lines changed

agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/classicsdk/ApplicationInsightsAppenderClassFileTransformer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public class ApplicationInsightsAppenderClassFileTransformer implements ClassFil
2727
UnshadedSdkPackageName.get() + "/log4j/v2/ApplicationInsightsAppender";
2828
private static final String UNSHADED_CLASS_NAME_LOG_4_JV_1_2 =
2929
UnshadedSdkPackageName.get() + "/log4j/v1_2/ApplicationInsightsAppender";
30+
private static final String UNSHADED_CLASS_NAME_LOGBACK_LOGGING_EVENT =
31+
UnshadedSdkPackageName.getLogbackPrefix() + "logback/classic/spi/ILoggingEvent";
3032

3133
@Override
3234
@Nullable
@@ -73,7 +75,7 @@ public MethodVisitor visitMethod(
7375
@Nullable String[] exceptions) {
7476
MethodVisitor mv = cw.visitMethod(access, name, descriptor, signature, exceptions);
7577
if (name.equals("append")
76-
&& (descriptor.equals("(Lch/qos/logback/classic/spi/ILoggingEvent;)V")
78+
&& (descriptor.equals("(L" + UNSHADED_CLASS_NAME_LOGBACK_LOGGING_EVENT + ";)V")
7779
|| descriptor.equals("(Lorg/apache/log4j/spi/LoggingEvent;)V")
7880
|| descriptor.equals("(Lorg/apache/logging/log4j/core/LogEvent;)V"))) {
7981
// no-op the append() method

agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/classicsdk/UnshadedSdkPackageName.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@
55

66
public class UnshadedSdkPackageName {
77

8-
// using constant here so that it will NOT get shaded
9-
// IMPORTANT FOR THIS NOT TO BE FINAL (or private)
10-
// OTHERWISE COMPILER COULD THEORETICALLY INLINE IT BELOW AND APPLY .substring(1)
11-
// and then it WOULD be shaded
8+
// using package-prefix constants here so that they will NOT get shaded
9+
// IMPORTANT FOR THESE NOT TO BE FINAL (or private)
10+
// OTHERWISE COMPILER COULD THEORETICALLY INLINE THEM BELOW AND APPLY .substring(1)
11+
// and then they WOULD be shaded
1212
@SuppressWarnings("ConstantField") // field value intentionally mutable for specific use case
1313
static String ALMOST_PREFIX = "!com/microsoft/applicationinsights";
1414

15+
@SuppressWarnings("ConstantField") // field value intentionally mutable for specific use case
16+
static String ALMOST_LOGBACK_PREFIX = "!ch/qos/";
17+
1518
public static String get() {
1619
return ALMOST_PREFIX.substring(1);
1720
}
1821

22+
public static String getLogbackPrefix() {
23+
return ALMOST_LOGBACK_PREFIX.substring(1);
24+
}
25+
1926
private UnshadedSdkPackageName() {}
2027
}

buildSrc/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ dependencies {
3232
// When updating, update above in plugins too
3333
implementation("com.diffplug.spotless:spotless-plugin-gradle:8.4.0")
3434
implementation("com.github.spotbugs.snom:spotbugs-gradle-plugin:6.4.8")
35-
implementation("com.gradleup.shadow:shadow-gradle-plugin:8.3.9")
35+
implementation("com.gradleup.shadow:shadow-gradle-plugin:9.3.2")
3636

3737
implementation("org.owasp:dependency-check-gradle:12.2.0")
3838

39-
implementation("io.opentelemetry.instrumentation:gradle-plugins:2.19.0-alpha")
39+
implementation("io.opentelemetry.instrumentation:gradle-plugins:2.26.1-alpha")
4040

4141
implementation("net.ltgt.gradle:gradle-errorprone-plugin:4.3.0")
4242
implementation("net.ltgt.gradle:gradle-nullaway-plugin:3.0.0")

buildSrc/src/main/kotlin/ai.shadow-conventions.gradle.kts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,28 @@ plugins {
55
}
66

77
tasks.withType<ShadowJar>().configureEach {
8-
mergeServiceFiles {
9-
include("inst/META-INF/services/*")
10-
}
8+
mergeServiceFiles()
9+
mergeServiceFiles("inst/META-INF/services")
1110

1211
exclude("**/module-info.class")
12+
exclude("META-INF/*.SF")
13+
exclude("META-INF/*.DSA")
14+
exclude("META-INF/*.RSA")
15+
exclude("META-INF/maven/**")
16+
exclude("META-INF/INDEX.LIST")
17+
18+
// Keep service loaders merged while deduplicating non-functional META-INF metadata.
19+
eachFile {
20+
if (path.startsWith("META-INF/") && !path.startsWith("META-INF/services/")) {
21+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
22+
}
23+
}
24+
filesMatching("META-INF/services/**") {
25+
duplicatesStrategy = DuplicatesStrategy.INCLUDE
26+
}
27+
filesMatching("inst/META-INF/services/**") {
28+
duplicatesStrategy = DuplicatesStrategy.INCLUDE
29+
}
1330

1431
// Prevents conflict with other SLF4J instances. Important for premain.
1532
relocate("org.slf4j", "io.opentelemetry.javaagent.slf4j")

buildSrc/src/main/kotlin/ai.smoke-test-jar.gradle.kts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ val aiSmokeTest = extensions.getByType(AiSmokeTestExtension::class)
1515
tasks.named<ShadowJar>("shadowJar") {
1616
archiveClassifier.set("")
1717
mergeServiceFiles()
18-
18+
19+
filesMatching("META-INF/spring.factories") {
20+
duplicatesStrategy = DuplicatesStrategy.INCLUDE
21+
}
22+
1923
// Properly merge spring.factories files from all dependencies
2024
// This is required for Spring Boot auto-configuration to work
2125
// Use PropertiesFileTransformer to merge duplicate keys instead of simple append
2226
transform(PropertiesFileTransformer::class.java) {
2327
paths = listOf("META-INF/spring.factories")
24-
mergeStrategy = "append"
28+
mergeStrategy = PropertiesFileTransformer.MergeStrategy.Append
2529
}
2630

2731
// Set main class - can be overridden by individual projects via mainClassName property

0 commit comments

Comments
 (0)