buildscript {
  ext.kotlin_version = '2.0.20'
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath "com.google.cloud.tools:appengine-gradle-plugin:2.4.5"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  }
}

repositories {
  mavenCentral()
}

apply plugin: 'kotlin'
apply plugin: 'war'
apply plugin: 'com.google.cloud.tools.appengine-appenginewebxml'

compileKotlin {
  kotlinOptions {
    jvmTarget = '21'
  }
}

webAppDirName = 'web'

sourceSets {
  main {
    java { srcDir 'src' }
    resources { srcDir 'src' }
  }
  test {
    java { srcDir 'test' }
    resources { srcDir 'test' }
  }
}

dependencies {
  implementation 'com.google.appengine:appengine-api-1.0-sdk:+'
  providedCompile 'jakarta.servlet:jakarta.servlet-api:5.0.0'
  implementation 'com.atlassian.commonmark:commonmark:0.17.0'
  implementation 'com.github.scribejava:scribejava-apis:8.3.1'
  implementation 'com.google.code.gson:gson:2.8.9'
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

  testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
  testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1")
  testImplementation 'org.assertj:assertj-core:3.21.0'
  testImplementation "io.mockk:mockk:1.13.13"
}

test {
  useJUnitPlatform()
  testLogging {
    events "failed"
    exceptionFormat "full"
  }
}

appengineDeploy.dependsOn test
appengineStage.dependsOn test

appengine {
  deploy {
    version = '3'
    projectId = 'anton-photos'
  }
}
