blob: e79e20e4eee4a74cd7ad4bb474443a1750d54af7 [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.
*/
plugins {
id "org.nosphere.apache.rat" version "0.3.0"
id "com.diffplug.gradle.spotless" version "3.0.0"
id "de.undercouch.download" version "3.1.2"
}
def downloadUrl = (geodeReleaseUrl != "") ? geodeReleaseUrl :
"https://www.apache.org/dyn/closer.cgi?action=download&filename=geode/$geodeVersion"
def verificationUrl = (geodeReleaseUrl != "") ? geodeReleaseUrl :
"https://www.apache.org/dist/geode/$geodeVersion"
def downloadFile = "apache-geode-${geodeVersion}.tar.gz"
def installFile = "$buildDir/$downloadFile"
def installDir = "$buildDir/apache-geode-${geodeVersion}"
task downloadGeode {
inputs.property 'geodeVersion', geodeVersion
outputs.file installFile
outputs.file "${installFile}.sha256"
doLast {
download {
src([
"$downloadUrl/$downloadFile",
"$verificationUrl/${downloadFile}.sha256"
])
dest buildDir
}
}
}
task verifyGeode(type: de.undercouch.gradle.tasks.download.Verify, dependsOn: downloadGeode) {
src installFile
algorithm "SHA-256"
doFirst {
checksum file("${installFile}.sha256").text.split(' ')[0]
}
}
task installGeode(type: Copy, dependsOn: verifyGeode) {
inputs.file installFile
outputs.dir installDir
from tarTree(resources.gzip(installFile))
into buildDir
}
allprojects {
apply plugin:'java'
repositories {
if (geodeRepositoryUrl != "") {
maven { url geodeRepositoryUrl }
}
mavenCentral()
}
dependencies {
compile "org.apache.geode:geode-core:$geodeVersion"
testCompile "com.jayway.awaitility:awaitility:$awaitilityVersion"
testCompile "junit:junit:$junitVersion"
testCompile "org.mockito:mockito-core:$mockitocoreVersion"
testCompile "com.github.stefanbirkner:system-rules:$systemrulesVersion"
testCompile "org.assertj:assertj-core:$assertjVersion"
}
}
configurations {
testArchives
}
dependencies {
testArchives sourceSets.test.output
}
subprojects {
dependencies {
compile "org.apache.logging.log4j:log4j-core:$log4jVersion"
runtime "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion"
testCompile project(path: ':', configuration: 'testArchives')
}
task cleanServer << {
delete 'locator'
delete 'server1'
delete 'server2'
}
clean.finalizedBy cleanServer
def geodePath = "${System.env.PATH}${System.getProperty('path.separator')}${installDir}/bin"
task start(type: Exec, dependsOn: [installGeode, build, cleanServer]) {
workingDir projectDir
environment 'GEODE_HOME', installDir
environment 'PATH', geodePath
commandLine 'sh', '-c', "gfsh run --file=${projectDir}/scripts/start.gfsh"
}
task stop(type: Exec, dependsOn: installGeode) {
workingDir projectDir
environment 'GEODE_HOME', installDir
environment 'PATH', geodePath
commandLine 'sh', '-c', "gfsh run --file=${projectDir}/scripts/stop.gfsh"
}
task run(type: JavaExec, dependsOn: build) {
description = 'Run example'
classpath = sourceSets.main.runtimeClasspath
main = "org.apache.geode.examples.${project.name}.Example"
}
task runAll(dependsOn: [start, run, stop])
run.mustRunAfter start
stop.mustRunAfter run
}
apply from: "gradle/spotless.gradle"
apply from: "gradle/ide.gradle"
apply from: "gradle/rat.gradle"
apply from: "gradle/release.gradle"