plugins {
  id 'maven-publish'
  id 'java'
  id 'io.spring.dependency-management' version '1.0.9.RELEASE'
  id 'org.jetbrains.kotlin.jvm' version '1.3.71'
  id 'com.github.johnrengelman.shadow' version '6.0.0'
}

group = 'com.serverless'
version = 'dev'

description = """hello"""


sourceCompatibility = 11
targetCompatibility = 11

tasks.withType(JavaCompile) {
  options.encoding = 'UTF-8'
}

repositories {
  mavenCentral()
}

// If requiring AWS JDK, uncomment the dependencyManagement to use the bill of materials
//   https://aws.amazon.com/blogs/developer/managing-dependencies-with-aws-sdk-for-java-bill-of-materials-module-bom/
//dependencyManagement {
//    imports {
//        mavenBom 'com.amazonaws:aws-java-sdk-bom:1.11.688'
//    }
//}

dependencies {
  api (
      'org.jetbrains.kotlin:kotlin-stdlib:1.3.72',
      'com.amazonaws:aws-lambda-java-core:1.2.1',
      'com.amazonaws:aws-lambda-java-log4j2:1.2.0',
      'org.apache.logging.log4j:log4j-api:2.13.3',
      'org.apache.logging.log4j:log4j-core:2.13.3',
      'com.fasterxml.jackson.core:jackson-core:2.11.0',
      'com.fasterxml.jackson.core:jackson-databind:2.11.0',
      'com.fasterxml.jackson.core:jackson-annotations:2.11.0'
  )
}

task deploy(type: Exec, dependsOn: 'shadowJar') {
  commandLine 'serverless', 'deploy'
}

shadowJar{
  transform(com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer)
}

build.finalizedBy(shadowJar)
