Generate -docs, -schema and -dist zips
- Add 'api' gradle task to generate project-wide API Javadoc results in <root>/build/api - Add docsZip task including api and reference documentation suitable for publication to http://static.springframework.org/docs/spring-framework - Add schemaZip task including all spring-* XSD files suitable for publication to http://static.springframework.org/schema - Add distZip task to include all libs, docs and schema - filter src/dist/*.txt for ${copyright} and ${version} - copy legal (notice, license) dynamically into individual jar files - copy legal and readme files into root of distribution zip - Refactor location of 'wrapper' task Each of the zip tasks (docsZip, schemaZip, distZip) have been added to the 'archives' configuration, meaning that (a) they will be built automatically with `gradle build` and (b) will be published automatically to artifactory when using the Artifactory Gradle plugin and/or Artifactory Bamboo integration.
This commit is contained in:
168
build.gradle
168
build.gradle
@@ -41,26 +41,6 @@ configure(allprojects) {
|
||||
}
|
||||
}
|
||||
|
||||
configure(rootProject) {
|
||||
description = 'Spring Framework'
|
||||
|
||||
apply plugin: 'docbook-reference'
|
||||
|
||||
reference {
|
||||
sourceDir = file('src/reference/docbook')
|
||||
}
|
||||
|
||||
// don't publish the default jar for the root project
|
||||
configurations.archives.artifacts.clear()
|
||||
|
||||
dependencies { // for integration tests
|
||||
testCompile project(":spring-test")
|
||||
testCompile project(":spring-webmvc-portlet")
|
||||
testCompile "org.hibernate:hibernate-core:4.0.0.CR7"
|
||||
testCompile "javax.servlet:servlet-api:2.5"
|
||||
}
|
||||
}
|
||||
|
||||
configure(subprojects) {
|
||||
apply plugin: 'maven'
|
||||
group = 'org.springframework'
|
||||
@@ -403,26 +383,140 @@ project('spring-aspects') {
|
||||
}
|
||||
}
|
||||
|
||||
task apidocs(type: Javadoc) {
|
||||
subprojects.each { project ->
|
||||
source project.sourceSets.main.allJava
|
||||
configure(rootProject) {
|
||||
description = 'Spring Framework'
|
||||
|
||||
apply plugin: 'docbook-reference'
|
||||
|
||||
reference {
|
||||
sourceDir = file('src/reference/docbook')
|
||||
}
|
||||
subprojects.each { subproject ->
|
||||
if(classpath) {
|
||||
classpath += subproject.sourceSets.main.classes + subproject.sourceSets.main.compileClasspath
|
||||
|
||||
// don't publish the default jar for the root project
|
||||
configurations.archives.artifacts.clear()
|
||||
|
||||
dependencies { // for integration tests
|
||||
testCompile project(":spring-test")
|
||||
testCompile project(":spring-webmvc-portlet")
|
||||
testCompile "org.hibernate:hibernate-core:4.0.0.CR7"
|
||||
testCompile "javax.servlet:servlet-api:2.5"
|
||||
}
|
||||
|
||||
task api(type: Javadoc) {
|
||||
group = 'Documentation'
|
||||
description = 'Generates aggregated Javadoc API documentation.'
|
||||
title = "${rootProject.description} ${version} API"
|
||||
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
|
||||
options.author = true
|
||||
options.header = rootProject.description
|
||||
options.overview = 'src/api/overview.html'
|
||||
options.links(
|
||||
'http://docs.jboss.org/jbossas/javadoc/4.0.5/connector'
|
||||
)
|
||||
source subprojects.collect { project ->
|
||||
project.sourceSets.main.allJava
|
||||
}
|
||||
else {
|
||||
classpath = subproject.sourceSets.main.classes + subproject.sourceSets.main.compileClasspath
|
||||
destinationDir = new File(buildDir, "api")
|
||||
classpath = files(subprojects.collect { project ->
|
||||
project.sourceSets.main.compileClasspath
|
||||
})
|
||||
maxMemory = '1024m'
|
||||
}
|
||||
|
||||
task docsZip(type: Zip) {
|
||||
group = 'Distribution'
|
||||
classifier = 'docs'
|
||||
description = "Builds -${classifier} archive containing api and reference " +
|
||||
"for deployment at static.springframework.org/spring-framework/docs."
|
||||
|
||||
from('src/dist') {
|
||||
include 'changelog.txt'
|
||||
}
|
||||
|
||||
from (api) {
|
||||
into 'api'
|
||||
}
|
||||
|
||||
from (reference) {
|
||||
into 'reference'
|
||||
}
|
||||
}
|
||||
destinationDir = file('build/docs/javadoc')
|
||||
maxMemory = '1024m'
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
description = 'Generates gradlew[.bat] scripts'
|
||||
gradleVersion = '1.0-milestone-8'
|
||||
distributionUrl = 'http://repo.gradle.org/gradle/distributions-snapshots/gradle-1.0-milestone-8-20120112000036+0100-bin.zip'
|
||||
jarFile = '.wrapper/gradle-wrapper.jar'
|
||||
|
||||
task schemaZip(type: Zip) {
|
||||
group = 'Distribution'
|
||||
classifier = 'schema'
|
||||
description = "Builds -${classifier} archive containing all " +
|
||||
"XSDs for deployment at static.springframework.org/schema."
|
||||
|
||||
subprojects.each { subproject ->
|
||||
def Properties schemas = new Properties();
|
||||
|
||||
subproject.sourceSets.main.resources.find {
|
||||
it.path.endsWith('META-INF/spring.schemas')
|
||||
}?.withInputStream { schemas.load(it) }
|
||||
|
||||
for (def key : schemas.keySet()) {
|
||||
def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
|
||||
assert shortName != key
|
||||
File xsdFile = subproject.sourceSets.main.resources.find {
|
||||
it.path.endsWith(schemas.get(key))
|
||||
}
|
||||
assert xsdFile != null
|
||||
into (shortName) {
|
||||
from xsdFile.path
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
|
||||
group = 'Distribution'
|
||||
classifier = 'dist'
|
||||
description = "Builds -${classifier} archive, containing all jars and docs, " +
|
||||
"suitable for community download page."
|
||||
|
||||
baseDir = "${project.name}-${project.version}";
|
||||
|
||||
from('src/dist') {
|
||||
include 'readme.txt'
|
||||
include 'license.txt'
|
||||
include 'notice.txt'
|
||||
into "${baseDir}"
|
||||
expand(copyright: new Date().format('yyyy'), version: project.version)
|
||||
}
|
||||
|
||||
from(zipTree(docsZip.archivePath)) {
|
||||
into "${baseDir}/docs"
|
||||
}
|
||||
|
||||
from(zipTree(schemaZip.archivePath)) {
|
||||
into "${baseDir}/schema"
|
||||
}
|
||||
|
||||
subprojects.each { subproject ->
|
||||
into ("${baseDir}/libs") {
|
||||
from subproject.jar
|
||||
if (subproject.tasks.findByPath('sourcesJar')) {
|
||||
from subproject.sourcesJar
|
||||
}
|
||||
if (subproject.tasks.findByPath('javadocJar')) {
|
||||
from subproject.javadocJar
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives docsZip
|
||||
archives schemaZip
|
||||
archives distZip
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
description = 'Generates gradlew[.bat] scripts'
|
||||
gradleVersion = '1.0-milestone-8'
|
||||
distributionUrl = 'http://repo.gradle.org/gradle/distributions-snapshots/gradle-1.0-milestone-8-20120112000036+0100-bin.zip'
|
||||
jarFile = '.wrapper/gradle-wrapper.jar'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
5
src/api/overview.html
Normal file
5
src/api/overview.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This is the public API documentation for the <a href="http://github.com/SpringSource/spring-framework" target="_top">Spring Framework</a>.
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user