Remove scala from dependency management (#7296)
Will close #7216 after this is merged and that PR is rebased. I tested and it does bring a few more scala versions into Intellij without this, but scala is an odd case.
This commit is contained in:
parent
a4740264c2
commit
238042afca
|
@ -5,7 +5,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation("org.scala-lang:scala-library")
|
testCompileOnly("org.scala-lang:scala-library:2.11.12")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
|
|
@ -100,7 +100,6 @@ val DEPENDENCIES = listOf(
|
||||||
"org.codehaus.mojo:animal-sniffer-annotations:1.22",
|
"org.codehaus.mojo:animal-sniffer-annotations:1.22",
|
||||||
"org.junit-pioneer:junit-pioneer:1.9.0",
|
"org.junit-pioneer:junit-pioneer:1.9.0",
|
||||||
"org.objenesis:objenesis:3.3",
|
"org.objenesis:objenesis:3.3",
|
||||||
"org.scala-lang:scala-library:2.11.12",
|
|
||||||
// Note that this is only referenced as "org.springframework.boot" in build files, not the artifact name.
|
// Note that this is only referenced as "org.springframework.boot" in build files, not the artifact name.
|
||||||
"org.springframework.boot:spring-boot-dependencies:2.7.5",
|
"org.springframework.boot:spring-boot-dependencies:2.7.5",
|
||||||
"javax.validation:validation-api:2.0.1.Final",
|
"javax.validation:validation-api:2.0.1.Final",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("otel.javaagent-instrumentation")
|
id("otel.javaagent-instrumentation")
|
||||||
|
id("otel.scala-conventions")
|
||||||
}
|
}
|
||||||
|
|
||||||
muzzle {
|
muzzle {
|
||||||
|
@ -12,6 +13,8 @@ dependencies {
|
||||||
bootstrap(project(":instrumentation:executors:bootstrap"))
|
bootstrap(project(":instrumentation:executors:bootstrap"))
|
||||||
|
|
||||||
testImplementation(project(":instrumentation:executors:testing"))
|
testImplementation(project(":instrumentation:executors:testing"))
|
||||||
|
|
||||||
|
testImplementation("org.scala-lang:scala-library:2.11.12")
|
||||||
}
|
}
|
||||||
|
|
||||||
testing {
|
testing {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("otel.javaagent-instrumentation")
|
id("otel.javaagent-instrumentation")
|
||||||
|
id("otel.scala-conventions")
|
||||||
}
|
}
|
||||||
|
|
||||||
muzzle {
|
muzzle {
|
||||||
|
@ -34,6 +35,11 @@ dependencies {
|
||||||
latestDepTestLibrary("org.apache.derby:derby:10.14.+")
|
latestDepTestLibrary("org.apache.derby:derby:10.14.+")
|
||||||
|
|
||||||
testImplementation(project(":instrumentation:jdbc:testing"))
|
testImplementation(project(":instrumentation:jdbc:testing"))
|
||||||
|
|
||||||
|
// these dependencies are for SlickTest
|
||||||
|
testImplementation("org.scala-lang:scala-library:2.11.12")
|
||||||
|
testImplementation("com.typesafe.slick:slick_2.11:3.2.0")
|
||||||
|
testImplementation("com.h2database:h2:1.4.197")
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
@ -46,6 +52,22 @@ sourceSets {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<Test>().configureEach {
|
tasks {
|
||||||
|
val testSlick by registering(Test::class) {
|
||||||
|
filter {
|
||||||
|
includeTestsMatching("SlickTest")
|
||||||
|
}
|
||||||
|
include("**/SlickTest.*")
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
filter {
|
||||||
|
excludeTestsMatching("SlickTest")
|
||||||
|
}
|
||||||
jvmArgs("-Dotel.instrumentation.jdbc-datasource.enabled=true")
|
jvmArgs("-Dotel.instrumentation.jdbc-datasource.enabled=true")
|
||||||
|
}
|
||||||
|
|
||||||
|
check {
|
||||||
|
dependsOn(testSlick)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("otel.javaagent-instrumentation")
|
id("otel.javaagent-instrumentation")
|
||||||
id("otel.scala-conventions")
|
id("otel.scala-conventions")
|
||||||
id("org.unbroken-dome.test-sets")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
muzzle {
|
muzzle {
|
||||||
|
@ -13,10 +12,6 @@ muzzle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
testSets {
|
|
||||||
create("slickTest")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
bootstrap(project(":instrumentation:executors:bootstrap"))
|
bootstrap(project(":instrumentation:executors:bootstrap"))
|
||||||
|
|
||||||
|
@ -24,21 +19,5 @@ dependencies {
|
||||||
|
|
||||||
latestDepTestLibrary("org.scala-lang:scala-library:2.11.+")
|
latestDepTestLibrary("org.scala-lang:scala-library:2.11.+")
|
||||||
|
|
||||||
testInstrumentation(project(":instrumentation:jdbc:javaagent"))
|
|
||||||
|
|
||||||
testImplementation(project(":instrumentation:executors:testing"))
|
testImplementation(project(":instrumentation:executors:testing"))
|
||||||
|
|
||||||
add("slickTestImplementation", project(":testing-common"))
|
|
||||||
add("slickTestImplementation", "org.scala-lang:scala-library")
|
|
||||||
add("slickTestImplementation", "com.typesafe.slick:slick_2.11:3.2.0")
|
|
||||||
add("slickTestImplementation", "com.h2database:h2:1.4.197")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run Slick library tests along with the rest of tests
|
|
||||||
tasks {
|
|
||||||
val slickTest by existing
|
|
||||||
|
|
||||||
check {
|
|
||||||
dependsOn(slickTest)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
package io.opentelemetry.javaagent.instrumentation.scalaexecutors;
|
package io.opentelemetry.javaagent.instrumentation.scalaexecutors;
|
||||||
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||||
|
import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||||
|
|
||||||
import io.opentelemetry.context.Context;
|
import io.opentelemetry.context.Context;
|
||||||
|
@ -24,22 +25,14 @@ public class ScalaForkJoinPoolInstrumentation implements TypeInstrumentation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ElementMatcher<TypeDescription> typeMatcher() {
|
public ElementMatcher<TypeDescription> typeMatcher() {
|
||||||
// This might need to be an extendsClass matcher...
|
|
||||||
return named("scala.concurrent.forkjoin.ForkJoinPool");
|
return named("scala.concurrent.forkjoin.ForkJoinPool");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void transform(TypeTransformer transformer) {
|
public void transform(TypeTransformer transformer) {
|
||||||
transformer.applyAdviceToMethod(
|
transformer.applyAdviceToMethod(
|
||||||
named("execute")
|
// doSubmit is internal method prior to 2.11, and externalPush is the internal method after
|
||||||
.and(takesArgument(0, named(ScalaForkJoinTaskInstrumentation.TASK_CLASS_NAME))),
|
namedOneOf("doSubmit", "externalPush")
|
||||||
ScalaForkJoinPoolInstrumentation.class.getName() + "$SetScalaForkJoinStateAdvice");
|
|
||||||
transformer.applyAdviceToMethod(
|
|
||||||
named("submit")
|
|
||||||
.and(takesArgument(0, named(ScalaForkJoinTaskInstrumentation.TASK_CLASS_NAME))),
|
|
||||||
ScalaForkJoinPoolInstrumentation.class.getName() + "$SetScalaForkJoinStateAdvice");
|
|
||||||
transformer.applyAdviceToMethod(
|
|
||||||
named("invoke")
|
|
||||||
.and(takesArgument(0, named(ScalaForkJoinTaskInstrumentation.TASK_CLASS_NAME))),
|
.and(takesArgument(0, named(ScalaForkJoinTaskInstrumentation.TASK_CLASS_NAME))),
|
||||||
ScalaForkJoinPoolInstrumentation.class.getName() + "$SetScalaForkJoinStateAdvice");
|
ScalaForkJoinPoolInstrumentation.class.getName() + "$SetScalaForkJoinStateAdvice");
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,114 @@
|
||||||
|
/*
|
||||||
|
* Copyright The OpenTelemetry Authors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.opentelemetry.javaagent.instrumentation.scalaexecutors;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import scala.concurrent.forkjoin.ForkJoinPool;
|
||||||
|
import scala.concurrent.forkjoin.ForkJoinTask;
|
||||||
|
|
||||||
|
public class ForkJoinPoolBridge implements ExecutorService {
|
||||||
|
|
||||||
|
private final ForkJoinPool delegate;
|
||||||
|
|
||||||
|
public ForkJoinPoolBridge(ForkJoinPool delegate) {
|
||||||
|
this.delegate = delegate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void shutdown() {
|
||||||
|
delegate.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public List<Runnable> shutdownNow() {
|
||||||
|
return delegate.shutdownNow();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isShutdown() {
|
||||||
|
return delegate.isShutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTerminated() {
|
||||||
|
return delegate.isTerminated();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean awaitTermination(long timeout, @NotNull TimeUnit unit)
|
||||||
|
throws InterruptedException {
|
||||||
|
return delegate.awaitTermination(timeout, unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public <T> Future<T> submit(@NotNull Callable<T> task) {
|
||||||
|
return delegate.submit(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public <T> Future<T> submit(@NotNull Runnable task, T result) {
|
||||||
|
return delegate.submit(task, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Future<?> submit(@NotNull Runnable task) {
|
||||||
|
return delegate.submit(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public <T> List<Future<T>> invokeAll(@NotNull Collection<? extends Callable<T>> tasks) {
|
||||||
|
return delegate.invokeAll(tasks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public <T> List<Future<T>> invokeAll(
|
||||||
|
@NotNull Collection<? extends Callable<T>> tasks, long timeout, @NotNull TimeUnit unit) {
|
||||||
|
// Scala 2.8's ForkJoinPool doesn't have corresponding method
|
||||||
|
return delegate.invokeAll(tasks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public <T> T invokeAny(@NotNull Collection<? extends Callable<T>> tasks)
|
||||||
|
throws InterruptedException, ExecutionException {
|
||||||
|
// Scala 2.8's ForkJoinPool doesn't have corresponding method
|
||||||
|
return delegate.submit(tasks.iterator().next()).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T invokeAny(
|
||||||
|
@NotNull Collection<? extends Callable<T>> tasks, long timeout, @NotNull TimeUnit unit)
|
||||||
|
throws InterruptedException, ExecutionException {
|
||||||
|
// Scala 2.8's ForkJoinPool doesn't have corresponding method
|
||||||
|
return delegate.submit(tasks.iterator().next()).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T invoke(ForkJoinTask<T> task) {
|
||||||
|
return delegate.invoke(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(@NotNull Runnable command) {
|
||||||
|
delegate.execute(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> void execute(ForkJoinTask<T> task) {
|
||||||
|
delegate.execute(task);
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,13 +14,13 @@ import scala.concurrent.forkjoin.ForkJoinPool;
|
||||||
import scala.concurrent.forkjoin.ForkJoinTask;
|
import scala.concurrent.forkjoin.ForkJoinTask;
|
||||||
|
|
||||||
class ScalaExecutorInstrumentationTest
|
class ScalaExecutorInstrumentationTest
|
||||||
extends AbstractExecutorServiceTest<ForkJoinPool, ScalaAsyncChild> {
|
extends AbstractExecutorServiceTest<ForkJoinPoolBridge, ScalaAsyncChild> {
|
||||||
|
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
static final InstrumentationExtension testing = AgentInstrumentationExtension.create();
|
static final InstrumentationExtension testing = AgentInstrumentationExtension.create();
|
||||||
|
|
||||||
ScalaExecutorInstrumentationTest() {
|
ScalaExecutorInstrumentationTest() {
|
||||||
super(new ForkJoinPool(), testing);
|
super(new ForkJoinPoolBridge(new ForkJoinPool()), testing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,7 +34,7 @@ class ScalaExecutorInstrumentationTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void submitForkJoinTask() {
|
void executeForkJoinTask() {
|
||||||
executeTwoTasks(task -> executor().submit((ForkJoinTask<?>) task));
|
executeTwoTasks(task -> executor().execute((ForkJoinTask<?>) task));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue