Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Setting] REST Docs 그래들 설정 변경 #51

Merged
merged 1 commit into from
Mar 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,40 @@ clean {

// Spring Rest Docs 설정
// -------------------

ext {
snippetsDir = file('build/generated-snippets')
snippetsDir = file('build/generated-snippets') // 스니펫이 생성되는 디렉터리 경로를 설정
}

test {
outputs.dir snippetsDir
outputs.dir snippetsDir // 스니펫이 생성되는 디렉터리를 설정
}

asciidoctor { // Gradle이 asciidoctor Task를 수행하는 설정 (함수 선언)
configurations 'asciidoctorExt' // asciidoctor 확장 설정
baseDirFollowsSourceFile() // .adoc 파일을 include 하면서 사용하기 위한 설정
inputs.dir snippetsDir // 스니펫을 불러올 위치 설정
dependsOn test // Gradle의 test Task 이후 asciidoctor를 수행
}

asciidoctor.doFirst { // asciidoctor Task가 수행될 때 가장 먼저 수행
delete file('src/main/resources/static/docs')
}

task copyDocument(type: Copy) { // 생성된 html 파일을 옮긴다
dependsOn asciidoctor // Gradle의 asciidoctor Task 이후 수행
from file("${asciidoctor.outputDir}")
into file("src/main/resources/static/docs")
}

asciidoctor {
inputs.dir snippetsDir
configurations 'asciidoctorExt'
dependsOn test
build {
dependsOn copyDocument // build 이후 html 파일 복사
}

bootJar {
dependsOn asciidoctor
from("${asciidoctor.outputDir}/html5") {
into 'src/main/resources/static/docs'
dependsOn asciidoctor // asciidoctor 이후 bootJar 수행
from("${asciidoctor.outputDir}") {
into 'static/docs'
}
}
// -------------------
Loading