From a957b7d05c372d8ca18a2cde58fa2f3b3bd8c9f4 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Tue, 10 Sep 2019 23:33:26 -0400 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9E=84=E5=BB=BA=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=BD=BF=E7=94=A8=E6=96=B0=E7=9A=84=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 92 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 79 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index f59cf6d..a96c1f7 100644 --- a/build.gradle +++ b/build.gradle @@ -6,21 +6,18 @@ apply plugin: 'java' version = '1.0.0' -asciidoctor { +allprojects { + repositories { + maven { url "https://maven.ossez.com/repository/internal" } + } - def build = file('build.gradle') + ext { + environmentProperty = project.hasProperty('environment') ? getProperty('environment') : 'hsql' - attributes 'build-gradle': build, - 'endpoint-url': 'https://docs.ossez.com', - 'source-highlighter': 'coderay', - 'imagesdir': 'images', - 'includedir': '_includes', - 'toc': 'left', - 'icons': 'font', - 'setanchors': '', - 'idprefix': '', - 'idseparator': '-', - 'docinfo1': '' + docResourcesVersion = '0.1.0' + } + + apply plugin: 'idea' } allprojects { @@ -28,3 +25,72 @@ allprojects { maven { url "https://maven.ossez.com/repository/internal" } } } +configurations { + docs +} + +dependencies { + docs "com.ossez.docresources:ossez-doc-resources:${docResourcesVersion}@zip" +} + + +task prepareAsciidocBuildZH(type: Sync) { + dependsOn configurations.docs + // copy doc resources + from { + configurations.docs.collect { zipTree(it) } + } + // and doc sources + from "src/docs/asciidoc/" + // to a build directory of your choice + into "$buildDir/asciidoc/assemble" + +} + +task('makePDFZH', type: org.asciidoctor.gradle.AsciidoctorTask){ + dependsOn prepareAsciidocBuildZH + backends 'pdf' + sourceDir "$buildDir/asciidoc/assemble" + sources { + include 'index-single.adoc' + } + options doctype: 'book', eruby: 'erubis' + logDocuments = true + attributes 'icons': 'font', + 'sectanchors': '', + 'sectnums': '', + 'toc': '', + 'source-highlighter' : 'coderay', + revnumber: project.version +} + +asciidoctor { + dependsOn makePDFZH + backends 'html5' + sourceDir "$buildDir/asciidoc/assemble" + resources { + from(sourceDir) { + include 'images/*', 'css/**', 'js/**' + } + } + options doctype: 'book', eruby: 'erubis' + logDocuments = true + attributes 'docinfo': 'shared', + // use provided stylesheet + stylesdir: "css/", + stylesheet: 'ossez.css', + 'linkcss': true, + 'icons': 'font', + 'sectanchors': '', + // use provided highlighter + 'source-highlighter=highlight.js', + 'highlightjsdir=js/highlight', + 'highlightjs-theme=atom-one-dark-reasonable', + 'idprefix': '', + 'idseparator': '-', + 'spring-version': project.version, + 'allow-uri-read': '', + revnumber: project.version +} + +