blob: 58763c659700f691e4bd608cc768d57fbb7efe69 [file] [log] [blame]
description = "Apache Tapestry 5 Project"
apply plugin: "base"
apply from: "ssh.gradle"
apply from: "md5.gradle"
// Remember that when generating a release, this should be incremented. Also don"t forget to
// tag the release in Subversion.
tapestryVersion = "5.3.2"
jettyVersion = "7.0.0.v20091005"
tomcatVersion = "6.0.30"
testngVersion = "5.14.9"
easymockVersion = "3.0"
servletAPIVersion = "2.5"
// Provided so that the CI server can override the normal version number for nightly builds.
version = System.getProperty("project-version", tapestryVersion)
stagingUrl = "https://repository.apache.org/service/local/staging/deploy/maven2/"
snapshotUrl = "https://repository.apache.org/content/repositories/snapshots"
doSign = !project.hasProperty("noSign") && project.hasProperty("signing.keyId")
// apacheDeployUserName and apacheDeployPassword should be specified in ~/.gradle/gradle.properties
deployUsernameProperty = isSnapshot() ? "snapshotDeployUserName" : "apacheDeployUserName"
deployPasswordProperty = isSnapshot() ? "snapshotDeployPassword" : "apacheDeployPassword"
canDeploy = [deployUsernameProperty, deployPasswordProperty].every { project.hasProperty(it) }
deployUsername = { getProperty(deployUsernameProperty) }
deployPassword = { getProperty(deployPasswordProperty) }
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
repositories {
mavenCentral()
// All things JBoss/Hibernate
mavenRepo name: "JBoss", url: "https://repository.jboss.org/nexus/content/repositories/releases/"
}
idea {
project {
// Technically, Tapestry is built for JDK 1.5, but we're all using Eclipse or IntelliJ with
// JDK 1.6 at this point.
jdkName = "1.6"
}
}
configurations {
// Non-code artifacts, such as sources JARs and zipped JavaDocs
meta
}
}
// Specific to top-level build, not set for subprojects:
configurations {
javadoc
published.extendsFrom archives, meta
if (doSign) {
published.extendsFrom signatures
}
}
dependencies {
javadoc project(":tapestry-javadoc")
}
subprojects {
version = parent.version
group = "org.apache.tapestry"
configurations {
provided
deployerJars
}
apply plugin: "java"
apply plugin: "groovy" // mostly for testing
apply plugin: "maven"
apply plugin: "project-report"
sourceCompatibility = "1.5"
targetCompatibility = "1.5"
// See http://jira.codehaus.org/browse/GRADLE-784
sourceSets {
main {
compileClasspath += configurations.provided
}
test {
compileClasspath += configurations.provided
runtimeClasspath += configurations.provided
}
}
idea.module {
scopes.PROVIDED.plus += configurations.provided
}
dependencies {
groovy "org.codehaus.groovy:groovy-all:1.7.4"
deployerJars "org.apache.maven.wagon:wagon-http-lightweight:1.0-beta-6"
}
test {
useTestNG()
options.suites("src/test/conf/testng.xml")
maxHeapSize "400M"
// Turn off live service reloading
systemProperties["tapestry.service-reloading-enabled"] = "false"
jvmArgs("-XX:MaxPermSize=512m", "-Dfile.encoding=UTF-8")
}
task sourcesJar(type: Jar) {
dependsOn classes
classifier "sources"
from sourceSets.main.allSource
}
artifacts {
meta sourcesJar
}
configurations {
// published -- what gets uploaded to the Nexus repository
published.extendsFrom archives, meta
if (rootProject.doSign) {
published.extendsFrom signatures
}
}
if (rootProject.doSign) {
apply plugin: "signing"
// sign (create PGP signature for) archives (standard JARs)
// and meta (sources JARs)
signing { sign configurations.archives, configurations.meta }
}
uploadPublished {
doFirst {
if (!canDeploy) {
throw new InvalidUserDataException("Missing upload credentials. Set '$deployUsernameProperty' and '$deployPasswordProperty' root project properties.")
}
}
if (canDeploy) {
repositories {
project.deployer = repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signPom(deployment) }
repository(url: stagingUrl) {
authentication(userName: deployUsername(), password: deployPassword())
}
snapshotRepository(url: snapshotUrl) {
authentication(userName: deployUsername(), password: deployPassword())
}
}
}
}
}
}
subprojects.each { project.evaluationDependsOn(it.name) }
// Cribbed from https://github.com/hibernate/hibernate-core/blob/master/release/release.gradle#L19
task aggregateJavadoc(type: Javadoc) {
dependsOn configurations.javadoc
group "Documentation"
description "Build the aggregated JavaDocs for all modules"
maxMemory "512m"
destinationDir file("$buildDirName/documentation/javadocs")
configure(options) {
splitIndex true
linkSource true
stylesheetFile file("src/javadoc/stylesheet.css")
windowTitle "Tapestry API Documentation"
docTitle "Tapestry JavaDoc ($project.version)"
bottom 'Copyright &copy; 2003-2012 <a href="http://tapestry.apache.org">The Apache Software Foundation</a>.'
use = true // 'use' seems to be a reserved word for the DSL
links "http://download.oracle.com/javase/6/docs/api/"
links "http://download.oracle.com/javaee/6/api/"
addStringOption "tagletpath", configurations.javadoc.asPath
addStringOption "taglet", "org.apache.tapestry5.javadoc.TapestryDocTaglet"
exclude "org/apache/tapestry5/internal/plastic/asm/**"
}
def allMainSourceSets = subprojects*.sourceSets*.main.flatten()
def allMainJavaFiles = allMainSourceSets*.java
def allMainJavaSrcDirs = allMainJavaFiles*.srcDirs
source allMainJavaFiles
classpath += files(allMainSourceSets*.compileClasspath)
inputs.files allMainJavaSrcDirs
// As part of generating the documentation, ALSO copy any related files:
// Any extra images (Tapestry logo)
// Any images stored under src/main/java ... everything exclude .java, .xdoc and package.html
doLast {
copy {
from allMainJavaSrcDirs
into aggregateJavadoc.destinationDir
exclude "**/*.java"
exclude "**/*.xdoc"
exclude "**/package.html"
}
copy {
from file("src/javadoc/images")
into aggregateJavadoc.destinationDir
}
}
}
dependencies {
meta aggregateJavadoc.outputs.files
}
task continuousIntegration {
dependsOn subprojects.build, aggregateJavadoc, subprojects.uploadPublished
description "Task executed on Jenkins CI server after SVN commits"
}
task wrapper(type: Wrapper) {
description "Regenerates the Gradle Wrapper files"
}
task zippedSources(type: Zip) {
description "Creates a combined Zip file of all sub-project's sources"
group "Release artifact"
destinationDir buildDir
baseName "apache-tapestry"
version project.version
classifier "sources"
from project.projectDir
exclude "out/**"
exclude "**/*.iml"
exclude "**/*.ipr"
exclude "**/*.iws"
exclude "**/.*/**"
exclude "**/bin/**"
exclude "**/target/**"
exclude "**/build/**"
exclude "**/test-output/**" // Left around by TestNG sometimes
}
task zippedJavadoc(type: Zip) {
dependsOn aggregateJavadoc
description "Zip archive of the project's aggregate JavaDoc"
group "Release artifact"
destinationDir buildDir
baseName "apache-tapestry"
version project.version
classifier "javadocs"
from aggregateJavadoc.outputs.files
into "apidocs"
}
task generateMD5Checksums(type: GenMD5) {
group "Release artifact"
description "Creates MD5 checksums for zippedJavadoc and zippedSources"
source zippedJavadoc, zippedSources
outputDir "$buildDir/md5"
}
task uploadSourcesAndJavadocs(type: Scp) {
group "Release artifact"
description "Uploads source and JavaDoc Zips and MD5 checksums to people.apache.org"
source files(generateMD5Checksums, generateMD5Checksums.inputs.files)
host "people.apache.org"
userName deployUsername()
password deployPassword()
// The destination folder needs to already exist.
destination "public_html/tapestry-releases"
verbose true
}
boolean isSnapshot() {
project.version.contains("SNAPSHOT")
}
task generateRelease {
dependsOn "quickstart:clean", continuousIntegration, subprojects.uploadPublished, uploadSourcesAndJavadocs
group "Release artifact"
description "Generates and uploads a final release to Apache Nexus"
}