build.gradle script
This commit is contained in:
215
build.gradle
Normal file
215
build.gradle
Normal file
@@ -0,0 +1,215 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url 'http://repo.springsource.org/plugins-release' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.springframework.build.gradle:bundlor-plugin:0.1.2'
|
||||
classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.1.5'
|
||||
}
|
||||
}
|
||||
|
||||
description = 'Spring Data Cassandra'
|
||||
group = 'org.springframework.data'
|
||||
|
||||
repositories {
|
||||
maven { url "http://repo1.maven.org/maven2" }
|
||||
maven { url "http://repo.springsource.org/libs-snapshot" }
|
||||
maven { url "http://repo.springsource.org/plugins-release" }
|
||||
maven { url "repo" }
|
||||
}
|
||||
|
||||
apply plugin: "java"
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
apply from: "$rootDir/maven.gradle"
|
||||
apply plugin: 'docbook-reference'
|
||||
apply plugin: 'bundlor'
|
||||
|
||||
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:-serial"]
|
||||
|
||||
// Common dependencies
|
||||
dependencies {
|
||||
// Logging
|
||||
compile "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
compile "org.slf4j:jcl-over-slf4j:$slf4jVersion"
|
||||
testRuntime "log4j:log4j:$log4jVersion"
|
||||
testRuntime "org.slf4j:slf4j-log4j12:$slf4jVersion"
|
||||
|
||||
// Spring Framework
|
||||
compile("org.springframework:spring-core:$springVersion") {
|
||||
exclude module: "commons-logging"
|
||||
}
|
||||
compile "org.springframework:spring-context-support:$springVersion"
|
||||
compile "org.springframework:spring-tx:$springVersion"
|
||||
compile("org.springframework:spring-oxm:$springVersion", optional)
|
||||
compile "org.springframework.data:spring-data-commons:$springDataVersion"
|
||||
|
||||
// Cassandra Drivers
|
||||
compile "com.datastax.cassandra:cassandra-driver-core:$datastaxVersion"
|
||||
compile "org.apache.cassandra:cassandra-all:$cassandraVersion"
|
||||
compile "io.netty:netty:$nettyVersion"
|
||||
|
||||
// Mappers
|
||||
compile("org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion", optional)
|
||||
compile("commons-beanutils:commons-beanutils-core:1.8.3", optional)
|
||||
|
||||
// Testing
|
||||
testCompile "junit:junit:$junitVersion"
|
||||
testCompile "org.springframework:spring-test:$springVersion"
|
||||
testCompile "org.mockito:mockito-all:$mockitoVersion"
|
||||
testCompile("javax.annotation:jsr250-api:1.0", optional)
|
||||
testCompile("com.thoughtworks.xstream:xstream:1.3", optional)
|
||||
}
|
||||
|
||||
sourceCompatibility = 1.5
|
||||
targetCompatibility = 1.5
|
||||
|
||||
javadoc {
|
||||
ext.srcDir = file("${projectDir}/docs/src/api")
|
||||
destinationDir = file("${buildDir}/api")
|
||||
ext.tmpDir = file("${buildDir}/api-work")
|
||||
|
||||
configure(options) {
|
||||
stylesheetFile = file("${srcDir}/spring-javadoc.css")
|
||||
overview = "${srcDir}/overview.html"
|
||||
docFilesSubDirs = true
|
||||
outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
|
||||
breakIterator = true
|
||||
showFromProtected()
|
||||
groups = [
|
||||
'Spring Data Cassandra' : ['org.springframework.data.cassandra*'],
|
||||
]
|
||||
|
||||
links = [
|
||||
"http://static.springframework.org/spring/docs/3.0.x/javadoc-api",
|
||||
"http://download.oracle.com/javase/6/docs/api",
|
||||
"http://jackson.codehaus.org/1.8.2/javadoc"
|
||||
]
|
||||
|
||||
exclude "org/springframework/data/cassandra/config/**"
|
||||
}
|
||||
|
||||
title = "${rootProject.description} ${version} API"
|
||||
}
|
||||
|
||||
bundlor {
|
||||
manifestTemplate = file("${projectDir}/template.mf").text
|
||||
}
|
||||
|
||||
|
||||
jar {
|
||||
manifest.attributes['Implementation-Title'] = 'spring-data-cassandra'
|
||||
manifest.attributes['Implementation-Version'] = project.version
|
||||
|
||||
from("$rootDir/docs/src/info") {
|
||||
include "license.txt"
|
||||
include "notice.txt"
|
||||
into "META-INF"
|
||||
expand(copyright: new Date().format('yyyy'), version: project.version)
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn:classes) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allJava
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc
|
||||
}
|
||||
|
||||
reference {
|
||||
sourceDir = file('docs/src/reference/docbook')
|
||||
}
|
||||
|
||||
task docsZip(type: Zip) {
|
||||
group = 'Distribution'
|
||||
classifier = 'docs'
|
||||
description = "Builds -${classifier} archive containing api and reference for deployment"
|
||||
|
||||
from('docs/src/info') {
|
||||
include 'changelog.txt'
|
||||
}
|
||||
|
||||
from (javadoc) {
|
||||
into 'api'
|
||||
}
|
||||
|
||||
from (reference) {
|
||||
into 'reference'
|
||||
}
|
||||
}
|
||||
|
||||
task schemaZip(type: Zip) {
|
||||
group = 'Distribution'
|
||||
classifier = 'schema'
|
||||
description = "Builds -${classifier} archive containing all XSDs for deployment"
|
||||
|
||||
def Properties schemas = new Properties();
|
||||
|
||||
sourceSets.main.resources.find {
|
||||
it.path.endsWith('META-INF' + File.separator + 'spring.schemas')
|
||||
}?.withInputStream { schemas.load(it) }
|
||||
|
||||
for (def key : schemas.keySet()) {
|
||||
def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
|
||||
def alias = key.replaceAll(/http.*schema.(.*).(spring-.*)/, '$2')
|
||||
assert shortName != key
|
||||
File xsdFile = sourceSets.main.resources.find {
|
||||
it.path.replace('\\', '/').endsWith(schemas.get(key))
|
||||
}
|
||||
assert xsdFile != null
|
||||
|
||||
into (shortName) {
|
||||
from xsdFile.path
|
||||
rename { String fileName -> alias }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task distZip(type: Zip, dependsOn: [jar, docsZip, schemaZip, sourcesJar, javadocJar]) {
|
||||
group = 'Distribution'
|
||||
classifier = 'dist'
|
||||
description = "Builds -${classifier} archive, containing all jars and docs, " +
|
||||
"suitable for community download page."
|
||||
|
||||
ext.zipRootDir = "${project.name}-${project.version}"
|
||||
|
||||
into (zipRootDir) {
|
||||
from('docs/src/info') {
|
||||
include 'readme.txt'
|
||||
include 'license.txt'
|
||||
include 'notice.txt'
|
||||
expand(copyright: new Date().format('yyyy'), version: project.version)
|
||||
}
|
||||
|
||||
from(zipTree(docsZip.archivePath)) {
|
||||
into "docs"
|
||||
}
|
||||
|
||||
from(zipTree(schemaZip.archivePath)) {
|
||||
into "schema"
|
||||
}
|
||||
into ("dist") {
|
||||
from rootProject.collect { project -> project.libsDir }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
archives javadocJar
|
||||
|
||||
archives docsZip
|
||||
archives schemaZip
|
||||
archives distZip
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
description = 'Generates gradlew[.bat] scripts'
|
||||
gradleVersion = '1.2'
|
||||
}
|
||||
|
||||
assemble.dependsOn = ['jar', 'sourcesJar']
|
||||
defaultTasks 'build'
|
||||
Reference in New Issue
Block a user