ext.skipPublish = true

apply from: "$rootDir/gradle/instrumentation.gradle"

dependencies {
  implementation project(':testing-common:library-for-integration-tests')

  testCompileOnly project(':instrumentation-api')
  testCompileOnly project(':javaagent-api')
  testCompileOnly project(':javaagent-tooling')

  testImplementation deps.bytebuddy
  testImplementation deps.bytebuddyagent

  testImplementation deps.guava
  testImplementation deps.opentelemetryExtAnnotations

  testImplementation group: 'cglib', name: 'cglib', version: '3.2.5'

  // test instrumenting java 1.1 bytecode
  // TODO do we want this?
  testImplementation group: 'net.sf.jt400', name: 'jt400', version: '6.1'
}

test {
  filter {
    excludeTestsMatching 'context.FieldBackedProviderTest'
    excludeTestsMatching 'context.FieldInjectionDisabledTest'
  }
  // this is needed for AgentTestRunnerTest
  jvmArgs '-Dotel.javaagent.exclude-classes=config.exclude.packagename.*,config.exclude.SomeClass,config.exclude.SomeClass$NestedClass'
}
test.finalizedBy(tasks.register("testFieldBackedProvider", Test) {
  filter {
    includeTestsMatching 'context.FieldBackedProviderTest'
  }
  jvmArgs '-Dotel.instrumentation.context-test-instrumentation.enabled=true'
})
test.finalizedBy(tasks.register("testFieldInjectionDisabled", Test) {
  filter {
    includeTestsMatching 'context.FieldInjectionDisabledTest'
  }
  jvmArgs '-Dotel.javaagent.runtime.context.field.injection=false'
  jvmArgs '-Dotel.instrumentation.context-test-instrumentation.enabled=true'
})
