blob: 1f962d8957e659edc01ca7712b71acf2a96cd1ba [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: 5, bugfix: 0, isRelease: true)
group = 'org.apache.s4'
/* Search these repos to find artifacts. Gradle will download and cache. */
repositories {
mavenLocal()
mavenCentral()
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' }
maven { url 'http://maven.restlet.org' }
/* 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:12.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.googlecode:kryo:1.04',
minlog: 'com.googlecode:minlog:1.2',
reflectasm: 'com.googlecode:reflectasm:1.01',
netty: 'org.jboss.netty:netty:3.2.5.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',
commons_cli: 'commons-cli:commons-cli:1.2',
commons_math: 'org.apache.commons:commons-math:2.1',
restlet_neo: 'com.noelios.restlet:com.noelios.restlet:1.1.10',
restlet: 'org.restlet:org.restlet:1.1.10',
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.1',
jcip: 'net.jcip:jcip-annotations:1.0',
junit: 'junit:junit:4.10',
zkclient: 'com.github.sgroschupf:zkclient:0.1',
helix: 'org.apache.helix:helix-core:0.6.1-incubating-SNAPSHOT',
jackson_core_asl: 'org.codehaus.jackson:jackson-core-asl:1.8.5',
jackson_mapper_asl: 'org.codehaus.jackson:jackson-mapper-asl:1.8.5',
diezel: 'net.ericaro:diezel-maven-plugin:1.0.0-beta-4',
jcommander: 'com.beust:jcommander:1.25',
asm: 'asm:asm:3.2',
javax_inject: 'javax.inject:javax.inject:1',
gradle_base_services: 'org.gradle:gradle-base-services:1.0',
gradle_core: 'org.gradle:gradle-core:1.0',
gradle_tooling_api: 'org.gradle:gradle-tooling-api:1.0',
gradle_wrapper: 'gradle-wrapper:gradle-wrapper:1.0'
]
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'maven'
// 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)
runtime(libraries.commons_cli)
runtime(libraries.commons_math)
/* Misc. */
compile( libraries.jcip )
compile( libraries.zk )
compile(libraries.helix)
compile(libraries.jackson_core_asl)
compile(libraries.jackson_mapper_asl)
runtime(libraries.restlet)
runtime(libraries.restlet_neo)
/* Testing. */
testCompile( libraries.junit )
// transitive
runtime( libraries.log4j) // required by Zookeeper
runtime(libraries.aop_alliance)
runtime(libraries.minlog)
runtime(libraries.gson)
runtime(libraries.objenesis)
runtime(libraries.kryo)
runtime(libraries.netty)
runtime(libraries.asm)
runtime(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')]
configurations {
platformLibs
}
dependencies {
platformLibs platformProjects
}
task javadoc (type: Javadoc) {
destinationDir = new File(project.rootDir, '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
})
}
// 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/**')
into (baseName+'-'+version+'-'+classifier)
}
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.0'
jarFile='lib/gradle-wrapper-1.0.jar'
}
class Version {
int major
int minor
int bugfix
boolean isRelease
String toString() {
"$major.$minor.$bugfix${isRelease ? '' : '-SNAPSHOT'}-incubating"
}
}