agent-jmxfetch.gradle 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. plugins {
  2. id "com.github.johnrengelman.shadow"
  3. }
  4. apply from: "${rootDir}/gradle/java.gradle"
  5. dependencies {
  6. compile('com.datadoghq:jmxfetch:0.29.0'){
  7. exclude group: 'org.slf4j', module: 'slf4j-log4j12'
  8. exclude group: 'log4j', module: 'log4j'
  9. }
  10. compile deps.slf4j
  11. compile project(':dd-trace-api')
  12. }
  13. configurations {
  14. // exclude bootstrap dependencies from shadowJar
  15. runtime.exclude module: deps.opentracing
  16. runtime.exclude module: deps.slf4j
  17. runtime.exclude group: 'org.slf4j'
  18. runtime.exclude group: 'io.opentracing'
  19. }
  20. shadowJar {
  21. dependencies {
  22. exclude(project(':dd-java-agent:agent-bootstrap'))
  23. exclude(project(':dd-trace-api'))
  24. }
  25. }
  26. jar {
  27. classifier = 'unbundled'
  28. }
  29. tasks.register("submodulesUpdate", Exec) {
  30. group 'Build Setup'
  31. description 'Initializes and updates integrations-core git submodule'
  32. commandLine 'git', 'submodule', 'update', '--init', 'integrations-core'
  33. def submoduleHead = file("${project.rootDir}/.git/modules/dd-java-agent/agent-jmxfetch/integrations-core/HEAD")
  34. if (submoduleHead.exists()) {
  35. inputs.file "${project.rootDir}/.git/modules/dd-java-agent/agent-jmxfetch/integrations-core/HEAD"
  36. }
  37. def integrationsCore = file("$projectDir/integrations-core")
  38. outputs.dir integrationsCore
  39. if (integrationsCore.list().length == 0) {
  40. outputs.upToDateWhen { false }
  41. }
  42. }
  43. tasks.register("copyMetricConfigs", Exec) {
  44. group 'Build Setup'
  45. description 'Copy metrics.yaml files from integrations-core into resources'
  46. commandLine './copy-metric-configs.sh', 'integrations-core', sourceSets.main.output.resourcesDir
  47. inputs.dir file("$projectDir/integrations-core")
  48. outputs.dir sourceSets.main.output.resourcesDir
  49. doFirst {
  50. // Ensure the resources directory is available.
  51. file(sourceSets.main.output.resourcesDir).mkdirs()
  52. }
  53. }
  54. copyMetricConfigs.dependsOn submodulesUpdate
  55. processResources.finalizedBy copyMetricConfigs
  56. copyMetricConfigs.mustRunAfter processResources
  57. // In CI, there seems to be a race condition where processResources overwrites the copied metric config files.
  58. // Ensure that task runs last to avoid this problem.