| 
									
										
										
										
											2023-04-19 23:24:00 +08:00
										 |  |  | plugins { | 
					
						
							|  |  |  | 	id 'kotlin' | 
					
						
							|  |  |  | 	id 'io.spring.antora.generate-antora-yml' version '0.0.1' | 
					
						
							|  |  |  | 	id 'org.antora' version '1.0.0' | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-02 17:48:38 +08:00
										 |  |  | description = "Spring Framework Docs" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | apply from: "${rootDir}/gradle/publications.gradle" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-19 23:24:00 +08:00
										 |  |  | antora { | 
					
						
							|  |  |  | 	version = '3.2.0-alpha.2' | 
					
						
							| 
									
										
										
										
											2023-05-23 22:04:09 +08:00
										 |  |  | 	playbook = 'cached-antora-playbook.yml' | 
					
						
							| 
									
										
										
										
											2023-05-03 13:37:41 +08:00
										 |  |  | 	playbookProvider { | 
					
						
							| 
									
										
										
										
											2023-05-04 22:37:21 +08:00
										 |  |  | 		repository = 'spring-projects/spring-framework' | 
					
						
							| 
									
										
										
										
											2023-05-03 13:37:41 +08:00
										 |  |  | 		branch = 'docs-build' | 
					
						
							|  |  |  | 		path = 'lib/antora/templates/per-branch-antora-playbook.yml' | 
					
						
							|  |  |  | 		checkLocalBranch = true | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2023-04-19 23:24:00 +08:00
										 |  |  | 	options = ['--clean', '--stacktrace'] | 
					
						
							|  |  |  | 	environment = [ | 
					
						
							|  |  |  | 			'ALGOLIA_API_KEY': '82c7ead946afbac3cf98c32446154691', | 
					
						
							|  |  |  | 			'ALGOLIA_APP_ID': '244V8V9FGG', | 
					
						
							|  |  |  | 			'ALGOLIA_INDEX_NAME': 'framework-docs' | 
					
						
							|  |  |  | 	] | 
					
						
							|  |  |  | 	dependencies = [ | 
					
						
							|  |  |  | 			'@antora/atlas-extension': '1.0.0-alpha.1', | 
					
						
							|  |  |  | 			'@antora/collector-extension': '1.0.0-alpha.3', | 
					
						
							|  |  |  | 			'@asciidoctor/tabs': '1.0.0-beta.3', | 
					
						
							|  |  |  | 			'@opendevise/antora-release-line-extension': '1.0.0-alpha.2', | 
					
						
							| 
									
										
										
										
											2023-05-03 13:37:41 +08:00
										 |  |  | 			'@springio/antora-extensions': '1.3.0', | 
					
						
							| 
									
										
										
										
											2023-04-19 23:24:00 +08:00
										 |  |  | 			'@springio/asciidoctor-extensions': '1.0.0-alpha.9' | 
					
						
							|  |  |  | 	] | 
					
						
							| 
									
										
										
										
											2019-12-16 17:03:40 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-19 01:11:35 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-19 23:24:00 +08:00
										 |  |  | tasks.named("generateAntoraYml") { | 
					
						
							|  |  |  | 	asciidocAttributes = project.provider( { | 
					
						
							|  |  |  | 		return  ["spring-version": project.version ] | 
					
						
							|  |  |  | 	} ) | 
					
						
							| 
									
										
										
										
											2022-11-19 01:11:35 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-19 04:12:18 +08:00
										 |  |  | tasks.create("generateAntoraResources") { | 
					
						
							|  |  |  | 	dependsOn 'generateAntoraYml' | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-02 17:48:38 +08:00
										 |  |  | jar { | 
					
						
							|  |  |  | 	enabled = false | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | javadoc { | 
					
						
							|  |  |  | 	enabled = false | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-19 23:24:00 +08:00
										 |  |  | repositories { | 
					
						
							|  |  |  | 	maven { | 
					
						
							|  |  |  | 		url "https://repo.spring.io/release" | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-02-07 19:16:02 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-19 04:12:18 +08:00
										 |  |  | dependencies { | 
					
						
							|  |  |  | 	api(project(":spring-context")) | 
					
						
							|  |  |  | 	api(project(":spring-web")) | 
					
						
							|  |  |  | 	api("jakarta.servlet:jakarta.servlet-api") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	implementation(project(":spring-core-test")) | 
					
						
							|  |  |  | 	implementation("org.assertj:assertj-core") | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Produce Javadoc for all Spring Framework modules in "build/docs/javadoc" | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | task api(type: Javadoc) { | 
					
						
							|  |  |  | 	group = "Documentation" | 
					
						
							|  |  |  | 	description = "Generates aggregated Javadoc API documentation." | 
					
						
							|  |  |  | 	title = "${rootProject.description} ${version} API" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dependsOn { | 
					
						
							| 
									
										
										
										
											2022-07-28 16:43:26 +08:00
										 |  |  | 		moduleProjects.collect { | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 			it.tasks.getByName("jar") | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	doFirst { | 
					
						
							|  |  |  | 		classpath = files( | 
					
						
							|  |  |  | 				// ensure the javadoc process can resolve types compiled from .aj sources
 | 
					
						
							|  |  |  | 				project(":spring-aspects").sourceSets.main.output | 
					
						
							|  |  |  | 		) | 
					
						
							| 
									
										
										
										
											2022-07-28 16:43:26 +08:00
										 |  |  | 		classpath += files(moduleProjects.collect { it.sourceSets.main.compileClasspath }) | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	options { | 
					
						
							|  |  |  | 		encoding = "UTF-8" | 
					
						
							|  |  |  | 		memberLevel = JavadocMemberLevel.PROTECTED | 
					
						
							|  |  |  | 		author = true | 
					
						
							|  |  |  | 		header = rootProject.description | 
					
						
							|  |  |  | 		use = true | 
					
						
							| 
									
										
										
										
											2022-11-02 17:48:38 +08:00
										 |  |  | 		overview = "framework-docs/src/docs/api/overview.html" | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | 		splitIndex = true | 
					
						
							|  |  |  | 		links(project.ext.javadocLinks) | 
					
						
							| 
									
										
										
										
											2023-05-05 00:20:43 +08:00
										 |  |  | 		addBooleanOption('Xdoclint:syntax,reference', true) // only check syntax and reference with doclint
 | 
					
						
							| 
									
										
										
										
											2021-09-29 22:56:33 +08:00
										 |  |  | 		addBooleanOption('Werror', true) // fail build on Javadoc warnings
 | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-07-28 16:43:26 +08:00
										 |  |  | 	source moduleProjects.collect { project -> | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | 		project.sourceSets.main.allJava | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	maxMemory = "1024m" | 
					
						
							|  |  |  | 	destinationDir = file("$buildDir/docs/javadoc") | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Produce KDoc for all Spring Framework modules in "build/docs/kdoc" | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2022-11-02 17:48:38 +08:00
										 |  |  | rootProject.tasks.dokkaHtmlMultiModule.configure { | 
					
						
							|  |  |  | 	dependsOn { | 
					
						
							|  |  |  | 		tasks.getByName("api") | 
					
						
							| 
									
										
										
										
											2017-08-29 06:57:07 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-11-02 17:48:38 +08:00
										 |  |  | 	moduleName.set("spring-framework") | 
					
						
							|  |  |  | 	outputDirectory.set(project.file("$buildDir/docs/kdoc")) | 
					
						
							| 
									
										
										
										
											2021-05-22 03:16:30 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2017-08-29 06:57:07 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2023-04-19 04:12:18 +08:00
										 |  |  |  * Zip all Java docs (javadoc & kdoc) into a single archive | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2023-04-19 04:12:18 +08:00
										 |  |  | task docsZip(type: Zip, dependsOn: ['api', rootProject.tasks.dokkaHtmlMultiModule]) { | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 	group = "Distribution" | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | 	description = "Builds -${archiveClassifier} archive containing api and reference " + | 
					
						
							| 
									
										
										
										
											2022-07-26 21:45:12 +08:00
										 |  |  | 			"for deployment at https://docs.spring.io/spring-framework/docs/." | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | 	archiveBaseName.set("spring-framework") | 
					
						
							|  |  |  | 	archiveClassifier.set("docs") | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 	from("src/dist") { | 
					
						
							|  |  |  | 		include "changelog.txt" | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	from (api) { | 
					
						
							|  |  |  | 		into "javadoc-api" | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-11-02 17:48:38 +08:00
										 |  |  | 	from (rootProject.tasks.dokkaHtmlMultiModule.outputDirectory) { | 
					
						
							| 
									
										
										
										
											2017-08-29 06:57:07 +08:00
										 |  |  | 		into "kdoc-api" | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Zip all Spring Framework schemas into a single archive | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | task schemaZip(type: Zip) { | 
					
						
							|  |  |  | 	group = "Distribution" | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | 	archiveBaseName.set("spring-framework") | 
					
						
							|  |  |  | 	archiveClassifier.set("schema") | 
					
						
							|  |  |  | 	description = "Builds -${archiveClassifier} archive containing all " + | 
					
						
							| 
									
										
										
										
											2019-03-06 06:21:36 +08:00
										 |  |  | 			"XSDs for deployment at https://springframework.org/schema." | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | 	duplicatesStrategy DuplicatesStrategy.EXCLUDE | 
					
						
							| 
									
										
										
										
											2022-07-28 16:43:26 +08:00
										 |  |  | 	moduleProjects.each { module -> | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 		def Properties schemas = new Properties(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | 		module.sourceSets.main.resources.find { | 
					
						
							| 
									
										
										
										
											2019-11-05 16:44:23 +08:00
										 |  |  | 			(it.path.endsWith("META-INF/spring.schemas") || it.path.endsWith("META-INF\\spring.schemas")) | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 		}?.withInputStream { schemas.load(it) } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		for (def key : schemas.keySet()) { | 
					
						
							|  |  |  | 			def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1') | 
					
						
							|  |  |  | 			assert shortName != key | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | 			File xsdFile = module.sourceSets.main.resources.find { | 
					
						
							| 
									
										
										
										
											2019-11-05 16:44:23 +08:00
										 |  |  | 				(it.path.endsWith(schemas.get(key)) || it.path.endsWith(schemas.get(key).replaceAll('\\/','\\\\'))) | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 			} | 
					
						
							|  |  |  | 			assert xsdFile != null | 
					
						
							|  |  |  | 			into (shortName) { | 
					
						
							|  |  |  | 				from xsdFile.path | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Create a distribution zip with everything: | 
					
						
							|  |  |  |  * docs, schemas, jars, source jars, javadoc jars | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) { | 
					
						
							|  |  |  | 	group = "Distribution" | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | 	archiveBaseName.set("spring-framework") | 
					
						
							|  |  |  | 	archiveClassifier.set("dist") | 
					
						
							|  |  |  | 	description = "Builds -${archiveClassifier} archive, containing all jars and docs, " + | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 			"suitable for community download page." | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-02 16:00:33 +08:00
										 |  |  | 	ext.baseDir = "spring-framework-${project.version}"; | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	from("src/docs/dist") { | 
					
						
							|  |  |  | 		include "readme.txt" | 
					
						
							|  |  |  | 		include "license.txt" | 
					
						
							|  |  |  | 		include "notice.txt" | 
					
						
							|  |  |  | 		into "${baseDir}" | 
					
						
							|  |  |  | 		expand(copyright: new Date().format("yyyy"), version: project.version) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-13 15:36:07 +08:00
										 |  |  | 	from(zipTree(docsZip.archiveFile)) { | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 		into "${baseDir}/docs" | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-13 15:36:07 +08:00
										 |  |  | 	from(zipTree(schemaZip.archiveFile)) { | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 		into "${baseDir}/schema" | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-28 16:43:26 +08:00
										 |  |  | 	moduleProjects.each { module -> | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 		into ("${baseDir}/libs") { | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | 			from module.jar | 
					
						
							|  |  |  | 			if (module.tasks.findByPath("sourcesJar")) { | 
					
						
							|  |  |  | 				from module.sourcesJar | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-08-21 02:26:43 +08:00
										 |  |  | 			if (module.tasks.findByPath("javadocJar")) { | 
					
						
							|  |  |  | 				from module.javadocJar | 
					
						
							| 
									
										
										
										
											2017-01-05 00:51:58 +08:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-28 16:43:26 +08:00
										 |  |  | distZip.mustRunAfter moduleProjects.check | 
					
						
							| 
									
										
										
										
											2022-11-02 17:48:38 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | publishing { | 
					
						
							|  |  |  | 	publications { | 
					
						
							|  |  |  | 		mavenJava(MavenPublication) { | 
					
						
							|  |  |  | 			artifact docsZip | 
					
						
							|  |  |  | 			artifact schemaZip | 
					
						
							|  |  |  | 			artifact distZip | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2023-05-23 22:04:09 +08:00
										 |  |  | } |