plugins {
  id 'java-library'
  id 'dev.clojurephant.clojure' version '0.5.0'
  id 'com.github.johnrengelman.shadow' version '6.0.0'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
  mavenCentral()
  maven { url "https://clojars.org/repo" }
}

dependencies {
  api(
      'com.amazonaws:aws-lambda-java-core:1.2.1',
      'com.amazonaws:aws-lambda-java-log4j:1.0.1',
      'org.clojure:data.json:1.0.0'
  )

  implementation 'org.clojure:clojure:1.10.1'
}

clojure {
  builds {
    main {
      aotAll()
    }
  }
}

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

shadowJar.finalizedBy(buildJson)
build.dependsOn shadowJar
