Skip to content

Commit b3aebf9

Browse files
committed
Download docs resources as zip file in asciidoc build
Prior to this commit, the reference documentation build with asciidoctor would get the common "spring-docs-resources" as a dependency and then use it when generating the docs. As seen in #23124, this can cause problems since we'd like to consistently resolve our dependencies. In this case, the "spring-doc-resources" archive is not published on maven central since it's not officially supported by the Spring team as an open source project. This commit updates the reference documentation build to get this archive as a simple download task and avoid resolving it as a dependency. See gh-23282
1 parent 5053df5 commit b3aebf9

File tree

2 files changed

+23
-30
lines changed

2 files changed

+23
-30
lines changed

build.gradle

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
buildscript {
22
repositories {
3-
maven { url "https://repo.spring.io/plugins-release" }
3+
maven { url 'https://repo.spring.io/plugins-release' }
44
}
55
dependencies {
6-
classpath("io.spring.nohttp:nohttp-gradle:0.0.3.RELEASE")
7-
classpath("org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16")
8-
classpath("io.spring.asciidoctor:spring-asciidoctor-extensions:0.1.3.RELEASE")
6+
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16'
7+
classpath 'io.spring.asciidoctor:spring-asciidoctor-extensions:0.1.3.RELEASE'
98
}
109
}
11-
12-
// 3rd party plugin repositories can be configured in settings.gradle
1310
plugins {
14-
id 'org.springframework.build.test-sources' apply false
15-
id "io.spring.dependency-management" version "1.0.7.RELEASE" apply false
16-
id "org.jetbrains.kotlin.jvm" version "1.3.41" apply false
17-
id "org.jetbrains.dokka" version "0.9.18" apply false
18-
id "org.asciidoctor.convert" version "1.5.8"
11+
id 'io.spring.dependency-management' version '1.0.7.RELEASE' apply false
12+
id 'org.jetbrains.kotlin.jvm' version '1.3.41' apply false
13+
id 'org.jetbrains.dokka' version '0.9.18' apply false
14+
id 'org.asciidoctor.convert' version '1.5.8'
15+
id 'io.spring.nohttp' version '0.0.3.RELEASE'
16+
id 'de.undercouch.download' version '4.0.0'
1917
}
2018

2119
ext {

gradle/docs.gradle

+14-19
Original file line numberDiff line numberDiff line change
@@ -79,37 +79,32 @@ dokka {
7979
}
8080
}
8181

82-
configurations {
83-
docs
82+
task downloadResources(type: Download) {
83+
def version = "0.1.2.RELEASE"
84+
src "https://repo.spring.io/release/io/spring/docresources/" +
85+
"spring-doc-resources/$version/spring-doc-resources-${version}.zip"
86+
dest project.file("$buildDir/docs/spring-doc-resources.zip")
8487
}
8588

86-
dependencies {
87-
// for documentation resources
88-
docs "io.spring.docresources:spring-doc-resources:0.1.0.RELEASE@zip"
89-
}
90-
91-
task extractDocResources(type: Sync) {
92-
dependsOn configurations.docs
93-
from {
94-
configurations.docs.collect { zipTree(it) }
95-
}
96-
from "src/docs/asciidoc/"
97-
into "$buildDir/asciidoc/build"
89+
task extractDocResources(type: Copy, dependsOn: downloadResources) {
90+
from project.zipTree(downloadResources.dest);
91+
into "$buildDir/docs/spring-docs-resources/"
9892
}
9993

10094
/**
10195
* Produce the Spring Framework Reference documentation
10296
* from "src/docs/asciidoc" into "build/asciidoc/html5"
10397
*/
10498
asciidoctor {
105-
sourceDir "$buildDir/asciidoc/build"
10699
sources {
107100
include '*.adoc'
108101
}
102+
outputDir "$buildDir/docs/ref-docs/"
109103
resources {
110104
from(sourceDir) {
111105
include 'images/*', 'css/**', 'js/**'
112106
}
107+
from "$buildDir/docs/spring-docs-resources/"
113108
}
114109
logDocuments = true
115110
backends = ["html5"]
@@ -121,10 +116,10 @@ asciidoctor {
121116
attributes 'icons': 'font',
122117
'idprefix': '',
123118
'idseparator': '-',
124-
docinfo: 'shared',
125-
revnumber: project.version,
126-
sectanchors: '',
127-
sectnums: '',
119+
'docinfo': 'shared',
120+
'revnumber': project.version,
121+
'sectanchors': '',
122+
'sectnums': '',
128123
'source-highlighter=highlight.js',
129124
'highlightjsdir=js/highlight',
130125
'highlightjs-theme=atom-one-dark-reasonable',

0 commit comments

Comments
 (0)