-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
147 lines (119 loc) · 4.37 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
apply plugin: 'java'
if(!project.hasProperty('mavenURL') || !project.hasProperty('downloadURL') || !project.hasProperty('version')) {
throw new GradleException("Usage: ./gradlew build -PmavenURL= -PdownloadURL= -version=");
}
def downloadDir = "${project.buildDir}/dist.apache.org/repos/dist/dev/geode/$version"
def srcDist = "${project.buildDir}/srcDist"
def exampleSrc = "${project.buildDir}/exampleSrc"
def binDist = "${project.buildDir}/binDist"
def srcClone = "${project.buildDir}/srcClone"
def nativeSrcDist = "${project.buildDir}/nativeSrcDist"
def nativeSrcClone = "${project.buildDir}/nativeSrcClone"
def versionNORC = version.replaceAll(/.RC\d+/, "");
repositories {
jcenter()
maven { url "$mavenURL" }
}
dependencies {
compile "org.apache.geode:geode-core:$versionNORC"
testCompile 'junit:junit:4.12'
testCompile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '4.4.1.201607150455-r'
}
test {
systemProperty 'SOURCE_CHECKOUT', srcClone;
}
//TODO - remove command line dependency - maybe use ant get?
task download(type:Exec) {
commandLine 'wget', "$downloadURL", "-m", "-np", "-nv"
workingDir=project.buildDir
}
//TODO - remove command line dependency
task verifySHA(type:Exec, dependsOn: download) {
commandLine 'bash', '-c', 'ls *.zip *.tar.gz *.tgz | xargs -n1 -I {} bash -c "shasum -c {}.sha*"'
workingDir=downloadDir
}
//TODO - remove command line dependency
task verifyGPG(type:Exec, dependsOn: download) {
commandLine 'bash', '-c', 'ls *.zip *.tar.gz *.tgz | xargs -n1 -I {} gpg --verify {}.asc'
workingDir=downloadDir
}
task verifySigs(dependsOn: [verifySHA, verifyGPG])
task unzipSrc(type: Copy, dependsOn: download) {
def zipFile = file("${downloadDir}/apache-geode-${versionNORC}-src.tgz")
def outputDir = file(srcDist)
from tarTree(zipFile)
into outputDir
}
task unzipBin(type: Copy, dependsOn: download) {
def zipFile = file("${downloadDir}/apache-geode-${versionNORC}.tgz")
def outputDir = file(binDist)
from tarTree(zipFile)
into outputDir
}
task testgfsh(type: Exec, dependsOn: unzipBin) {
workingDir="${binDist}/apache-geode-$versionNORC"
commandLine "$projectDir/scripts/gfsh_test.sh"
}
task unzipExampleSrc(type: Copy, dependsOn: download) {
def zipFile = file("${downloadDir}/apache-geode-examples-${versionNORC}-src.tgz")
def outputDir = file(exampleSrc)
from tarTree(zipFile)
into outputDir
}
//This is deliberately *not* using gradle build to make sure the wrapper works
task buildSrc(type: Exec, dependsOn: unzipSrc) {
workingDir="${srcDist}/apache-geode-$versionNORC-src"
commandLine './gradlew', 'build'
}
//This is deliberately *not* using gradle build to make sure the wrapper works
task buildExampleSrc(type: Exec, dependsOn: unzipExampleSrc) {
workingDir="${exampleSrc}/apache-geode-examples-$versionNORC-src"
commandLine './gradlew', 'build', 'runAll', "-PgeodeRepositoryUrl=$mavenURL", "-PgeodeReleaseUrl=$downloadURL"
}
//TODO - remove command line dependency
task cloneSrc(type:Exec) {
commandLine 'git', 'clone', '--depth=1', "--branch=rel/v${version}", "https://github.com/apache/geode", srcClone
onlyIf {
!file("$srcClone/.git").exists();
}
}
task cloneNativeSrc(type:Exec) {
commandLine 'git', 'clone', '--depth=1', "--branch=rel/v${version}", "https://github.com/apache/geode-native", nativeSrcClone
onlyIf {
!file("$nativeSrcClone/.git").exists();
}
}
task unzipSrcNative(type: Copy, dependsOn: download) {
def zipFile = file("${downloadDir}/apache-geode-native-${versionNORC}-src.tgz")
def outputDir = file(nativeSrcDist)
from tarTree(zipFile)
into outputDir
}
//TODO - remove command line dependency
task compareSrc(type:Exec, dependsOn: cloneSrc) {
commandLine 'bash', '-c',
"""diff -r -q \
-x build \
-x gradlew \
-x gradle-wrapper.jar \
-x gradlew.bat \
-x .git \
-x .gitignore \
-x .buildinfo \
-x .gradle \
-x .travis.yml \
-x jpf.properties \
-x .gitattributes \
-x geode-old-versions \
-x KEYS \
${srcDist}/apache-geode-${versionNORC}-src ${srcClone}"""
}
task compareNativeSrc(type:Exec, dependsOn: [cloneNativeSrc, unzipSrcNative]) {
commandLine 'bash', '-c',
"""diff -r -q \
-x .git \
-x .gitignore \
${nativeSrcDist}/apache-geode-native-${versionNORC}-src ${nativeSrcClone}"""
}
test.dependsOn cloneSrc
check.dependsOn verifySigs, buildSrc, testgfsh, compareSrc, buildExampleSrc, compareNativeSrc