// Note: this setup is special to be able to run in CI using the akka-grpc build
//       for a regular gradle config for consumer projects look at docs and quickstarts
buildscript {
  ext {
    if (!System.getProperty('akka.grpc.project.version')) {
      throw new GradleException("System property `akka.grpc.project.version` is not provided. Use -Dakka.grpc.project.version=\$VERSION.")
    }
    akkaGrpcVersion = System.getProperty('akka.grpc.project.version')
  }
  repositories {
    mavenLocal()
    gradlePluginPortal()
    maven {
      url "https://repo.akka.io/maven/github_actions"
    }
  }
}
plugins {
  id 'com.lightbend.akka.grpc.gradle' version "${akkaGrpcVersion}"
}

akkaGrpc {
  serverPowerApis = true // This isn't default
}

repositories {
  mavenLocal()
  mavenCentral()
  maven {
    url "https://repo.akka.io/maven/github_actions"
  }
}

def scalaVersion = org.gradle.util.VersionNumber.parse(System.getenv("TRAVIS_SCALA_VERSION") ?: "2.13")
def scalaBinaryVersion = "${scalaVersion.major}.${scalaVersion.minor}"
def akkaVersion = "2.10.5"
def protoGoogleCommonVersion = "2.22.0"

tasks.named("processResources") {
 duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

dependencies {
  implementation "com.typesafe.akka:akka-pki_${scalaBinaryVersion}:${akkaVersion}"
  protobuf "com.google.api.grpc:proto-google-common-protos:${protoGoogleCommonVersion}"
  testImplementation "com.typesafe.akka:akka-stream-testkit_${scalaBinaryVersion}:${akkaVersion}"
  testImplementation "com.typesafe.akka:akka-actor-testkit-typed_${scalaBinaryVersion}:${akkaVersion}"
  testImplementation "org.scalatest:scalatest_${scalaBinaryVersion}:3.2.12"
  testImplementation "org.scalatestplus:junit-4-12_${scalaBinaryVersion}:3.2.2.0"
}

