buildscript {
    ext {
        snippetsDir = file('build/generated-snippets')
    }
}

plugins {
    id "org.springframework.boot" version "2.6.2"
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'org.asciidoctor.convert' version '1.5.8'
    id 'com.adarshr.test-logger' version '2.0.0'
    id 'java'
}

group = 'com.example'
version = '1.0.0-SNAPSHOT'
sourceCompatibility = '11'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

test {
    useJUnitPlatform()
    outputs.dir snippetsDir
}

asciidoctor {
    inputs.dir snippetsDir
    setOptions([
            'doctype': 'book',
            'backend': 'html5'
    ])
    setAttributes([
            'snippets'          : snippetsDir,
            'source-highlighter': 'coderay',
            'toc'               : 'left',
            'toclevels'         : '3',
            'sectlinks'         : 'true'
    ])
    dependsOn test
}

dependencies {
    implementation('org.springframework.boot:spring-boot-starter-actuator')
    implementation('org.springframework.boot:spring-boot-starter-data-jpa')
    implementation('org.springframework.boot:spring-boot-starter-validation')
    implementation('org.springframework.boot:spring-boot-starter-web')
    implementation('org.springframework.boot:spring-boot-starter-actuator')
    implementation('org.springframework.boot:spring-boot-starter-oauth2-resource-server')
    implementation('org.springframework.boot:spring-boot-starter-hateoas')
    developmentOnly('org.springframework.boot:spring-boot-devtools')
    runtimeOnly('com.h2database:h2')
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
    testImplementation('org.springframework.restdocs:spring-restdocs-mockmvc')
    testImplementation('org.springframework.security:spring-security-test')
}
