Эх сурвалжийг харах

Enable caching of :asciidoctor gradle task

Jerome Prinet 2 жил өмнө
parent
commit
2f7c4f62d9

+ 3 - 0
buildSrc/src/main/java/org/springframework/gradle/docs/SpringAsciidoctorPlugin.java

@@ -120,6 +120,9 @@ public class SpringAsciidoctorPlugin implements Plugin<Project> {
 				// Not using intermediateWorkDir.
 				// See https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/523
 				resourcesSrcDirSpec.include("images/*.png", "css/**", "js/**", "**/*.java");
+				// This exclusion is required to allow cacheability of :spring-authorization-server-docs:asciidoctor
+				// The whole docs/src/docs/asciidoc folder is being passed as a task input
+				resourcesSrcDirSpec.exclude("**/examples/build/**");
 			});
 		});
 		if (asciidoctorTask instanceof AsciidoctorTask) {

+ 0 - 3
docs/spring-authorization-server-docs.gradle

@@ -8,9 +8,6 @@ asciidoctor {
 			"spring-security-reference-base-url": "https://docs.spring.io/spring-security/reference",
 			"spring-security-api-base-url": "https://docs.spring.io/spring-security/site/docs/current/api",
 			"spring-boot-reference-base-url": "https://docs.spring.io/spring-boot/docs/current/reference/html",
-			"examples-dir": "examples",
-			"samples-dir": "$rootDir/samples",
-			"docs-java": "$sourceDir/examples/src/main/java",
 			"chomp": "default headers packages",
 			"toc": "left",
 			"toclevels": "4"

+ 3 - 0
docs/src/docs/asciidoc/attributes.adoc

@@ -0,0 +1,3 @@
+:examples-dir:                  examples
+:samples-dir:                   ../../../../samples
+:docs-java:                     {docdir}/examples/src/main/java

+ 2 - 0
docs/src/docs/asciidoc/getting-started.adoc

@@ -1,3 +1,5 @@
+include::attributes.adoc[]
+
 [[getting-started]]
 = Getting Started
 

+ 3 - 0
docs/src/docs/asciidoc/guides/attributes.adoc

@@ -0,0 +1,3 @@
+:examples-dir:                  ../examples
+:samples-dir:                   ../../../../../samples
+:docs-java:                     {docdir}/examples/src/main/java

+ 2 - 1
docs/src/docs/asciidoc/guides/how-to-ext-grant-type.adoc

@@ -1,8 +1,9 @@
+include::attributes.adoc[]
+
 [[how-to-extension-grant-type]]
 = How-to: Implement an Extension Authorization Grant Type
 :index-link: ../how-to.html
 :docs-dir: ..
-:examples-dir: {docs-dir}/examples
 
 This guide shows how to extend xref:{docs-dir}/index.adoc#top[Spring Authorization Server] with an https://datatracker.ietf.org/doc/html/rfc6749#section-4.5[extension authorization grant type].
 The purpose of this guide is to demonstrate how to implement an extension authorization grant type and configure it at the xref:{docs-dir}/protocol-endpoints.adoc#oauth2-token-endpoint[OAuth2 Token endpoint].

+ 2 - 0
docs/src/docs/asciidoc/guides/how-to-jpa.adoc

@@ -1,3 +1,5 @@
+include::attributes.adoc[]
+
 [[how-to-jpa]]
 = How-to: Implement core services with JPA
 :index-link: ../how-to.html

+ 2 - 1
docs/src/docs/asciidoc/guides/how-to-pkce.adoc

@@ -1,8 +1,9 @@
+include::attributes.adoc[]
+
 [[how-to-pkce]]
 = How-to: Authenticate using a Single Page Application with PKCE
 :index-link: ../how-to.html
 :docs-dir: ..
-:examples-dir: {docs-dir}/examples
 
 This guide shows how to configure xref:{docs-dir}/index.adoc#top[Spring Authorization Server] to support a Single Page Application (SPA) with Proof Key for Code Exchange (PKCE).
 The purpose of this guide is to demonstrate how to support a public client and require PKCE for client authentication.

+ 2 - 2
docs/src/docs/asciidoc/guides/how-to-social-login.adoc

@@ -1,9 +1,9 @@
+include::attributes.adoc[]
+
 [[how-to-social-login]]
 = How-to: Authenticate using Social Login
 :index-link: ../how-to.html
 :docs-dir: ..
-:examples-dir: {docs-dir}/examples
-:samples-dir: {docs-dir}/../../../../samples
 :github-ref: main
 :github-base-url: https://github.com/spring-projects/spring-authorization-server/blob/{github-ref}
 

+ 2 - 0
docs/src/docs/asciidoc/guides/how-to-userinfo.adoc

@@ -1,3 +1,5 @@
+include::attributes.adoc[]
+
 [[how-to-userinfo]]
 = How-to: Customize the OpenID Connect 1.0 UserInfo response
 :index-link: ../how-to.html

+ 2 - 0
docs/src/docs/asciidoc/how-to.adoc

@@ -1,3 +1,5 @@
+include::attributes.adoc[]
+
 [[how-to]]
 = How-to Guides