plugins {
    id 'org.springframework.boot' version '2.4.1'
    id 'io.spring.dependency-management' version '1.0.10.RELEASE'
    id 'org.asciidoctor.convert' version "1.5.9.2"
    id 'java'
    id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
}

group = 'com.flab'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

ext {
    set('snippetsDir', file("build/generated-snippets"))
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    compileOnly 'org.projectlombok:lombok'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    runtimeOnly 'com.h2database:h2'
    runtimeOnly 'mysql:mysql-connector-java'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
    asciidoctor 'org.springframework.restdocs:spring-restdocs-asciidoctor'
    implementation 'com.querydsl:querydsl-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
    compile group: 'net.nurigo', name: 'javaSDK', version: '2.2'
    implementation 'org.springframework.boot:spring-boot-starter-data-redis'
    implementation 'org.springframework.boot:spring-boot-starter-json'
    implementation group: 'org.msgpack', name: 'jackson-dataformat-msgpack', version: '0.8.22'
    implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310'
    compile('org.springframework.boot:spring-boot-starter-mustache')
    compile group: 'org.springframework.session', name: 'spring-session-data-redis', version: '2.4.2'
    implementation 'org.springframework.boot:spring-boot-starter-mail'
    implementation group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.11.964'
    implementation group: 'org.apache.tika', name: 'tika-parsers', version: '1.25'
    implementation 'com.google.firebase:firebase-admin:7.1.1'
}

test {
    outputs.dir snippetsDir
    useJUnitPlatform()
}

asciidoctor {
    inputs.dir snippetsDir
    dependsOn test
}

bootJar { // SpringBoot 1.5 이하일 경우 jar
    dependsOn asciidoctor
    from("${asciidoctor.outputDir}/html5") {
        into 'static/docs'
    }
}

def querydslDir = "$buildDir/generated/querydsl"
querydsl {
    jpa = true
    querydslSourcesDir = querydslDir
}
sourceSets {
    main.java.srcDir querydslDir
}
configurations {
    querydsl.extendsFrom compileClasspath
}
compileQuerydsl {
    options.annotationProcessorPath = configurations.querydsl
}
