+ breakdown the scripts

This commit is contained in:
Costin Leau
2011-04-21 14:51:20 +03:00
parent 5e6404bd42
commit ae2b02b5e6
7 changed files with 257 additions and 65 deletions

View File

@@ -1,30 +1,42 @@
import org.springframework.build.Version
// used for artifact names, building doc upload urls, etc.
description = 'Spring Data Key Value'
abbreviation = 'DATAKV'
apply plugin: 'base'
apply plugin: 'eclipse'
apply plugin: 'idea'
def buildSrcDir = "$rootDir/buildSrc"
apply from: "$buildSrcDir/wrapper.gradle"
apply from: "$buildSrcDir/maven-root-pom.gradle"
buildscript {
repositories {
add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) {
name = "local"
addIvyPattern "e:/work/i21/gradle-plugins/build/repo/[organisation].[module]-ivy-[revision].xml"
addArtifactPattern "e:/work/i21/gradle-plugins/build/repo/[organisation].[module]-[revision](-[classifier]).[ext]"
}
// add(new org.apache.ivy.plugins.resolver.URLResolver()) {
// name = "GitHub"
// addIvyPattern 'http://cloud.github.com/downloads/costin/gradle-stuff/[organization].[module]-[artifact]-[revision].[ext]'
// addArtifactPattern 'http://cloud.github.com/downloads/costin/gradle-stuff/[organization].[module]-[revision].[ext]'
// }
mavenCentral()
mavenRepo name: "springsource-org-release", urls: "http://repository.springsource.com/maven/bundles/release"
mavenRepo name: "springsource-org-external", urls: "http://repository.springsource.com/maven/bundles/external"
}
assemble.dependsOn generatePom
dependencies {
classpath 'org.springframework:gradle-plugins:0.1-SNAPSHOT'
classpath 'net.sf.docbook:docbook-xsl:1.75.2:ns-resources@zip'
}
}
allprojects {
// group will translate to groupId during pom generation and deployment
group = 'org.springframework.data'
version = '1.0.0.BUILD-SNAPSHOT'
releaseBuild = version.endsWith('RELEASE')
snapshotBuild = version.endsWith('SNAPSHOT')
// version will be used in maven pom generation as well as determining
// where artifacts should be deployed, based on release type of snapshot,
// milestone or release.
// @see org.springframework.build.Version under buildSrc/ for more info
// @see gradle.properties for the declaration of this property.
version = new Version(springDataKeyValueVersion)
repositories {
mavenLocal()
mavenCentral()
@@ -48,23 +60,11 @@ configure(javaprojects) {
apply plugin: "maven"
apply plugin: 'eclipse' // `gradle eclipse` to generate .classpath/.project
apply plugin: 'idea' // `gradle idea` to generate .ipr/.iml
apply plugin: 'docbook'
apply plugin: 'bundlor' // all core projects should be OSGi-compliant
// set up dedicated directories for jars and source jars.
// this makes it easier when putting together the distribution
libsBinDir = new File(libsDir, 'bin')
libsSrcDir = new File(libsDir, 'src')
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:-serial"]
assemble.dependsOn generatePom
// add tasks for creating source jars and generating poms etc
apply from: "$buildSrcDir/maven-deployment.gradle"
// add tasks for finding and publishing .xsd files
apply from: "$buildSrcDir/schema-publication.gradle"
// Common dependencies
dependencies {
// Logging
@@ -87,13 +87,10 @@ configure(javaprojects) {
testCompile "org.springframework:spring-test:$springVersion"
testCompile "org.mockito:mockito-all:$mockitoVersion"
}
}
configurations {
build
}
dependencies {
sourceSets.main.classesDir = new File(buildDir, "classes/" + project.name.substring("spring-data".length() + 1))
apply from: "$rootDir/dist.gradle"
}
ideaProject {
@@ -102,23 +99,6 @@ ideaProject {
}
}
// -----------------------------------------------------------------------------
// Configuration for the docs subproject
// -----------------------------------------------------------------------------
project('docs') {
apply from: "$buildSrcDir/docs.gradle"
// javadoc settings
api.options.breakIterator = true
api.options.showFromProtected()
api.options.groups = [
'Spring Data Key Value Core': ['org.springframework.data.keyvalue*'],
'Spring Data Redis Support' : ['org.springframework.data.keyvalue.redis*'],
'Spring Data Riak Support' : ['org.springframework.data.keyvalue.riak*']]
api.options.links = [
"http://static.springframework.org/spring/docs/3.0.x/javadoc-api",
"http://download.oracle.com/javase/6/docs/api/"]
}
apply from: "$buildSrcDir/dist.gradle"
apply from: "$buildSrcDir/checks.gradle"
task wrapper(type: Wrapper) {
gradleVersion = '0.9.2'
}

Submodule buildSrc deleted from 308ed0ee90

106
dist.gradle Normal file
View File

@@ -0,0 +1,106 @@
apply plugin: 'maven'
// Distro zip
// SpringSource s3 maven deployer
configurations {
antaws
}
dependencies {
antaws "org.springframework.build:org.springframework.build.aws.ant:3.0.3.RELEASE",
"net.java.dev.jets3t:jets3t:0.6.1"
}
// Create a source jar for uploading
task sourceJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.java
}
artifacts {
archives sourceJar
}
task dist(type: Zip) {
dependsOn subprojects*.tasks*.matching { task -> task.name == 'assemble' }
evaluationDependsOn(':docs')
def zipRootDir = "${project.name}-$version"
into(zipRootDir) {
from(rootDir/docs/src/info) {
include '*.txt'
}
into('dist') {
from javaProjects.collect {project -> project.libsDir }
}
}
doLast {
ant.checksum(file: archivePath, algorithm: 'SHA1', fileext: '.sha1')
}
}
task uploadDist(type: org.springframework.gradle.tasks.S3DistroUpload) {
archiveFile = dist.archivePath
projectKey = 'DATAKV'
projectName = 'Spring Data Key Value'
}
// Remove the archive configuration from the runtime configuration, so that anything added to archives
// (such as the source jar) is no longer included in the runtime classpath
configurations.default.extendsFrom = [configurations.runtime] as Set
// Add the main jar into the default configuration
artifacts { 'default' jar }
gradle.taskGraph.whenReady {graph ->
if (graph.hasTask(uploadArchives)) {
// check properties defined and fail early
s3AccessKey
s3SecretAccessKey
mavenSyncRepoDir
}
}
def deployer = null
uploadArchives {
description = "Maven deploy of archives artifacts to SpringSource Maven repos" // url appended below
// Maven deployment
def releaseRepositoryUrl = "file://${project.properties.mavenSyncRepoDir}"
def milestoneRepositoryUrl = 's3://maven.springframework.org/milestone'
def snapshotRepositoryUrl = 's3://maven.springframework.org/snapshot'
// add a configuration with a classpath that includes our s3 maven deployer
configurations { deployerJars }
dependencies {
deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE"
}
deployer = repositories.mavenDeployer {
configuration = configurations.deployerJars
if (releaseBuild) {
// "mavenSyncRepoDir" should be set in properties
repository(url: releaseRepositoryUrl)
} else {
s3credentials = [userName: project.properties.s3AccessKey, passphrase: project.properties.s3SecretAccessKey]
repository(url: milestoneRepositoryUrl) {
authentication(s3credentials)
}
snapshotRepository(url: snapshotRepositoryUrl) {
authentication(s3credentials)
}
}
}
pom.project {
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
}
}
}

107
docs/build.gradle Normal file
View File

@@ -0,0 +1,107 @@
// -----------------------------------------------------------------------------
// Configuration for the docs subproject
// -----------------------------------------------------------------------------
apply plugin: 'base'
apply plugin: 'docbook'
assemble.dependsOn = ['api', 'docbook']
docbookHtmlSingle.stylesheet = new File(projectDir, 'docs/src/reference/resources/xsl/html-single-custom.xsl')
[docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceFileName = 'index.xml'
[docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceDirectory = new File(projectDir, 'docs/src/reference/docbook')
docbookHtml.stylesheet = new File(projectDir, 'docs/src/reference/resources/xsl/html-custom.xsl')
docbookHtmlSingle.stylesheet = new File(projectDir, 'docs/src/reference/resources/xsl/html-single-custom.xsl')
docbookFoPdf.stylesheet = new File(projectDir, 'docs/src/reference/resources/xsl/pdf-custom.xsl')
def imagesDir = new File(projectDir, 'docs/src/reference/resources/images');
// docbookFoPdf.admonGraphicsPath = "${imagesDir}/"
docbookFoPdf.imgSrcPath = "${projectDir}/docs/reference/resources/"
spec = copySpec {
into ('reference') {
from("$buildDir/docs")
from("$projectDir/src/reference/resources")
}
into ('reference/images') {
from (imagesDir)
}
}
task api(type: Javadoc) {
group = 'Documentation'
description = "Builds aggregated JavaDoc HTML for all core project classes."
// this task is a bit ugly to configure. it was a user contribution, and
// Hans tells me it's on the roadmap to redesign it.
srcDir = file("${projectDir}/src/api")
destinationDir = file("${buildDir}/api")
tmpDir = file("${buildDir}/api-work")
optionsFile = file("${tmpDir}/apidocs/javadoc.options")
options.stylesheetFile = file("${srcDir}/spring-javadoc.css")
options.links = ["http://static.springframework.org/spring/docs/3.0.x/javadoc-api"]
options.overview = "${srcDir}/overview.html"
options.docFilesSubDirs = true
title = "${rootProject.description} ${version} API"
// collect all the sources that will be included in the javadoc output
source javaprojects.collect {project ->
project.sourceSets.main.allJava
}
// collect all main classpaths to be able to resolve @see refs, etc.
// this collection also determines the set of projects that this
// task dependsOn, thus the runtimeClasspath is used to ensure all
// projects are included, not just *dependencies* of all classes.
// this is awkward and took me a while to figure out.
classpath = files(javaprojects.collect {project ->
project.sourceSets.main.runtimeClasspath
})
// copy the images from the doc-files dir over to the target
doLast { task ->
copy {
from file("${task.srcDir}/doc-files")
into file("${task.destinationDir}/doc-files")
}
}
}
// javadoc settings
api.options.outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
api.options.breakIterator = true
api.options.showFromProtected()
api.options.groups = [
'Spring Data Key Value Core': ['org.springframework.data.keyvalue*'],
'Spring Data Redis Support' : ['org.springframework.data.keyvalue.redis*'],
'Spring Data Riak Support' : ['org.springframework.data.keyvalue.riak*']]
api.options.links = [
"http://static.springframework.org/spring/docs/3.0.x/javadoc-api",
"http://download.oracle.com/javase/6/docs/api/"]
apiSpec = copySpec {
into('api') {
from(api.destinationDir)
}
}
task docSiteLogin(type: org.springframework.gradle.tasks.Login) {
if (project.hasProperty('sshHost')) {
host = project.property('sshHost')
}
}
// upload task
task uploadApidocs(type: org.springframework.gradle.tasks.ScpUpload) {
dependsOn api
baseName = "${rootProject.name}"
appendix = 'apidocs'
remoteDir = '.'
login = docSiteLogin
with(apiSpec)
}

View File

@@ -17,10 +17,4 @@ mockitoVersion = 1.8.5
# version to be applied to all projects in this multi-project build. this is
# the one and only location version changes need to be made.
# ------------------------------------------------------------------------------
springDataKeyValueVersion=1.0.0.BUILD-SNAPSHOT
# ------------------------------------------------------------------------------
# build system user roles
# role may be either 'developer' or 'buildmaster'
# ------------------------------------------------------------------------------
role=developer
springDataKeyValueVersion=1.0.0.BUILD-SNAPSHOT

View File

@@ -3,4 +3,6 @@ rootProject.name = 'spring-data-key-value'
include 'docs'
include "spring-data-keyvalue-core",
"spring-data-redis",
"spring-data-riak"
"spring-data-riak"
docs = findProject(':docs')

View File

@@ -10,4 +10,8 @@ dependencies {
compile "org.jredis:jredis-anthonylauzon:$jredisVersion"
compile "org.springframework:spring-oxm:$springVersion"
compile "commons-beanutils:commons-beanutils-core:1.8.3"
}
}
version = "123"
bundlor.useProjectProps = true