Permalink
Fetching contributors…
Cannot retrieve contributors at this time
360 lines (302 sloc) 9.4 KB
buildscript {
repositories {
maven { url "https://repo.spring.io/plugins-release" }
}
dependencies {
classpath("io.spring.gradle:propdeps-plugin:0.0.9.RELEASE")
classpath("io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE")
classpath("io.spring.gradle:spring-io-plugin:0.0.8.RELEASE")
classpath("io.spring.gradle:docbook-reference-plugin:0.3.1")
}
}
configure(allprojects) {
group = "org.springframework.mobile"
if (!project.hasProperty("springVersion")) {
ext.springVersion = "5.0.2.RELEASE"
}
if (!project.hasProperty("springBootVersion")) {
ext.springBootVersion = "2.0.0.M6"
}
ext.servletVersion = "4.0.0"
ext.jsr305Version = "3.0.2"
ext.junitVersion = "4.12"
ext.assertjVersion = "3.8.0"
ext.easymockVersion = "3.4"
ext.hamcrestVersion = "1.3"
apply plugin: "propdeps"
apply plugin: "propdeps-eclipse"
apply plugin: "propdeps-idea"
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "io.spring.dependency-management"
if (project.hasProperty("springVersion") || project.hasProperty("springBootVersion")) {
repositories {
maven { url "https://repo.spring.io/libs-snapshot" }
}
}
if (project.hasProperty('platformVersion')) {
apply plugin: 'spring-io'
repositories {
maven { url "https://repo.spring.io/libs-snapshot" }
}
dependencyManagement {
springIoTestRuntime {
imports {
mavenBom "io.spring.platform:platform-bom:${platformVersion}"
}
}
}
}
compileJava {
sourceCompatibility=1.8
targetCompatibility=1.8
options.encoding = "UTF-8"
}
compileTestJava {
sourceCompatibility=1.8
targetCompatibility=1.8
options.encoding = "UTF-8"
}
[compileJava, compileTestJava]*.options*.compilerArgs = [
"-Xlint:serial",
"-Xlint:varargs",
"-Xlint:cast",
"-Xlint:classfile",
"-Xlint:dep-ann",
"-Xlint:divzero",
"-Xlint:empty",
"-Xlint:finally",
"-Xlint:overrides",
"-Xlint:path",
"-Xlint:processing",
"-Xlint:static",
"-Xlint:try",
"-Xlint:fallthrough",
"-Xlint:rawtypes",
"-Xlint:deprecation",
"-Xlint:unchecked",
"-Xlint:-options",
"-Werror"
]
sourceSets.test.resources.srcDirs = [
"src/test/resources",
"src/test/java"
]
tasks.withType(Test).all {
systemProperty("java.awt.headless", "true")
}
repositories {
maven { url "https://repo.spring.io/libs-milestone" }
}
dependencies {
testCompile("org.springframework:spring-test") {
exclude group:"commons-logging", module:"commons-logging"
}
testCompile("junit:junit:${junitVersion}") {
exclude group:"org.hamcrest", module:"hamcrest-core"
}
testCompile("org.assertj:assertj-core:${assertjVersion}")
testCompile("org.hamcrest:hamcrest-library:${hamcrestVersion}")
testCompile("org.easymock:easymock:${easymockVersion}")
}
ext.javadocLinks = [
"http://docs.oracle.com/javase/8/docs/api/",
"http://docs.oracle.com/javaee/7/api/",
"http://docs.spring.io/spring/docs/${springVersion}/javadoc-api/",
"http://docs.jboss.org/jbossas/javadoc/4.0.5/connector/"
] as String[]
// servlet-api (2.5) and tomcat-servlet-api (3.0) classpath entries should not be
// exported to dependent projects in Eclipse to avoid false compilation errors due
// to changing APIs across these versions
eclipse.classpath.file.whenMerged { classpath ->
classpath.entries.findAll { entry -> entry.path.contains("servlet-api") }*.exported = false
}
}
configure(subprojects.findAll {it.name != 'spring-mobile-starter'}) { subproject ->
apply from: "${rootProject.projectDir}/publish-maven.gradle"
jar {
manifest.attributes["Created-By"] =
"${System.getProperty("java.version")} (${System.getProperty("java.specification.vendor")})"
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)
}
}
javadoc {
description = "Generates project-level javadoc for use in -javadoc jar"
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = project.name
options.links(project.ext.javadocLinks)
if (JavaVersion.current().isJava8Compatible()) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = "sources"
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
classifier = "javadoc"
from javadoc
}
artifacts {
archives sourcesJar
archives javadocJar
}
}
project("spring-mobile-device") {
description = "Spring Mobile Device Resolution Support"
dependencyManagement {
imports {
mavenBom "org.springframework:spring-framework-bom:${springVersion}"
}
}
dependencies {
compile("org.springframework:spring-web")
compile("org.springframework:spring-webmvc")
provided("javax.servlet:javax.servlet-api:${servletVersion}")
// JSR-305 only used for non-required meta-annotations
compileOnly("com.google.code.findbugs:jsr305:${jsr305Version}")
testCompileOnly("com.google.code.findbugs:jsr305:${jsr305Version}")
}
}
project("spring-mobile-autoconfigure") {
description = "Spring Boot Auto-Configuration for Spring Mobile"
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
}
}
dependencies {
compile project(":spring-mobile-device")
compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework.boot:spring-boot-starter-web")
optional("org.springframework.boot:spring-boot-starter-thymeleaf")
optional("org.springframework.boot:spring-boot-starter-freemarker")
optional("org.springframework.boot:spring-boot-starter-groovy-templates")
optional("org.springframework.boot:spring-boot-starter-mustache")
testCompile("org.springframework.boot:spring-boot-starter-test")
// JSR-305 only used for non-required meta-annotations
compileOnly("com.google.code.findbugs:jsr305:${jsr305Version}")
testCompileOnly("com.google.code.findbugs:jsr305:${jsr305Version}")
}
}
project("spring-mobile-starter") {
description = "Starter for building web applications using Spring Mobile"
apply from: "${rootProject.projectDir}/publish-maven.gradle"
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
}
}
dependencies {
compile project(":spring-mobile-autoconfigure")
compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework.boot:spring-boot-starter-web")
}
install {
repositories.mavenInstaller {
pom.whenConfigured { generatedPom ->
generatedPom.name = "Spring Boot Mobile Starter"
generatedPom.packaging = "pom"
}
}
}
}
configure(rootProject) {
description = "Spring Mobile"
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
}
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(project.ext.javadocLinks)
if (JavaVersion.current().isJava8Compatible()) {
options.addStringOption('Xdoclint:none', '-quiet')
}
source subprojects.collect { project ->
project.sourceSets.main.allJava
}
classpath = files(subprojects.collect { project ->
project.sourceSets.main.compileClasspath
})
maxMemory = "1024m"
destinationDir = new File(buildDir, "api")
}
task docsZip(type: Zip) {
group = "Distribution"
classifier = "docs"
description = "Builds -${classifier} archive containing api and reference " +
"for deployment at docs.spring.io/spring-mobile/docs."
from("src/dist") { include "changelog.txt" }
from (api) { into "api" }
from (reference) { into "reference" }
}
task distZip(type: Zip, dependsOn: docsZip) {
group = "Distribution"
classifier = "dist"
description = "Builds -${classifier} archive, containing all jars and docs, " +
"suitable for community download page."
def 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" }
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 distZip
}
}
task updateRootDocs {
copy {
from "src/dist"
into "${rootProject.projectDir}"
include "notice.txt"
expand(copyright: new Date().format("yyyy"), version: project.version)
rename { filename -> "NOTICE" }
}
copy {
from "src/dist"
into "${rootProject.projectDir}"
include "license.txt"
rename { filename -> "LICENSE" }
}
}
build.doLast() {
updateRootDocs
}
task wrapper(type: Wrapper) {
gradleVersion = "4.3.1"
}