Skip to content

Commit

Permalink
Remove muzzle from gradleplugins (#4183)
Browse files Browse the repository at this point in the history
* Include gradle-plugins as a composite build

* Make gradle-plugins project independent from the main one

* Delete old ClassRef and friends

* Fixes

* Polish

* Polish

* Simplify
  • Loading branch information
iNikem authored Sep 24, 2021
1 parent 9d5cf4e commit f788d84
Show file tree
Hide file tree
Showing 46 changed files with 93 additions and 820 deletions.
13 changes: 1 addition & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ plugins {
id("idea")

id("com.github.ben-manes.versions")
id("com.diffplug.spotless")
id("io.github.gradle-nexus.publish-plugin")
id("nebula.release")
id("otel.spotless-conventions")
}

release {
Expand Down Expand Up @@ -43,14 +43,3 @@ nexusPublishing {
// tasks.release.finalizedBy tasks.closeAndReleaseRepository

description = "OpenTelemetry instrumentations for Java"

spotless {
// this formatting is applied at the root level, as some of these files are not in a submodules
// and would be missed otherwise
format("misc") {
target(".gitignore", "*.md", "docs/**/*.md")
indentWithSpaces()
trimTrailingWhitespace()
endWithNewline()
}
}
File renamed without changes.
6 changes: 6 additions & 0 deletions conventions/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
includeBuild("../gradle-plugins") {
dependencySubstitution {
substitute(module("io.opentelemetry.instrumentation.muzzle-generation:io.opentelemetry.instrumentation.muzzle-generation.gradle.plugin")).using(project(":"))
substitute(module("io.opentelemetry.instrumentation.muzzle-check:io.opentelemetry.instrumentation.muzzle-check.gradle.plugin")).using(project(":"))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ dependencies {

/*
Dependencies added to this configuration will be found by the muzzle gradle plugin during code
generation phase. They differ from the implementation dependencies declared in plugin's build
script, because these classes become part of the code that plugin inspects and traverses during
references collection phase. They are not part of the observer, they are part of the observation.
generation phase. These classes become part of the code that plugin inspects and traverses during
references collection phase.
*/
add("codegen", "io.opentelemetry.javaagent:opentelemetry-javaagent-tooling")
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ plugins {
id("io.opentelemetry.instrumentation.javaagent-shadowing")
}

dependencies {
/*
Dependencies added to this configuration will be found by the muzzle gradle plugin during code
generation phase. These classes become part of the code that plugin inspects and traverses during
references collection phase.
*/
add("codegen", "io.opentelemetry.javaagent:opentelemetry-javaagent-tooling")
}


dependencies {
// Integration tests may need to define custom instrumentation modules so we include the standard
// instrumentation infrastructure for testing too.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ spotless {
format("misc") {
// not using "**/..." to help keep spotless fast
target(
".gitignore",
".gitattributes",
".gitconfig",
".editorconfig",
Expand Down
9 changes: 0 additions & 9 deletions gradle-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,12 @@ version = "0.8.0-SNAPSHOT"

repositories {
mavenCentral()
maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
}
}

dependencies {
implementation("com.google.guava:guava:30.1.1-jre")
implementation("net.bytebuddy:byte-buddy-gradle-plugin:1.11.18")

implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:1.6.0-alpha-SNAPSHOT")
implementation("io.opentelemetry.javaagent:opentelemetry-muzzle:1.6.0-alpha-SNAPSHOT")
implementation("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api:1.6.0-alpha-SNAPSHOT")

implementation("org.eclipse.aether:aether-connector-basic:1.1.0")
implementation("org.eclipse.aether:aether-transport-http:1.1.0")
implementation("org.apache.maven:maven-aether-provider:3.3.9")
Expand All @@ -36,8 +29,6 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")

testImplementation("io.opentelemetry.javaagent:opentelemetry-javaagent-instrumentation-api:1.6.0-alpha-SNAPSHOT")
}

tasks.withType<Test>().configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

package io.opentelemetry.javaagent.muzzle.matcher;

import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.tooling.muzzle.ReferenceMatcher;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Map;
Expand All @@ -22,7 +20,7 @@
*
* <p>Second, there is agent or instrumentation class loader, which contains all
* InstrumentationModules and helper classes. The actual muzzle check process happens "inside" that
* class loader. This means that we load {@link
* class loader. This means that we load {@code
* io.opentelemetry.javaagent.tooling.muzzle.ClassLoaderMatcher} from it and we allow it to find all
* InstrumentationModules from agent class loader.
*
Expand All @@ -45,10 +43,10 @@ public final class MuzzleGradlePluginUtil {
* true):
*
* <ol>
* <li>{@code userClassLoader} is not matched by the {@link
* <li>{@code userClassLoader} is not matched by the {@code
* InstrumentationModule#classLoaderMatcher()} method
* <li>{@link ReferenceMatcher} of any instrumentation module finds any mismatch
* <li>any helper class defined in {@link InstrumentationModule#getMuzzleHelperClassNames()}
* <li>{@code ReferenceMatcher} of any instrumentation module finds any mismatch
* <li>any helper class defined in {@code InstrumentationModule#getMuzzleHelperClassNames()}
* fails to be injected into {@code userClassLoader}
* </ol>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ plugins {
*/

val LANGUAGES = listOf("java", "scala", "kotlin")
val pluginName = "io.opentelemetry.javaagent.muzzle.generation.MuzzleCodeGenerationPlugin"
val pluginName = "io.opentelemetry.javaagent.tooling.muzzle.generation.MuzzleCodeGenerationPlugin"

val codegen by configurations.creating {
isCanBeConsumed = false
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit f788d84

Please sign in to comment.