group 'io.opentelemetry.example'
version '1.0-SNAPSHOT'

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "com.diffplug.spotless:spotless-plugin-gradle:6.3.0"
  }
}

subprojects {
  version = rootProject.version

  apply plugin: "java"
  apply plugin: "com.diffplug.spotless"

  ext {
    versions = [
      opentelemetry              : "1.12.0",
      opentelemetryAlpha         : "1.12.0-alpha",
      opentelemetryJavaagent     : "1.15.0",
      opentelemetryJavaagentAlpha: "1.15.0-alpha",
      bytebuddy                  : "1.10.18",
      guava                      : "30.1-jre"
    ]

    deps = [
      bytebuddy           : "net.bytebuddy:byte-buddy-dep:${versions.bytebuddy}",
      autoservice         : [
        "com.google.auto.service:auto-service:1.0-rc7",
        "com.google.auto:auto-common:0.8",
        "com.google.guava:guava:${versions.guava}",
      ],
      autoValueAnnotations: "com.google.auto.value:auto-value-annotations:${versions.autoValue}",
    ]
  }

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

  spotless {
    java {
      googleJavaFormat()
      licenseHeaderFile(rootProject.file("../../buildscripts/spotless.license.java"), "(package|import|public)")
      target("src/**/*.java")
    }
  }

  dependencies {
    testImplementation("org.mockito:mockito-core:3.3.3")
    testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.2")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.2")
  }

  tasks {
    test {
      useJUnitPlatform()
    }

    compileJava {
      options.release.set(8)
    }
  }
}
