plugins {
    id 'groovy'
    id 'java-library'
    id 'com.github.johnrengelman.shadow' version '6.0.0'
}

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    api (
        'org.codehaus.groovy:groovy:3.0.4',
        'org.codehaus.groovy:groovy-json:3.0.4',
        'com.amazonaws:aws-lambda-java-core:1.2.1',
        'com.amazonaws:aws-lambda-java-log4j:1.0.1'
    )
}

task(buildJson) {
  doLast {
    new File("$buildDir/build.json").newWriter().withWriter { w ->
      w << groovy.json.JsonOutput.toJson([distribution: relativePath(shadowJar.archivePath)])
    }
  }
}

shadowJar.finalizedBy(buildJson)
build.dependsOn shadowJar
