plugins {
    id 'play'
    id 'idea'
}

def playVersion = '2.6.19'
def scalaVersion = System.getProperty("scala.binary.version", /* default = */ "2.12")

model {
    components {
        play {
            platform play: playVersion, scala: scalaVersion, java: '1.8'
            injectedRoutesGenerator = true

            sources {
                twirlTemplates {
                    defaultImports = TwirlImports.SCALA
                }
            }
        }
    }
}

// EXAMPLE: How to add parameter to Scala compiler
// Another option is documented here:
// https://docs.gradle.org/current/userguide/play_plugin.html#sec:configuring_compiler_options
//
// See other configurations for ScalaCompile task here:
// https://docs.gradle.org/current/dsl/org.gradle.api.tasks.scala.ScalaCompile.html
//
// tasks.withType(ScalaCompile) {
//     scalaCompileOptions.additionalParameters = [
//         "-deprecation",
//         "-verbose"
//     ]
// }

// EXAMPLE: How to add JVM parameters when running `runPlayBinary`.
// See other configurations for PlayRun here:
// https://docs.gradle.org/current/dsl/org.gradle.play.tasks.PlayRun.html
//
// tasks.withType(PlayRun) {
//     forkOptions.jvmArgs = ['-Dplay.http.secret.key=yadayada']
// }

// EXAMPLE: How to add JVM parameters to the script created by `stage`.
// See more details here:
// https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/application/CreateStartScripts.html
//
// tasks.withType(CreateStartScripts) {
//     defaultJvmOpts = ['-Dplay.http.secret.key=yadayada']
// }

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

    playTest "org.scalatestplus.play:scalatestplus-play_$scalaVersion:3.1.2"
}

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