Uses the new Java toolchain feature of Gradle to acquire Java 17. Doing it this way means that you can start ./gradlew under any version of Java and still use Java 17 for the build; it picks a candidate from the environment or downloads one if required. It also takes care of source and target compatibility, with the exception of ide.gradle which is handled separately.
382 lines
9.5 KiB
Groovy
382 lines
9.5 KiB
Groovy
buildscript {
|
|
repositories {
|
|
maven { url "https://repo.spring.io/plugins-release" }
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id 'io.spring.dependency-management' version '1.0.9.RELEASE' apply false
|
|
id 'org.asciidoctor.jvm.pdf' version '3.3.2'
|
|
id 'org.asciidoctor.jvm.gems' version '3.3.2'
|
|
id 'org.asciidoctor.jvm.convert' version '3.3.2'
|
|
id 'de.undercouch.download' version '4.1.2'
|
|
}
|
|
|
|
ext {
|
|
moduleProjects = subprojects.findAll { it.name.startsWith("spring-") }
|
|
javaProjects = subprojects - project("spring-js-resources")
|
|
withoutJclOverSlf4j = {
|
|
exclude group: "org.slf4j", name: "jcl-over-slf4j"
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
group = "org.springframework.webflow"
|
|
|
|
apply plugin: "java"
|
|
apply plugin: "io.spring.dependency-management"
|
|
apply plugin: "org.springframework.build.optional-dependencies"
|
|
apply from: "${rootProject.projectDir}/ide.gradle"
|
|
|
|
dependencyManagement {
|
|
imports {
|
|
mavenBom "org.springframework:spring-framework-bom:5.3.3"
|
|
mavenBom "org.springframework.security:spring-security-bom:5.4.4"
|
|
mavenBom "org.junit:junit-bom:5.7.1"
|
|
}
|
|
dependencies {
|
|
dependency "javax.servlet:javax.servlet-api:4.0.1"
|
|
dependency "javax.servlet:jstl:1.2"
|
|
dependency "javax.servlet.jsp:javax.servlet.jsp-api:2.3.2-b02"
|
|
dependency "javax.el:javax.el-api:3.0.1-b06"
|
|
dependency "javax.validation:validation-api:2.0.1.Final"
|
|
dependencySet(group: 'org.hibernate', version: '5.4.27.Final') {
|
|
entry 'hibernate-core'
|
|
entry 'hibernate-entitymanager'
|
|
}
|
|
dependency "org.hibernate:hibernate-validator:6.2.0.Final"
|
|
dependencySet(group: 'com.sun.faces', version: '2.2.20') {
|
|
entry 'jsf-api'
|
|
entry 'jsf-impl'
|
|
}
|
|
dependencySet(group: 'org.apache.tiles', version: '3.0.8') {
|
|
entry 'tiles-api'
|
|
entry('tiles-core', withoutJclOverSlf4j)
|
|
entry('tiles-servlet', withoutJclOverSlf4j)
|
|
entry('tiles-jsp', withoutJclOverSlf4j)
|
|
entry('tiles-el', withoutJclOverSlf4j)
|
|
entry('tiles-extras') {
|
|
exclude group: "org.springframework", name: "spring-web"
|
|
}
|
|
}
|
|
dependency "org.apache.myfaces.core:myfaces-impl:2.2.14"
|
|
dependency "com.sun.facelets:jsf-facelets:1.1.14"
|
|
dependency "org.hsqldb:hsqldb:2.5.0"
|
|
|
|
dependencySet(group: 'org.apache.logging.log4j', version: '2.14.0') {
|
|
entry 'log4j-api'
|
|
entry 'log4j-core'
|
|
entry 'log4j-slf4j-impl'
|
|
entry 'log4j-jul'
|
|
}
|
|
dependency "org.slf4j:slf4j-api:1.7.30"
|
|
|
|
dependency("junit:junit:4.13.2")
|
|
dependency "org.easymock:easymock:4.2"
|
|
dependency "org.hamcrest:hamcrest:2.1"
|
|
dependency "org.apache.tomcat:tomcat-jasper-el:9.0.34"
|
|
dependency "org.apache.myfaces.test:myfaces-test22:1.0.8"
|
|
}
|
|
generatedPomCustomization {
|
|
enabled = false
|
|
}
|
|
resolutionStrategy {
|
|
cacheChangingModulesFor 0, "seconds"
|
|
}
|
|
}
|
|
repositories {
|
|
mavenCentral()
|
|
if (version.endsWith('SNAPSHOT')) {
|
|
maven { url "https://repo.spring.io/snapshot" }
|
|
}
|
|
}
|
|
configurations.all {
|
|
resolutionStrategy {
|
|
cacheChangingModulesFor 0, "seconds"
|
|
cacheDynamicVersionsFor 0, "seconds"
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
configure(javaProjects) { javaProject ->
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
include(["**/*Tests.class", "**/*Test.class"])
|
|
systemProperty("java.awt.headless", "true")
|
|
systemProperty("testGroups", project.properties.get("testGroups"))
|
|
}
|
|
|
|
javadoc {
|
|
options.memberLevel = JavadocMemberLevel.PROTECTED
|
|
options.author = true
|
|
options.header = project.name
|
|
}
|
|
|
|
task sourcesJar(type: Jar, dependsOn:classes) {
|
|
archiveClassifier = "sources"
|
|
from sourceSets.main.allJava
|
|
}
|
|
|
|
task javadocJar(type: Jar) {
|
|
archiveClassifier = "javadoc"
|
|
from javadoc
|
|
}
|
|
|
|
artifacts {
|
|
archives sourcesJar
|
|
archives javadocJar
|
|
}
|
|
}
|
|
|
|
subprojects { subproject ->
|
|
|
|
apply from: "${rootProject.projectDir}/publish-maven.gradle"
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(17)
|
|
}
|
|
}
|
|
|
|
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:none"]
|
|
|
|
sourceSets.test.resources.srcDirs = ["src/main/java", "src/test/resources", "src/test/java"]
|
|
|
|
jar {
|
|
manifest.attributes["Implementation-Title"] = subproject.name
|
|
manifest.attributes["Implementation-Version"] = subproject.version
|
|
|
|
from("${rootProject.projectDir}/src/dist") {
|
|
include "license.txt"
|
|
include "notice.txt"
|
|
into "META-INF"
|
|
expand(copyright: new Date().format("yyyy"), version: project.version)
|
|
}
|
|
}
|
|
}
|
|
|
|
configure(rootProject) {
|
|
description = "Spring Web Flow"
|
|
|
|
repositories {
|
|
maven { url "https://repo.spring.io/plugins-release" }
|
|
}
|
|
|
|
task downloadResources(type: Download) {
|
|
def version = "0.2.5"
|
|
src "https://repo.spring.io/release/io/spring/docresources/" +
|
|
"spring-doc-resources/$version/spring-doc-resources-${version}.zip"
|
|
dest project.file("$buildDir/docs/spring-doc-resources.zip")
|
|
onlyIfModified true
|
|
useETag "all"
|
|
}
|
|
|
|
task extractDocResources(type: Copy, dependsOn: downloadResources) {
|
|
dependsOn downloadResources
|
|
from project.zipTree(downloadResources.dest);
|
|
into "$buildDir/asciidoc/build/"
|
|
}
|
|
|
|
task prepareAsciidocBuild(type: Sync) {
|
|
dependsOn extractDocResources
|
|
// copy doc sources
|
|
from "src/reference/"
|
|
// to a build directory of your choice
|
|
into "$buildDir/asciidoc/build"
|
|
}
|
|
|
|
asciidoctorPdf {
|
|
dependsOn prepareAsciidocBuild
|
|
baseDirFollowsSourceFile()
|
|
|
|
asciidoctorj {
|
|
sourceDir "$buildDir/asciidoc/build"
|
|
inputs.dir(sourceDir)
|
|
sources {
|
|
include 'index.adoc'
|
|
}
|
|
options doctype: 'book'
|
|
attributes 'icons': 'font',
|
|
'sectanchors': '',
|
|
'sectnums': '',
|
|
'toc': '',
|
|
'source-highlighter' : 'coderay',
|
|
revnumber: project.version,
|
|
'project-version': project.version
|
|
}
|
|
}
|
|
|
|
asciidoctor {
|
|
dependsOn asciidoctorPdf
|
|
|
|
baseDirFollowsSourceFile()
|
|
|
|
sourceDir "$buildDir/asciidoc/build"
|
|
inputs.dir(sourceDir)
|
|
resources {
|
|
from(sourceDir) {
|
|
include 'images/*', 'css/**', 'js/**'
|
|
}
|
|
}
|
|
options doctype: 'book'
|
|
|
|
attributes 'docinfo': 'shared',
|
|
stylesdir: 'css/',
|
|
stylesheet: 'spring.css',
|
|
'linkcss': true,
|
|
'icons': 'font',
|
|
'sectanchors': '',
|
|
'source-highlighter': 'highlight.js',
|
|
'highlightjsdir': 'js/highlight',
|
|
'highlightjs-theme': 'github',
|
|
'idprefix': '',
|
|
'idseparator': '-',
|
|
'spring-version': project.version,
|
|
'allow-uri-read': '',
|
|
'toc': 'left',
|
|
'toclevels': '4',
|
|
revnumber: project.version,
|
|
'project-version': project.version
|
|
}
|
|
|
|
|
|
// don't publish the default jar for the root project
|
|
configurations.archives.artifacts.clear()
|
|
|
|
artifacts {
|
|
}
|
|
|
|
task api(type: Javadoc) {
|
|
group = "Documentation"
|
|
description = "Generates aggregated Javadoc API documentation."
|
|
title = "${rootProject.description} ${version} API"
|
|
options.memberLevel = JavadocMemberLevel.PROTECTED
|
|
options.author = true
|
|
options.header = rootProject.description
|
|
options.overview = "src/api/overview.html"
|
|
source subprojects.collect { project ->
|
|
project.sourceSets.main.allJava
|
|
}
|
|
destinationDir = new File(buildDir, "api")
|
|
classpath = files(subprojects.collect { project ->
|
|
project.sourceSets.main.compileClasspath
|
|
})
|
|
maxMemory = "1024m"
|
|
}
|
|
|
|
task docsZip(type: Zip) {
|
|
group = "Distribution"
|
|
archiveBaseName = "spring-webflow"
|
|
archiveClassifier = "docs"
|
|
description = "Builds -${archiveClassifier.get()} archive containing api and reference " +
|
|
"for deployment at static.springframework.org/spring-webflow/docs."
|
|
|
|
from (api) {
|
|
into "api"
|
|
}
|
|
|
|
from (asciidoctor) {
|
|
include "*.html"
|
|
include "css/**"
|
|
include "js/**"
|
|
include "images/**"
|
|
into "reference"
|
|
}
|
|
|
|
from (asciidoctorPdf) {
|
|
include "*.pdf"
|
|
into "reference"
|
|
}
|
|
}
|
|
|
|
task schemaZip(type: Zip) {
|
|
group = "Distribution"
|
|
archiveBaseName = "spring-webflow"
|
|
archiveClassifier = "schema"
|
|
description = "Builds -${archiveClassifier.get()} archive containing all " +
|
|
"XSDs for deployment at static.springframework.org/schema."
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
|
|
subprojects.each { subproject ->
|
|
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.allSource.find {
|
|
it.path.endsWith(schemas.get(key))
|
|
} as File
|
|
assert xsdFile != null
|
|
into (shortName) {
|
|
from xsdFile.path
|
|
}
|
|
}
|
|
}
|
|
|
|
project(":spring-webflow").sourceSets.main.resources.matching {
|
|
include '**/engine/model/builder/xml/*.xsd'
|
|
}.each { File file ->
|
|
into ('webflow') {
|
|
from file.path
|
|
}
|
|
}
|
|
}
|
|
|
|
task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
|
|
group = "Distribution"
|
|
archiveBaseName = "spring-webflow"
|
|
archiveClassifier = "dist"
|
|
description = "Builds -${archiveClassifier.get()} archive, containing all jars and docs, " +
|
|
"suitable for community download page."
|
|
|
|
def baseDir = "${archiveBaseName.get()}-${project.version}"
|
|
|
|
from("src/dist") {
|
|
include "notice.txt"
|
|
into "${baseDir}"
|
|
expand(copyright: new Date().format("yyyy"), version: project.version)
|
|
}
|
|
|
|
from("src/dist") {
|
|
include "readme.txt"
|
|
include "license.txt"
|
|
into "${baseDir}"
|
|
expand(version: project.version)
|
|
}
|
|
|
|
from(zipTree(docsZip.archiveFile)) {
|
|
into "${baseDir}/docs"
|
|
}
|
|
|
|
from(zipTree(schemaZip.archiveFile)) {
|
|
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
|
|
}
|
|
}
|