buildscript {
  ext {
    javaVersion = '1.8'
    javaeeVersion = '8.0'
    jgivenVersion = '0.15.3'
    logbackVersion = '1.2.3'
    junitJupiterVersion = '5.3.1'
    junitPlatformVersion = '1.3.0'
  }

  dependencies {
    classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16'
    classpath 'org.jruby:jruby-complete:9.2.5.0'
  }

  configurations.all {
    resolutionStrategy {
      force 'org.codehaus.groovy:groovy-all:2.5.4' // asciidoctor
    }
  }
}

plugins {
//id 'com.gradle.build-scan' version '1.16'
//id 'ear'
  id 'war'
  id 'idea'
  id 'maven'
  id 'eclipse'

  id 'cn.bestwu.propdeps-eclipse' version '0.0.10' apply false
  id 'cn.bestwu.propdeps-maven' version '0.0.10' apply false
  id 'cn.bestwu.propdeps-idea' version '0.0.10' apply false
  id 'cn.bestwu.propdeps' version '0.0.10' apply false
  id 'com.github.spotbugs' version '1.6.9' apply false

  id 'com.jfrog.artifactory' version '4.8.1' apply false
  id 'org.asciidoctor.convert' version '1.5.9.1' apply false
  id 'org.ajoberstar.git-publish' version '2.0.0' apply false
  id 'io.spring.dependency-management' version '1.0.6.RELEASE'
  id 'com.avast.gradle.docker-compose' version '0.7.1'
  id 'io.franzbecker.gradle-lombok' version '2.0'
}

apply from: "$projectDir/gradle/ide.gradle"
apply from: "$projectDir/gradle/clean.gradle"

final String gradleDir = "$rootDir/gradle"
allprojects {
  buildscript {
    apply from: "$gradleDir/repositories-config.gradle"
  }
  apply from: "$gradleDir/repositories-config.gradle"
}

version = '0.0.1'
group = 'com.github.daggerok'
sourceCompatibility = targetCompatibility = "$javaVersion"
lombok.version = '1.18.6'

compileJava.dependsOn(processResources)

dependencies {
  implementation 'org.webjars:materializecss:1.0.0'
  implementation 'org.webjars:material-design-icons:3.0.1'

  providedCompile "javax:javaee-api:$javaeeVersion"
  compileOnly "javax:javaee-api:$javaeeVersion"
  //read more: https://jersey.github.io/documentation/latest/media.html#json.jackson
  implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.7'
  implementation 'io.vavr:vavr:0.9.2'

  testImplementation 'junit:junit:4.12'
  testImplementation 'org.assertj:assertj-core:3.11.1'
  testImplementation 'org.hamcrest:hamcrest-core:2.1'
  testImplementation "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion"
  testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion"
  testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:4.12.3', {
    because 'allows JUnit 3 and JUnit 4 tests to run'
  }
  testRuntime "org.junit.platform:junit-platform-launcher:$junitPlatformVersion", {
    because 'allows tests to run from IDEs that bundle older version of launcher'
  }
  testCompileOnly 'org.apiguardian:apiguardian-api:1.0.0'
}

dependencyManagement {
  imports {
    mavenBom "javax:javaee-api:$javaeeVersion"
    mavenBom "org.junit:junit-bom:$junitJupiterVersion"
    mavenBom 'org.apache.logging.log4j:log4j-bom:2.11.1'
  }
}

test {
  useJUnitPlatform {
    includeEngines 'junit-jupiter', 'junit-vintage'
  }
}

apply from: "$project.rootDir/gradle/jgiven.gradle"
apply from: "$projectDir/gradle/spotbugs.gradle"
//apply from: "$projectDir/gradle/findbugs.gradle"
apply from: "$projectDir/gradle/docker-compose.gradle"
apply from: "$projectDir/gradle/docs.gradle"
//apply from: "$projectDir/gradle/build-scan.gradle"
apply from: "$projectDir/gradle/payara-micro.gradle"

wrapper {
  gradleVersion = '5.4.1'
  distributionType = Wrapper.DistributionType.BIN
}
