plugins {
  id "org.gradle.playframework" version "0.9"
  id 'com.google.cloud.tools.jib' version '2.5.0'
}

ext {
  playVersion = "2.6.20"
  scalaVersion = System.getProperty("scala.binary.version", /* default = */ "2.12")
}

play {
  platform {
    playVersion = project.ext.playVersion
    scalaVersion = project.ext.scalaVersion
    javaVersion = JavaVersion.VERSION_1_8
  }
  injectedRoutesGenerator = true
}

repositories {
  mavenLocal()
  mavenCentral()
  jcenter()
  maven {
    name "lightbend-maven-releases"
    url "https://repo.lightbend.com/lightbend/maven-release"
  }
}

description = 'Play Integration Tests.'

dependencies {
  implementation "com.typesafe.play:play-guice_$scalaVersion:$playVersion"
  implementation "com.typesafe.play:play-logback_$scalaVersion:$playVersion"
  implementation "com.typesafe.play:filters-helpers_$scalaVersion:$playVersion"
}

def targetJDK = project.hasProperty("targetJDK") ? project.targetJDK : 11

def tag = findProperty("tag") ?: new Date().format("yyyyMMdd.HHmmSS")

jib {
  from.image = "bellsoft/liberica-openjdk-alpine:$targetJDK"
  to.image = "ghcr.io/open-telemetry/java-test-containers:smoke-play-jdk$targetJDK-$tag"
  container.mainClass = "play.core.server.ProdServerStart"
}