plugins {
    id 'org.springframework.boot' version '2.7.18'
    id 'io.spring.dependency-management' version '1.1.0'
    // querydsl
    id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10'
    id 'java'
    id 'org.sonarqube' version '3.5.0.2730'
}

group 'org.egovframe.cloud'
version '4.3.0'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
    maven { url "https://maven.egovframe.go.kr/maven/" }
}

bootJar {
    enabled(false)
}
jar {
    enabled(true)
}

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

ext {
    set('springCloudVersion', '2021.0.9')
    set('log4j2.version', '2.23.1') // log4j 보안 패치
}

dependencies {
    // EgovAbstractServiceImpl
    implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.3.0') {
        exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging'
    }
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-validation' // LocalValidatorFactoryBean
    implementation 'io.jsonwebtoken:jjwt:0.9.1'
    implementation 'org.javassist:javassist:3.29.2-GA'
    implementation 'org.webjars:webjars-locator-core:0.53'

    // querydsl
    implementation 'com.querydsl:querydsl-jpa:5.0.0'
    annotationProcessor 'com.querydsl:querydsl-apt:5.0.0'
    implementation 'com.querydsl:querydsl-sql:5.0.0'
    implementation 'com.querydsl:querydsl-sql-spring:5.0.0'

    //openapi docs
    implementation group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'
    implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'
    implementation 'org.springdoc:springdoc-openapi-webmvc-core:1.7.0'
    implementation 'org.springdoc:springdoc-openapi-webflux-ui:1.7.0'

    //reactive
    implementation 'org.springframework.boot:spring-boot-starter-data-r2dbc'
    implementation 'org.springframework.boot:spring-boot-starter-webflux'

    annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"

    //messaging
    implementation 'org.springframework.cloud:spring-cloud-stream'
    implementation 'org.springframework.cloud:spring-cloud-stream-binder-rabbit'

    // lombok
    implementation 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.projectlombok:lombok'
    testAnnotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'io.projectreactor:reactor-test'
    testImplementation 'org.springframework.security:spring-security-test'
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

// querydsl 추가 시작
def querydslDir = "$buildDir/generated/querydsl"
querydsl {
    jpa = true
    querydslSourcesDir = querydslDir
}
sourceSets {
    main.java.srcDir querydslDir
}
configurations {
    querydsl.extendsFrom compileClasspath
}
compileQuerydsl {
    options.annotationProcessorPath = configurations.querydsl
    options.compilerArgs << '-Aquerydsl.generatedAnnotationClass=javax.annotation.Generated'
}
// querydsl 추가 끝
