blob: 6823f42752e5446ff4f9e5884e09a0d260e1f75d [file] [log] [blame]
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* The Apache Incubator S4 Project Build File
*
*/
description = 'Apache S4'
defaultTasks 'assemble'
project.ext["archivesBaseName"] = 'apache-s4'
project.ext["distRootFolder"] = "$archivesBaseName-${-> version}"
allprojects {
// Append the suffix 'SNAPSHOT' when the build is not for release.
version = new Version(major: 0, minor: 6, bugfix: 0, isRelease: true)
group = 'org.apache.s4'
/* Search these repos to find artifacts. Gradle will download and cache. */
repositories {
mavenCentral()
mavenLocal()
maven { url 'http://google-gson.googlecode.com/svn/mavenrepo' }
maven { url 'https://repo.springsource.org/libs-release' }
maven { url 'http://repo.gradle.org/gradle/libs-releases-local' }
/* Add lib dir as a repo. Some jar files that are not available
in a public repo are distributed in the lib dir. */
flatDir name: 'libDir', dirs: "$rootDir/lib"
}
configurations.all {
transitive = false
}
}
/* All project libraries must be defined here. */
project.ext["libraries"] = [
guava: 'com.google.guava:guava:13.0.1',
gson: 'com.google.code.gson:gson:1.6',
guice: 'com.google.inject:guice:3.0',
aop_alliance: 'aopalliance:aopalliance:1.0',
guice_assist: 'com.google.inject.extensions:guice-assistedinject:3.0',
kryo: 'com.esotericsoftware.kryo:kryo:2.20',
minlog: 'com.googlecode:minlog:1.2',
// NOTE shaded jar is not resolved correctly, we include it in /lib directory
reflectasm: 'com.esotericsoftware.reflectasm:reflectasm:1.07:shaded',
netty: 'io.netty:netty:3.5.11.Final',
mockito_core: 'org.mockito:mockito-core:1.9.0',
commons_config: 'commons-configuration:commons-configuration:1.6',
commons_codec: 'commons-codec:commons-codec:1.4',
commons_coll: 'net.sourceforge.collections:collections-generic:4.01', // Use this lib until the commons collection with Generics is released.
commons_io: 'commons-io:commons-io:2.4',
commons_lang: 'commons-lang:commons-lang:2.6',
commons_logging: 'commons-logging:commons-logging:1.1.1',
commons_collections:'commons-collections:commons-collections:3.2.1',
objenesis: 'org.objenesis:objenesis:1.2',
slf4j: 'org.slf4j:slf4j-api:1.6.1',
log4j: 'log4j:log4j:1.2.15',
logback_core: 'ch.qos.logback:logback-core:0.9.29',
logback_classic: 'ch.qos.logback:logback-classic:0.9.29',
zk: 'org.apache.zookeeper:zookeeper:3.3.3',
jcip: 'net.jcip:jcip-annotations:1.0',
junit: 'junit:junit:4.10',
zkclient: 'com.github.sgroschupf:zkclient:0.1',
diezel: 'net.ericaro:diezel-maven-plugin:1.0.0-beta-4',
jcommander: 'com.beust:jcommander:1.25',
asm: 'org.ow2.asm:asm:4.0',
javax_inject: 'javax.inject:javax.inject:1',
gradle_base_services: 'org.gradle:gradle-base-services:1.4',
gradle_core: 'org.gradle:gradle-core:1.4',
gradle_tooling_api: 'org.gradle:gradle-tooling-api:1.4',
gradle_wrapper: 'gradle-wrapper:gradle-wrapper:1.4',
metrics: 'com.yammer.metrics:metrics-core:2.1.3'
]
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'maven-publish'
// apply plugin: 'checkstyle'
/* Set Java version. */
sourceCompatibility = 1.6
targetCompatibility = 1.6
project.ext["checkstyleConfigFileName"] = "$rootDir/config/checkstyle/s4-checkstyle.xml"
configurations.all {
exclude group: 'com.sun.jdmk', module: 'jmxtools'
exclude group: 'com.sun.jmx', module: 'jmxri'
exclude group: 'javax.jms', module: 'jms'
exclude group: 'javax.mail', module: 'mail'
}
dependencies {
/* Google. */
compile ( libraries.guava )
compile ( libraries.guice )
compile ( libraries.guice_assist)
/* Logging. */
compile( libraries.slf4j )
compile( libraries.logback_core )
compile( libraries.logback_classic )
runtime( libraries.commons_logging)
/* Commons. */
compile( libraries.commons_config )
compile( libraries.commons_coll )
compile( libraries.commons_io )
compile ( libraries.commons_lang )
runtime(libraries.commons_collections)
/* Misc. */
compile( libraries.jcip )
compile( libraries.zk )
compile( libraries.metrics )
/* Testing. */
testCompile( libraries.junit )
// transitive
runtime( libraries.log4j) // required by Zookeeper
runtime(libraries.aop_alliance)
runtime(libraries.minlog)
runtime(libraries.gson)
compile(libraries.reflectasm)
runtime(libraries.objenesis)
runtime(libraries.kryo)
runtime(libraries.netty)
runtime(libraries.asm)
compile(libraries.javax_inject)
runtime(libraries.commons_codec)
}
jar {
from (rootDir) {
include "NOTICE.txt"
include "LICENSE"
into "META-INF"
}
}
manifest.mainAttributes(
provider: 'gradle',
'Implementation-Url': 'http://incubator.apache.org/s4/',
'Implementation-Version': version,
'Implementation-Vendor': 'Apache Software Foundation',
'Implementation-Vendor-Id': 'org.apache',
'Implementation-Title': 'org.apache.s4.'+project.name.substring(3) // s4-comm becomes org.apache.s4.comm for instance
)
}
evaluationDependsOnChildren()
project.ext["platformProjects"] = [project(':s4-base'), project(':s4-core'), project(':s4-comm'), project(':s4-tools'), project(':s4-benchmarks')]
configurations {
platformLibs
}
dependencies {
platformLibs platformProjects
}
task javadoc (type: Javadoc) {
destinationDir = new File(project.rootDir, 'doc/javadoc')
destinationDir.deleteDir()
excludes = ['org.apache.s4.benchmark']
project.ext["documentedProjects"] = new HashSet(platformProjects)
documentedProjects.remove(project(':s4-benchmarks'))
title = "Apache S4 " + version
source documentedProjects.collect { project ->
project.sourceSets.main.allJava
}
// Might need a classpath
classpath = files(documentedProjects.collect { project ->
project.sourceSets.main.compileClasspath
})
}
// TODO parameterize
task javadocBinRelease (type: Javadoc) {
destinationDir = new File(project.rootDir,'subprojects/s4-tools/src/dist/doc/javadoc')
destinationDir.deleteDir()
title = "Apache S4 " + version
source platformProjects.collect { project ->
project.sourceSets.main.allJava
}
// Might need a classpath
classpath = files(subprojects.collect { project ->
project.sourceSets.main.compileClasspath
})
}
task copyRequiredFilesForBinaryRelease (type: Copy) {
copy {
from (rootDir) {
include "README.md"
include "DISCLAIMER"
include "RELEASE_NOTES.html"
include "gradlew"
include "gradle.bat"
include "s4"
}
into new File(project.rootDir.path+'/subprojects/s4-tools/src/dist/')
}
copy {
// binary release specifics
from (rootDir.path + "/config/binrelease/")
into new File(project.rootDir.path+'/subprojects/s4-tools/src/dist/')
include "*"
}
File s4DistFile = new File(project.rootDir.path+'/subprojects/s4-tools/src/dist/s4')
ant.replace(file: s4DistFile, token: "\n# NOTE: \"./gradlew s4-tools:installApp\" will prepare/update the tools subproject and related startup scripts", value: "")
ant.replace(file: s4DistFile, token: "subprojects/s4-tools/build/install/s4-tools/", value: "")
ant.chmod(file: s4DistFile, perm: "700")
copy {
from new File(rootDir, 'gradle')
into new File(project.rootDir.path+'/subprojects/s4-tools/src/dist/gradle')
}
copy {
from (new File(rootDir, 'lib')) {
include '*.properties'
}
into new File(project.rootDir.path+'/subprojects/s4-tools/src/dist/lib')
}
}
task binDist(dependsOn: ["s4-tools:clean", "javadocBinRelease", "copyRequiredFilesForBinaryRelease", "s4-tools:cleanDistZip", "s4-tools:distZip"]) {
doFirst {
new File(project.rootDir.path+'/subprojects/s4-tools/src/dist').deleteDir()
}
doLast {
copy {
from (project.rootDir.path+"/subprojects/s4-tools/build/distributions/")
into (project.buildDir)
exclude('tmp')
}
}
}
task srcDist(dependsOn: ["javadoc"], type: Zip) {
doFirst {
platformProjects.collect { project ->
project.tasks.clean.execute()
}
new File(project.rootDir.path+'/subprojects/s4-tools/src/dist').deleteDir()
}
classifier='src'
version = project.version
baseName=project.ext.archivesBaseName
destinationDir = project.buildDir
from (project.rootDir)
exclude ('**/.project')
exclude ('**/.classpath')
exclude ('.rat-excludes')
exclude ('**/.gradle/**')
exclude ('**/.settings/**')
exclude ('**/build/**')
exclude ('**/tmp/**')
exclude ('**/bin/**')
exclude ('website/**')
exclude ('lib/apache-rat-0.8.jar')
into (baseName+'-'+version+'-'+classifier)
}
task rat(type: JavaExec) {
print("Runs Apache RAT. Exclusions are defined in .rat-excludes file")
main = 'org.apache.rat.Report'
classpath = files ('lib/apache-rat-0.8.jar')
args = ['-E', '.rat-excludes', '--dir', '.']
}
task clean << {
delete buildDir
}
/* Generates the gradlew scripts.
http://www.gradle.org/docs/1.0/userguide/gradle_wrapper.html */
task wrapper(type: Wrapper) {
gradleVersion = '1.4'
jarFile='lib/gradle-wrapper-1.4.jar'
}
class Version {
int major
int minor
int bugfix
boolean isRelease
String toString() {
"$major.$minor.$bugfix${isRelease ? '' : '-SNAPSHOT'}-incubating"
}
}