diff options
author | Vitaly Takmazov | 2018-09-12 15:29:37 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-09-12 15:29:37 +0300 |
commit | ddf8c3c0f07c0ca2fa6444c4511b61fc9a5c496c (patch) | |
tree | 486cc99823acb4159a3fd29bbc566dd69d3bdace /juick-server/build.gradle | |
parent | e97801561c497021a03317090b82d3c2568b1da7 (diff) |
static swagger docs
Diffstat (limited to 'juick-server/build.gradle')
-rw-r--r-- | juick-server/build.gradle | 60 |
1 files changed, 53 insertions, 7 deletions
diff --git a/juick-server/build.gradle b/juick-server/build.gradle index 9e1e3d79..9217d6b3 100644 --- a/juick-server/build.gradle +++ b/juick-server/build.gradle @@ -1,6 +1,8 @@ -apply plugin: 'war' +apply plugin: 'java' apply plugin: 'org.springframework.boot' apply plugin: 'com.moowork.node' +apply plugin: 'io.github.swagger2markup' +apply plugin: 'org.asciidoctor.convert' task compileFrontend(type: YarnTask) { inputs.files(fileTree('node_modules')) @@ -11,6 +13,51 @@ task compileFrontend(type: YarnTask) { args = ['run', 'compile'] } +ext { + swaggerOutputDir = file("${buildDir}/swagger") + docsOutputDir = file("${buildDir}/docs") +} + +test { + systemProperty 'io.springfox.staticdocs.outputDir', swaggerOutputDir + outputs.dir swaggerOutputDir +} + +convertSwagger2markup { + dependsOn test + swaggerInput "${swaggerOutputDir}/swagger.json" + outputDir swaggerOutputDir + config = [ + 'swagger2markup.markupLanguage' : 'ASCIIDOC', + 'swagger2markup.pathsGroupedBy' : 'TAGS' + ] +} +task asciidocIndex (type: Copy) { + from 'src/docs' + into swaggerOutputDir + include '*.adoc' +} +asciidoctor { + dependsOn convertSwagger2markup + dependsOn asciidocIndex + sourceDir = swaggerOutputDir + sources { + include 'index.adoc', 'overview.adoc', 'definitions.adoc', 'paths.adoc' + } + attributes = [ + doctype: 'book', + toc: 'left', + toclevels: '3', + numbered: '', + sectlinks: '', + sectanchors: '', + hardbreaks: '', + src: swaggerOutputDir, + generated: docsOutputDir + ] + outputDir = docsOutputDir +} + dependencies { compile project(':juick-common') @@ -19,11 +66,7 @@ dependencies { compile ('org.springframework.boot:spring-boot-starter-security') compile ('org.springframework.boot:spring-boot-starter-jdbc') - providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") - providedRuntime 'com.h2database:h2:1.4.196' - - compile 'io.springfox:springfox-swagger2:2.9.2' - compile 'io.springfox:springfox-swagger-ui:2.9.2' + compileOnly 'io.springfox:springfox-core:2.9.2' compile 'org.apache.commons:commons-email:1.5' compile 'com.github.scribejava:scribejava-apis:5.5.0' @@ -48,7 +91,8 @@ dependencies { compile 'org.flywaydb:flyway-core:5.1.4' - providedRuntime 'mysql:mysql-connector-java:5.1.45' + runtime 'mysql:mysql-connector-java:5.1.45' + runtime 'com.h2database:h2:1.4.196' runtime "commons-fileupload:commons-fileupload:1.3.3" compile 'com.github.scribejava:scribejava-apis:5.5.0' @@ -60,6 +104,8 @@ dependencies { testCompile ("org.springframework.boot:spring-boot-starter-test") testCompile ('net.sourceforge.htmlunit:htmlunit:2.32') testCompile ('org.springframework.security:spring-security-test') + + testCompile 'io.springfox:springfox-swagger2:2.9.2' } bootJar { |