Skip to content

Commit 1727c72

Browse files
committed
Set up reference documentation and JavaDoc
Closes gh-76
1 parent a1e8571 commit 1727c72

File tree

9 files changed

+1167
-74
lines changed

9 files changed

+1167
-74
lines changed

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ ext {
66
moduleProjects = subprojects.findAll { it.name.startsWith("spring-") }
77
}
88

9+
description = "Spring GraphQL"
10+
911
subprojects {
1012
apply plugin: 'io.spring.dependency-management'
1113

ci/pipeline.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ jobs:
9090
build_number: "${BUILD_PIPELINE_NAME}-${BUILD_JOB_NAME}-${BUILD_NAME}"
9191
disable_checksum_uploads: true
9292
threads: 8
93+
artifact_set:
94+
- include:
95+
- "/**/spring-graphql-*-docs.zip"
96+
properties:
97+
"zip.name": "spring-graphql"
98+
"zip.displayname": "Spring GraphQL"
99+
"zip.deployed": "false"
100+
"zip.type": "docs"
93101
get_params:
94102
threads: 8
95103
- name: stage-milestone

docs/build.gradle

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
plugins {
2+
id 'org.asciidoctor.jvm.convert' version '3.1.0'
3+
id 'de.undercouch.download' version '4.1.1'
4+
}
5+
6+
description = "Spring GraphQL reference documentation"
7+
8+
configurations {
9+
asciidoctorExt
10+
}
11+
12+
repositories {
13+
maven {
14+
url "https://repo.spring.io/release"
15+
mavenContent {
16+
includeGroup "io.spring.asciidoctor"
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
asciidoctorExt 'io.spring.asciidoctor:spring-asciidoctor-extensions-block-switch:0.6.0'
23+
}
24+
25+
ext.javadocLinks = [
26+
"https://docs.oracle.com/javase/8/docs/api/",
27+
"https://javadoc.io/doc/com.graphql-java/graphql-java/16.2/",
28+
"https://docs.spring.io/spring-framework/docs/5.3.x/javadoc-api/"
29+
] as String[]
30+
31+
/**
32+
* Produce Javadoc for all Spring GraphQL modules in "build/docs/javadoc"
33+
*/
34+
task api(type: Javadoc) {
35+
group = "Documentation"
36+
description = "Generates aggregated Javadoc API documentation."
37+
title = "${rootProject.description} ${version} API"
38+
39+
dependsOn {
40+
moduleProjects.collect {
41+
it.tasks.getByName("jar")
42+
}
43+
}
44+
45+
options {
46+
encoding = "UTF-8"
47+
memberLevel = JavadocMemberLevel.PROTECTED
48+
author = true
49+
header = rootProject.description
50+
use = true
51+
overview = "src/docs/api/overview.html"
52+
stylesheetFile = file("src/docs/api/stylesheet.css")
53+
splitIndex = true
54+
links(project.ext.javadocLinks)
55+
addStringOption('Xdoclint:none', '-quiet')
56+
if(JavaVersion.current().isJava9Compatible()) {
57+
addBooleanOption('html5', true)
58+
}
59+
}
60+
source = moduleProjects.collect { project ->
61+
project.sourceSets.main.allJava
62+
}
63+
classpath = moduleProjects.collect { project ->
64+
project.sourceSets.main.compileClasspath
65+
}.sum()
66+
maxMemory = "1024m"
67+
destinationDir = file("$buildDir/docs/javadoc")
68+
}
69+
70+
task downloadResources(type: Download) {
71+
def version = "0.2.5"
72+
src "https://repo.spring.io/release/io/spring/docresources/" +
73+
"spring-doc-resources/$version/spring-doc-resources-${version}.zip"
74+
dest project.file("$buildDir/docs/spring-doc-resources.zip")
75+
onlyIfModified true
76+
useETag "all"
77+
}
78+
79+
task extractDocResources(type: Copy, dependsOn: downloadResources) {
80+
from project.zipTree(downloadResources.dest);
81+
into "$buildDir/docs/spring-docs-resources/"
82+
}
83+
84+
asciidoctorj {
85+
version = '2.4.3'
86+
fatalWarnings ".*"
87+
options doctype: 'book', eruby: 'erubis'
88+
attributes([
89+
icons: 'font',
90+
idprefix: '',
91+
idseparator: '-',
92+
docinfo: 'shared',
93+
revnumber: project.version,
94+
sectanchors: '',
95+
sectnums: '',
96+
'source-highlighter': 'highlight.js',
97+
highlightjsdir: 'js/highlight',
98+
'highlightjs-theme': 'googlecode',
99+
stylesdir: 'css/',
100+
stylesheet: 'stylesheet.css'
101+
])
102+
}
103+
104+
/**
105+
* Generate the Spring GraphQL Reference documentation from "src/docs/asciidoc"
106+
* in "build/docs/reference/html".
107+
*/
108+
asciidoctor {
109+
baseDirFollowsSourceDir()
110+
configurations 'asciidoctorExt'
111+
sources {
112+
include '*.adoc'
113+
}
114+
outputDir "$buildDir/docs/reference/html"
115+
logDocuments = true
116+
resources {
117+
from(sourceDir) {
118+
include 'images/*.png', 'css/**', 'js/**'
119+
}
120+
from extractDocResources
121+
}
122+
}
123+
124+
/**
125+
* Zip all docs into a single archive
126+
*/
127+
task docsZip(type: Zip, dependsOn: ['api', 'asciidoctor']) {
128+
group = "Distribution"
129+
description = "Builds -${archiveClassifier} archive containing api and reference " +
130+
"for deployment at https://docs.spring.io/spring-graphql/docs."
131+
132+
archiveBaseName.set("spring-graphql")
133+
archiveClassifier.set("docs")
134+
from (api) {
135+
into "javadoc-api"
136+
}
137+
from ("$asciidoctor.outputDir") {
138+
into "reference/html"
139+
}
140+
}
141+
142+
apply from: "${rootDir}/gradle/publishing.gradle"
143+
144+
publishing {
145+
publications {
146+
mavenJava(MavenPublication) {
147+
artifact docsZip
148+
}
149+
}
150+
}
151+
152+

docs/src/docs/api/overview.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<html lang="en">
2+
<body>
3+
<p>
4+
This is the public API documentation for the <a href="https://spring.io/projects/spring-graphql" target="_top">Spring GraphQL project</a>.
5+
</p>
6+
</body>
7+
</html>

0 commit comments

Comments
 (0)