Skip to content

fix wildfly module dependencies #8346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 7 additions & 29 deletions dd-java-agent/instrumentation/wildfly-9/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@ repositories {
maven {
url 'https://maven.repository.redhat.com/ga/'
}
ivy {
url 'https://download.jboss.org/'
patternLayout {
artifact '/[organisation]/[revision]/[module]/[organisation]-[module]-[revision].[ext]'
metadataSources {
artifact()
}
}
}
ivy {
url 'https://github.com/wildfly'
patternLayout {
artifact '/[organisation]/releases/download/[revision]/[organisation]-[revision].[ext]'
metadataSources {
artifact()
}
}
}
}

muzzle {
Expand All @@ -46,9 +28,6 @@ addTestSuiteExtendingForDir("latestDepForkedTest", "latestDepTest", "test")
configurations {
wildflyTest
wildflyLatestDepTest
wildflyLatestPoll {
canBeResolved = true
}
}

dependencies {
Expand All @@ -68,17 +47,17 @@ dependencies {
testRuntimeOnly group: 'org.jboss.shrinkwrap', name: 'shrinkwrap-spi', version: '1.2.6'
testRuntimeOnly group: 'org.jboss.shrinkwrap', name: 'shrinkwrap-impl-base', version: '1.2.6'

wildflyTest "wildfly:servlet:21.0.0.Final@zip"
wildflyTest "org.wildfly:wildfly-dist:21.0.0.Final@zip"

latestDepTestImplementation group: 'org.wildfly.core', name: 'wildfly-embedded', version: '+'
latestDepTestImplementation group: 'org.wildfly.core', name: 'wildfly-server', version: '+'
wildflyLatestPoll group: 'org.wildfly', name: 'wildfly-dist', version: '+'
wildflyLatestDepTest "org.wildfly:wildfly-dist:+@zip"

configurations.wildflyLatestPoll.resolve()
def latestWildflyVersion = configurations.wildflyLatestPoll.resolvedConfiguration.getResolvedArtifacts().find {
configurations.wildflyLatestDepTest.resolve()
def latestWildflyVersion = configurations.wildflyLatestDepTest.resolvedConfiguration.getResolvedArtifacts().find {
it.name == "wildfly-dist"
}.moduleVersion.id.version
wildflyLatestDepTest "wildfly:wildfly:$latestWildflyVersion@zip"

latestDepForkedTest {
configure {
jvmArgs += ["-Dtest.jboss.home=$buildDir/wildfly-${latestWildflyVersion}"]
Expand Down Expand Up @@ -110,14 +89,13 @@ def extractWildfly(config, zipFileNamePrefix, sync) {
tasks.register("extractWildfly", Copy) {
dependsOn configurations.wildflyTest
mustRunAfter tasks.compileTestGroovy
extractWildfly(configurations.wildflyTest, "servlet", it)
extractWildfly(configurations.wildflyTest, "wildfly-dist", it)

// When tests are disabled this would still be run, so disable this manually
onlyIf { !project.rootProject.hasProperty("skipTests") }
}

tasks.register("extractLatestWildfly", Copy) {
dependsOn configurations.wildflyLatestDepTest
mustRunAfter tasks.compileLatestDepTestGroovy
mustRunAfter tasks.compileLatestDepForkedTestGroovy
mustRunAfter tasks.compileLatestDepTestJava
Expand Down Expand Up @@ -186,7 +164,7 @@ processTestResources {

forkedTest {
configure {
jvmArgs += ["-Dtest.jboss.home=$buildDir/wildfly-servlet-21.0.0.Final"]
jvmArgs += ["-Dtest.jboss.home=$buildDir/wildfly-21.0.0.Final"]
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import datadog.trace.agent.tooling.Instrumenter;
import datadog.trace.agent.tooling.InstrumenterModule;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import net.bytebuddy.asm.Advice;
import org.jboss.modules.Module;

Expand Down Expand Up @@ -41,8 +43,15 @@ public static void onExit(
@Advice.This Module self,
@Advice.Argument(0) String name,
@Advice.Return(readOnly = false) Enumeration<URL> ret) {
if (self.getName().endsWith(".jdk")) {
ret = Collections.emptyEnumeration();
if ("META-INF/services/javax.servlet.ServletContainerInitializer".equals(name)) {
final List<URL> list = new ArrayList<>();
while (ret.hasMoreElements()) {
URL u = ret.nextElement();
if (!u.toString().contains("logback-classic")) {
list.add(u);
}
}
ret = Collections.enumeration(list);
}
}
}
Expand Down
Loading