blob: 3c697d76ca3b49bee6715fdb3aead27f970d1c91 [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.
*/
evaluationDependsOn(":geode-core")
apply plugin: 'distribution'
// disable artifact generation for this project
jar.enabled = false
extraArchive {
sources = false
javadoc = false
tests = false
}
publishing {
publications {
maven(MavenPublication) {
artifactId = 'apache-geode'
artifacts = []
artifact distTar
artifact distZip
}
}
}
logger.info("Gradle doesn't automatically remove the jar artifact even though we disabled it")
logger.info("this causes publishing to fail. So we nuke all the disabled artifacts from all configurations.")
configurations.all {
def configName = it.name
artifacts.each {
logger.info("Pruning configName = " + configName + " name=" + it.name + " extension=" + it.extension + " classifier=" + it.classifier)
}
artifacts.removeAll{ it.name == jar.baseName && it.extension == 'jar' && it.classifier == jar.classifier }
if (artifacts) {
logger.info("Artifacts are now: " + artifacts)
}
}
gradle.taskGraph.whenReady( { graph ->
tasks.withType(Tar).each { tar ->
tar.compression = Compression.GZIP
tar.extension = 'tgz'
}
tasks.srcDistZip {
classifier 'src'
}
tasks.srcDistTar {
classifier 'src'
}
tasks.withType(Jar).each { jarTasks ->
distTar.dependsOn(jarTasks)
distZip.dependsOn(jarTasks)
}
})
configurations {
bundled {
description 'A dependency that is shipped with geode, but is not required to compile'
}
gfshDependencies
}
dependencies {
archives project(':geode-common')
archives project(':geode-json')
archives project(':geode-core')
archives project(':geode-connectors')
archives project(':geode-lucene')
archives project(':geode-old-client-support')
archives project(':geode-protobuf')
archives project(':geode-protobuf-messages')
archives project(':geode-web')
archives project(':geode-web-api')
archives project(':geode-wan')
archives project(':geode-cq')
archives project(':geode-rebalancer')
testCompile project(':geode-core')
testCompile project(':geode-junit')
integrationTestCompile project(':geode-core')
integrationTestCompile project(":geode-junit")
integrationTestCompile project(":geode-dunit")
integrationTestCompile project(":geode-pulse")
integrationTestCompile project(':geode-assembly:geode-assembly-test')
integrationTestCompile 'org.apache.httpcomponents:httpclient:' + project.'httpclient.version'
distributedTestCompile project(':geode-core')
distributedTestCompile project(':extensions:session-testing-war')
distributedTestCompile project(':geode-assembly:geode-assembly-test')
distributedTestCompile 'org.apache.httpcomponents:httpclient:' + project.'httpclient.version'
distributedTestRuntime (project(':extensions:geode-modules-session-internal')) {
exclude group: 'org.apache.tomcat'
}
distributedTestRuntime group: 'org.codehaus.cargo', name: 'cargo-core-uberjar', version: '1.6.3'
acceptanceTestCompile project(':geode-core')
acceptanceTestCompile project(":geode-dunit")
uiTestCompile project(':geode-core')
uiTestCompile project(":geode-dunit")
uiTestCompile project(":geode-pulse")
uiTestCompile project(":geode-pulse:geode-pulse-test")
uiTestCompile project(':geode-assembly:geode-assembly-test')
uiTestCompile 'org.seleniumhq.selenium:selenium-api:' + project.'selenium.version'
uiTestCompile 'org.seleniumhq.selenium:selenium-remote-driver:' + project.'selenium.version'
uiTestCompile 'org.seleniumhq.selenium:selenium-support:' + project.'selenium.version'
uiTestRuntime project(":geode-core")
uiTestRuntime 'org.seleniumhq.selenium:selenium-chrome-driver:' + project.'selenium.version'
upgradeTestCompile project(':geode-core')
upgradeTestCompile project(":geode-dunit")
upgradeTestCompile project(':geode-assembly:geode-assembly-test')
upgradeTestRuntime group: 'org.codehaus.cargo', name: 'cargo-core-uberjar', version: '1.6.3'
upgradeTestRuntime 'org.apache.httpcomponents:httpclient:' + project.'httpclient.version'
upgradeTestRuntime project(':extensions:session-testing-war')
gfshDependencies ('org.springframework:spring-web:' + project.'springframework.version'){
exclude module: 'spring-core'
exclude module: 'commons-logging'
}
}
tasks.withType(Test){
dependsOn installDist
environment 'GEODE_HOME', "$buildDir/install/${distributions.main.baseName}"
}
task defaultDistributionConfig(type: JavaExec, dependsOn: classes) {
outputs.file file("$buildDir/gemfire.properties")
main 'org.apache.geode.distributed.internal.DefaultPropertiesGenerator'
classpath project(':geode-core').sourceSets.main.runtimeClasspath
workingDir buildDir
doFirst {
buildDir.mkdirs()
}
}
task defaultCacheConfig(type: JavaExec, dependsOn: classes) {
outputs.file file("$buildDir/cache.xml")
main 'org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator'
classpath project(':geode-core').sourceSets.main.runtimeClasspath
workingDir buildDir
doFirst {
buildDir.mkdirs()
}
}
// This closure sets the gemfire classpath. If we add another jar to the classpath it must
// be included in the filter logic below.
def cp = {
// first add all the dependent project jars
def jars = configurations.archives.dependencies.collect { it.dependencyProject }
.findAll { !(it.name.contains('web') || it.name.contains('pulse')) }
.collect { it.jar.archiveName }
.join(' ')
// then add all the dependencies of the dependent jars
jars += ' ' + configurations.archives.dependencies.collect {
it.dependencyProject.findAll { !(it.name.contains('web-api') || it.name.contains('pulse')) }
.collect { it.configurations.runtimeClasspath.collect { it.getName() }.findAll {
// depedencies from geode-core
it.contains('antlr') ||
it.contains('commons-io') ||
it.contains('classgraph') ||
it.contains('commons-collections') ||
it.contains('commons-lang') ||
it.contains('commons-logging') ||
it.contains('commons-validator') ||
it.contains('commons-beanutils') ||
it.contains('commons-codec') ||
it.contains('fastutil') ||
it.contains('jackson-annotations') ||
it.contains('jackson-core') ||
it.contains('jackson-databind') ||
it.contains('jansi') ||
it.contains('javax.resource-api') ||
it.contains('javax.servlet-api') ||
it.contains('javax.transaction-api') ||
it.contains('jetty-http') ||
it.contains('jetty-io') ||
it.contains('jetty-security') ||
it.contains('jetty-server') ||
it.contains('jetty-servlet') ||
it.contains('jetty-webapp') ||
it.contains('jetty-util') ||
it.contains('jetty-xml') ||
it.contains('jline') ||
it.contains('jna') ||
it.contains('jopt-simple') ||
it.contains('log4j-api') ||
it.contains('log4j-core') ||
it.contains('log4j-jcl') ||
it.contains('log4j-jul') ||
it.contains('log4j-slf4j-impl') ||
it.contains('rmiio') ||
it.contains('shiro') ||
it.contains('slf4j-api') ||
it.contains('spring-core') ||
it.contains('spring-shell') ||
it.contains('snappy') ||
it.contains('jgroups') ||
it.contains('netty') ||
// dependencies from geode-lucene
it.contains('lucene-analyzers-common') ||
it.contains('lucene-core') ||
it.contains('lucene-queries') ||
it.contains('lucene-queryparser') ||
it.contains('lucene-analyzers-phonetic') ||
// dependencies from geode-protobuf
it.contains('protobuf-java') ||
// dependencies from geode-connectors
it.contains('HikariCP')
}
}
}.flatten().unique().join(' ')
return jars
}
// Note: this dependency doesn't work if you change a library version from
// a dependent project. Please fix me.
task depsJar (type: Jar, dependsOn: ':geode-core:classes') {
description 'Assembles the jar archive that defines the gemfire classpath.'
archiveName 'geode-dependencies.jar'
doFirst {
manifest {
attributes("Class-Path": cp())
}
}
}
// Note: this dependency doesn't work if you change a library version from
// a dependent project. Please fix me.
task gfshDepsJar (type: Jar, dependsOn: ':geode-core:classes') {
description 'Assembles the jar archive that defines the gfsh classpath.'
archiveName 'gfsh-dependencies.jar'
doFirst {
manifest {
attributes("Class-Path": cp() +
' ' + project(':geode-core').webJar.archiveName +
' ' + configurations.gfshDependencies.collect{ it.getName() }.flatten().join(' ')
)
}
}
}
def docsDir = file("$buildDir/javadocs")
task docs(type: Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.links("https://lucene.apache.org/core/6_4_1/core/")
options.links("https://lucene.apache.org/core/6_4_1/queryparser/")
options.encoding='UTF-8'
source parent.subprojects*.javadoc*.source
classpath = files(parent.subprojects*.javadoc*.classpath)
title = "${productName} ${project.version}"
include 'org/apache/geode/**/'
exclude 'org/apache/geode/internal/**/'
exclude 'org/apache/geode/**/internal/**/'
exclude 'org/apache/geode/**/xml/**/'
exclude 'org/apache/geode/distributed/**/util/**/'
exclude 'org/apache/geode/test/**/'
destinationDir = docsDir
parent.subprojects.each { project ->
dependsOn(project.tasks['javadoc'])
}
doLast {
parent.subprojects.each { project ->
copy {
from project.sourceSets.main.resources.srcDirs
into docsDir
include 'javadoc-images/*'
}
}
}
}
task writeBuildInfo {
def buildInfo = file "$buildDir/.buildinfo"
outputs.file buildInfo
doLast {
buildInfo.getParentFile().mkdirs();
new FileOutputStream(buildInfo).withStream { fos ->
project(':geode-core').readScmInfo().store(fos, '')
}
}
}
gradle.taskGraph.whenReady( { graph ->
tasks.withType(AbstractArchiveTask).findAll {
it.name.toLowerCase().contains("dist")
}.each { archive ->
archive.doLast {
ant.checksum file:"${archive.archivePath}", algorithm:"sha-256", format: 'MD5SUM', fileext: '.sha256'
}
}
})
distributions {
src {
baseName = 'apache-geode'
contents {
from writeBuildInfo
from (rootDir) {
include 'ci/**'
}
from (rootDir) {
exclude 'KEYS'
exclude '**/gradlew'
exclude '**/gradlew.bat'
exclude '**/gradle/wrapper/gradle-wrapper.jar'
exclude '**/.gradle'
exclude '**/build/**'
exclude '**/out/**'
exclude '**/.project'
exclude '**/.classpath'
exclude '**/.settings/**'
exclude '**/build-eclipse/**'
exclude '**/.idea/**'
exclude '**/*.iml'
exclude '**/*.ipr'
exclude '**/*.iws'
exclude '**/.travis.yml'
exclude '**/tags'
//These directories are generated on the jenkins server by gradle
exclude 'caches'
exclude 'daemon'
exclude 'native'
exclude 'wrapper'
}
}
}
main {
baseName = 'apache-geode' //TODO rootProject.name
contents {
duplicatesStrategy 'exclude'
exclude '*.asc'
exclude '*.asc'
exclude '*-sources.jar'
exclude '*-javadoc.jar'
from rootProject.file( 'README.md' )
into ('config') {
from defaultCacheConfig
from defaultDistributionConfig
from (project(':geode-core').sourceSets.main.resources.files.find {
it.name == 'log4j2.xml'
})
}
into ('lib') {
from project(":geode-common").configurations.runtimeClasspath
from project(":geode-common").configurations.archives.allArtifacts.files
from project(":geode-json").configurations.runtimeClasspath
from project(":geode-json").configurations.archives.allArtifacts.files
from project(":geode-wan").configurations.runtimeClasspath
from project(":geode-wan").configurations.archives.allArtifacts.files
from project(":geode-cq").configurations.runtimeClasspath
from project(":geode-cq").configurations.archives.allArtifacts.files
from project(":geode-core").configurations.runtimeClasspath
from project(":geode-core").configurations.archives.allArtifacts.files
from project(":geode-lucene").configurations.runtimeClasspath
from project(":geode-lucene").configurations.archives.allArtifacts.files
from project(":geode-connectors").configurations.runtimeClasspath
from project(":geode-connectors").configurations.archives.allArtifacts.files
from project(":geode-old-client-support").configurations.runtimeClasspath
from project(":geode-old-client-support").configurations.archives.allArtifacts.files
from project(":geode-protobuf").configurations.runtimeClasspath
from project(":geode-protobuf").configurations.archives.allArtifacts.files
from project(":geode-protobuf-messages").configurations.runtimeClasspath
from project(":geode-protobuf-messages").configurations.archives.allArtifacts.files
from project(":geode-rebalancer").configurations.runtimeClasspath
from project(":geode-rebalancer").configurations.archives.allArtifacts.files
from configurations.bundled
from configurations.gfshDependencies
//These tasks are included as closures (wrapped in {}) because gradle may evaluate
//this CopySpec before it evaluates the geode-core build file.
from { project(":geode-core").webJar }
from { project(":geode-core").raJar }
from { project(":geode-core").jcaJar }
// dependency jars
from depsJar
from gfshDepsJar
}
into ('tools/Extensions') {
from (project(":geode-web").configurations.archives.allArtifacts.files) {
exclude '*.jar'
}
from (project(":geode-web-api").configurations.archives.allArtifacts.files) {
exclude '*.jar'
}
}
into('tools/ClientProtocol') {
from {project(":geode-protobuf-messages").zip.outputs.files}
}
into ('javadoc') {
from docs
}
into ('tools/Pulse') {
from (project(":geode-pulse").configurations.archives.allArtifacts.files)
}
into ('tools/Modules') {
from {project(':extensions:geode-modules-assembly').distTcServer}
from {project(':extensions:geode-modules-assembly').distTcServer30}
from {project(':extensions:geode-modules-assembly').distTomcat}
from {project(':extensions:geode-modules-assembly').distAppServer}
}
}
}
}
// Create a configuration closure to configure test targets with the install directory
def dependOnInstalledProduct = {
dependsOn installDist
def install = file("$buildDir/install/${distributions.main.baseName}")
environment ('GEODE_HOME', install)
}
// Add the configuration closure to the test targets so they depend on the install directory
test dependOnInstalledProduct
acceptanceTest dependOnInstalledProduct
distributedTest dependOnInstalledProduct
upgradeTest dependOnInstalledProduct
integrationTest dependOnInstalledProduct
uiTest dependOnInstalledProduct
flakyTest dependOnInstalledProduct
repeatTest dependOnInstalledProduct
// Make build final task to generate all test and product resources
build.dependsOn installDist
installDist.dependsOn ':extensions:geode-modules-assembly:dist'
distributedTest.dependsOn ':extensions:session-testing-war:war'
distributedTest.dependsOn ':geode-old-versions:build'
upgradeTest.dependsOn ':extensions:session-testing-war:war'
upgradeTest.dependsOn ':geode-old-versions:build'
/**Print the names of all jar files in a fileTree */
def printJars(tree) {
tree.matching {include("**/*.jar")}.visit{ file ->
if(!file.isDirectory()) {
println file.name
}
}
}
task dumpInstalledJars(dependsOn: installDist) {
doLast {
description "Dump a list of all of the jars shipped with the binary distribution, for validation purposes"
FileTree installDir = fileTree(dir: installDist.destinationDir)
println("Jars in the binary install")
println("==========================")
printJars(installDir)
installDir.include("**/*.war").visit{ file ->
if(!file.isDirectory()) {
FileTree warContents = zipTree(file.file)
println ""
println file.name
println("==========================")
printJars(warContents);
}
}
}
}