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

muzzle {
  pass {
    coreJdk = true
  }
}

dependencies {
  testImplementation group: 'com.newrelic.agent.java', name: 'newrelic-api', version: '5.14.0'
  testImplementation(group: 'io.opentracing.contrib.dropwizard', name: 'dropwizard-opentracing', version: '0.2.2') {
    transitive = false
  }
  testImplementation group: 'com.signalfx.public', name: 'signalfx-trace-api', version: '0.48.0-sfx1'
  //Old and new versions of kamon use different packages for Trace annotation
  testImplementation(group: 'io.kamon', name: 'kamon-annotation_2.11', version: '0.6.7') {
    transitive = false
  }
  testImplementation group: 'io.kamon', name: 'kamon-annotation-api', version: '2.1.4'
  testImplementation group: 'com.appoptics.agent.java', name: 'appoptics-sdk', version: '6.20.1'
  testImplementation group: 'com.tracelytics.agent.java', name: 'tracelytics-api', version: '5.0.10'
  testImplementation(group: 'org.springframework.cloud', name: 'spring-cloud-sleuth-core', version: '2.2.4.RELEASE') {
    transitive = false
  }
}

test {
  filter {
    excludeTestsMatching 'ConfiguredTraceAnnotationsTest'
    excludeTestsMatching 'TracedMethodsExclusionTest'
  }
}
test.finalizedBy(tasks.register("testIncludeProperty", Test) {
  filter {
    includeTestsMatching 'ConfiguredTraceAnnotationsTest'
  }
  jvmArgs "-Dotel.instrumentation.external-annotations.include=package.Class\$Name;OuterClass\$InterestingMethod"
})
test.finalizedBy(tasks.register("testExcludeMethodsProperty", Test) {
  filter {
    includeTestsMatching 'TracedMethodsExclusionTest'
  }
  jvmArgs "-Dotel.instrumentation.external-annotations.exclude-methods=TracedMethodsExclusionTest\$TestClass[excluded,annotatedButExcluded]"
})
