Add option for muzzle validation on the specific JDK version
This is still useful to validate various aspects of the integrations even if it doesn't need to check against maven.
MODIFY
buildSrc/src/main/groovy/MuzzlePlugin.groovy
buildSrc/src/main/groovy/MuzzlePlugin.groovy
@@ -103,8 +103,11 @@ class MuzzlePlugin implements Plugin<Project> {
Task runAfter = project.tasks.muzzle
for (MuzzleDirective muzzleDirective : project.muzzle.directives) {
- project.getLogger().info("configured ${muzzleDirective.assertPass ? 'pass' : 'fail'} directive: ${muzzleDirective.group}:${muzzleDirective.module}:${muzzleDirective.versions}")
+ project.getLogger().info("configured $muzzleDirective")
+ if (muzzleDirective.coreJdk) {
+ runAfter = addMuzzleTask(muzzleDirective, null, project, runAfter, bootstrapProject, toolingProject)
+ } else {
muzzleDirectiveToArtifacts(muzzleDirective, system, session).collect() { Artifact singleVersion ->
runAfter = addMuzzleTask(muzzleDirective, singleVersion, project, runAfter, bootstrapProject, toolingProject)
}
@@ -118,6 +121,7 @@ class MuzzlePlugin implements Plugin<Project> {
}
}
}
+ }
private static ClassLoader getOrCreateToolingLoader(Project toolingProject) {
synchronized (TOOLING_LOADER) {
@@ -258,8 +262,15 @@ class MuzzlePlugin implements Plugin<Project> {
* @return The created muzzle task.
*/
private static Task addMuzzleTask(MuzzleDirective muzzleDirective, Artifact versionArtifact, Project instrumentationProject, Task runAfter, Project bootstrapProject, Project toolingProject) {
- def taskName = "muzzle-Assert${muzzleDirective.assertPass ? "Pass" : "Fail"}-$versionArtifact.groupId-$versionArtifact.artifactId-$versionArtifact.version${muzzleDirective.name ? "-${muzzleDirective.getNameSlug()}" : ""}"
+ def taskName
+ if (muzzleDirective.coreJdk) {
+ taskName = "muzzle-Assert$muzzleDirective"
+ } else {
+ taskName = "muzzle-Assert${muzzleDirective.assertPass ? "Pass" : "Fail"}-$versionArtifact.groupId-$versionArtifact.artifactId-$versionArtifact.version${muzzleDirective.name ? "-${muzzleDirective.getNameSlug()}" : ""}"
+ }
def config = instrumentationProject.configurations.create(taskName)
+
+ if (!muzzleDirective.coreJdk) {
def dep = instrumentationProject.dependencies.create("$versionArtifact.groupId:$versionArtifact.artifactId:$versionArtifact.version") {
transitive = true
}
@@ -269,6 +280,7 @@ class MuzzlePlugin implements Plugin<Project> {
dep.exclude group: 'com.sun.jmx', module: 'jmxri'
config.dependencies.add(dep)
+ }
for (String additionalDependency : muzzleDirective.additionalDependencies) {
config.dependencies.add(instrumentationProject.dependencies.create(additionalDependency) {
transitive = true
@@ -369,6 +381,11 @@ class MuzzleDirective {
List<String> additionalDependencies = new ArrayList<>()
boolean assertPass
boolean assertInverse = false
+ boolean coreJdk = false
+
+ void coreJdk() {
+ coreJdk = true
+ }
/**
* Adds extra dependencies to the current muzzle test.
@@ -391,6 +408,14 @@ class MuzzleDirective {
return name.trim().replaceAll("[^a-zA-Z0-9]+", "-")
}
+
+ String toString() {
+ if (coreJdk) {
+ return "${assertPass ? 'Pass' : 'Fail'}-core-jdk"
+ } else {
+ return "${assertPass ? 'pass' : 'fail'} $group:$module:$versions"
+ }
+ }
}
/**

MODIFY
dd-java-agent/instrumentation/http-url-connection/http-url-connection.gradle
dd-java-agent/instrumentation/http-url-connection/http-url-connection.gradle
+muzzle {
+ pass {
+ coreJdk()
+ }
+}
+
apply from: "${rootDir}/gradle/java.gradle"
dependencies {

MODIFY
dd-java-agent/instrumentation/java-concurrent/java-concurrent.gradle
dd-java-agent/instrumentation/java-concurrent/java-concurrent.gradle
+// This won't work until the akka and scala integrations are split into separate projects.
+//muzzle {
+// pass {
+// coreJdk()
+// }
+//}
+
apply from: "${rootDir}/gradle/java.gradle"
apply from: "${rootDir}/gradle/test-with-scala.gradle"
apply from: "${rootDir}/gradle/test-with-kotlin.gradle"

MODIFY
dd-java-agent/instrumentation/jdbc/jdbc.gradle
dd-java-agent/instrumentation/jdbc/jdbc.gradle
+muzzle {
+ pass {
+ coreJdk()
+ }
+}
+
apply from: "${rootDir}/gradle/java.gradle"
apply plugin: 'org.unbroken-dome.test-sets'

Add option for muzzle validation on the specific JDK version

This is still useful to validate various aspects of the integrations even if it doesn't need to check against maven.