forked from vmware-archive/gemfirexd-oss
-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.gradle
963 lines (866 loc) · 33.2 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
/*
* Copyright (c) 2017-2022 TIBCO Software Inc. All rights reserved.
*
* Licensed 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. See accompanying
* LICENSE file.
*/
apply plugin: 'wrapper'
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2' }
}
dependencies {
classpath 'gradle.plugin.ca.coglinc2:javacc-gradle-plugin:3.0.0'
classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0'
classpath 'de.undercouch:gradle-download-task:3.4.3'
}
}
allprojects {
// We want to see all test results. This is equivalent to setting --continue
// on the command line.
gradle.startParameter.continueOnFailure = true
repositories {
mavenCentral()
maven { url 'https://packages.atlassian.com/maven-3rdparty' }
maven { url 'https://app.camunda.com/nexus/content/repositories/public' }
maven { url "https://repo.spring.io/libs-release" }
}
ext {
scalaBinaryVersion = '2.11'
sparkVersion = '2.1.3'
springVersion = '3.2.18.RELEASE'
springShellVersion = '1.0.0.RELEASE'
log4jVersion = '1.2.17'
log4j2Version = '2.17.2'
slf4jVersion = '1.7.32'
junitVersion = '4.13.2'
hamcrestVersion = '1.3'
mockitoVersion = '1.10.19'
jmockVersion = '2.9.0'
multiThreadedTCVersion = '1.01'
cglibVersion = '3.2.10'
bcelVersion = '6.2'
memcachedVersion = '2.12.3'
antVersion = '1.10.12'
antlr2Version = '2.7.7'
osgiVersion = '6.0.0'
jettyVersion = '9.4.43.v20210629'
hadoopVersion = '3.2.0'
// 2.x version required by Hoplog implementation which is not supported in SnappyData
// so this can be moved to 3.x and hoplog tests disabled.
// SnappyData level dependencies update to latest 3.x in any case.
protobufVersion = '2.6.1'
kryoVersion = '4.0.2'
thriftVersion = '0.9.3'
jnaVersion = '4.5.2'
jerseyVersion = '2.35'
jsr305Version = '3.0.2'
servletAPIVersion = '3.1.0'
derbyVersion = '10.14.2.0'
hibernateVersion = '4.3.11.Final'
hibernateJpaVersion = '1.0.2.Final'
commonsBeanutilsVersion = '1.9.4'
commonsCliVersion = '1.4'
commonsCodecVersion = '1.15'
commonsConfigVersion = '1.10'
commonsCollectionsVersion = '3.2.2'
commonsDbcpVersion = '1.4'
commonsIoVersion = '2.11.0'
commonsLangVersion = '2.6'
commonsLoggingVersion = '1.2'
commonsModelerVersion = '2.0.1'
commonsPoolVersion = '1.6'
commonsPool2Version = '2.6.2'
javaxResourceVersion = '1.7.1'
javaxTransactionVersion = '1.3'
mx4jVersion = '3.0.2'
mx4jToolsVersion = '3.0.1'
xalanVersion = '2.7.2'
oroVersion = '2.0.8'
dom4jVersion = '1.6.1'
apacheDsVersion = '1.5.7'
hbaseVersion = '0.98.24-hadoop2'
hadoopJettyVersion = '6.1.26'
sunJerseyVersion = '1.19.4'
guavaVersion = '14.0.1'
// don't update to latest 4.1.77 rather keep at Spark 2.1.3 dependency
// for snappydata-core tests which depend on upstream Spark
nettyVersion = '4.0.43.Final'
jlineVersion = '2.14.6'
jlineSfVersion = '1.0.S2-B'
jackson1Version = '1.9.14-atlassian-6'
fastutilVersion = '8.5.6'
snappyJavaVersion = '1.1.7.2'
rsApiVersion = '2.1.1'
htraceVersion = '3.2.0-incubating'
clouderaHtraceVersion = '2.05'
xmlApisVersion = '1.4.01'
xomVersion = '1.2.10'
jschVersion = '0.1.55'
objenesisVersion = '3.0.1'
tomcatJdbcVersion = '10.0.10'
vijavaVersion = '5.1'
jdomVersion = '1.1.3'
ojdbc8Version = '12.2.0.1'
bshVersion = '2.0b5'
jsonSimpleVersion = '1.1.1'
ejbVersion = '3.2.2'
c3p0Version = '0.9.5.5'
snappyDunitVersion = '1.0.3.7'
// product and release properties
PRODUCT_NAME = 'SnappyData RowStore'
GEMFIRE_PRODUCT = 'Pivotal GemFire'
GEMFIRE_VERSION = '7.5.Beta'
DERBY_NAME = 'Apache Derby'
DERBY_MAJOR = '10'
DERBY_MINOR = '4'
DERBY_MAINT = '2000000'
DERBY_DRDA_MAINT = '1'
PRODUCT_MAJOR = '1'
PRODUCT_MINOR = '6'
PRODUCT_MAINT = '7'
PRODUCT_MAINT_ENCODED = '7000000'
PRODUCT_CLASSIFIER = ''
PRODUCT_RELEASE_STAGE = '-HF-1'
PRODUCT_VERSION = "${PRODUCT_MAJOR}.${PRODUCT_MINOR}.${PRODUCT_MAINT}${PRODUCT_CLASSIFIER}"
vendorName = 'TIBCO Software Inc.'
PRODUCT_VENDOR = vendorName
COPYRIGHT = "Copyright (c) 2017-2022, ${PRODUCT_VENDOR} All rights reserved."
if (rootProject.name == 'snappy-store') {
subprojectBase = ':'
} else {
subprojectBase = ':snappy-store:'
// gitCmd = "git --git-dir=${project(':snappy-store').projectDir}/.git --work-tree=${project(':snappy-store').projectDir}"
}
gitCmd = "git --git-dir=${rootDir}/.git --work-tree=${rootDir}"
gitBranch = "${gitCmd} rev-parse --abbrev-ref HEAD".execute().text.trim()
commitId = "${gitCmd} rev-parse HEAD".execute().text.trim()
sourceDate = "${gitCmd} log -n 1 --format=%ai".execute().text.trim()
buildIdPrefix = System.env.USER + ' '
osArch = System.getProperty('os.arch')
osName = org.gradle.internal.os.OperatingSystem.current()
osVersion = System.getProperty('os.version')
buildDate = new Date().format('yyyy-MM-dd HH:mm:ss Z')
buildNumber = new Date().format('MMddyy')
jdkVersion = System.getProperty('java.version')
derbyProps = [ 'gemfirexd.version.major': DERBY_MAJOR,
'gemfirexd.version.minor': DERBY_MINOR,
'gemfirexd.version.maint': DERBY_MAINT,
'gemfirexd.version.drdamaint': DERBY_DRDA_MAINT,
'gemfirexd.build.number': '1',
'gemfirexd.product.external.name': DERBY_NAME,
'gemfirexd.product.external.version': "${DERBY_MAJOR}.${DERBY_MINOR}.${DERBY_MAINT}",
'gemfirexd.version.beta': 'true',
'gemfirexd.product.vendor': PRODUCT_VENDOR,
'gemfirexd.product.file': 'snappydata-store.jar' ]
}
buildRoot = buildRoot.trim()
def osDir = osName.getFamilyName().replace(' ', '').toLowerCase()
if (!buildRoot.isEmpty()) {
buildDir = new File(buildRoot, osDir + '/' + project.path.replace(':', '/'))
} else {
buildDir = 'build-artifacts/' + osDir
}
if (rootProject.hasProperty('enablePublish')) {
buildIdPrefix = "${vendorName} "
}
ext {
productDir = file("${rootProject.buildDir}/store")
locDir = 'com/pivotal/gemfirexd/internal/loc'
clientMsgOutDir = "${project(subprojectBase + 'snappydata-store-core').buildDir}/client/${locDir}"
if (!rootProject.hasProperty('sanity')) {
isSane = 'true'
} else {
isSane = sanity
}
if (rootProject.name == 'snappy-store') {
testResultsBase = "${rootProject.buildDir}/tests"
} else {
testResultsBase = "${rootProject.buildDir}/tests/store"
}
}
group = 'io.snappydata'
version = PRODUCT_VERSION
apply plugin: 'java'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'maven-publish'
apply plugin: 'idea'
// force same output directory for IDEA and gradle
idea {
module {
outputDir file(project.sourceSets.main.java.outputDir)
testOutputDir file(project.sourceSets.test.java.outputDir)
}
}
}
def writeProperties(def parent, def name, def comment, def propsMap) {
parent.exists() || parent.mkdirs()
def writer = new File(parent, name).newWriter()
def props = new Properties()
propsMap.each { k, v -> props.setProperty(k, v.toString()) }
try {
props.store(writer, comment.toString())
writer.flush()
} finally {
writer.close()
}
}
def writeTestProperties(def parent, def name) {
def availablePortFinder = AvailablePortFinder.createPrivate()
writeProperties(new File(parent, name), 'gemfire.properties',
'Autogenerated Gemfire properties', [
'mcast-port': Integer.toString(availablePortFinder.nextAvailable),
'log-level': 'config' ])
}
def getManifest(def symname, def imports, def exports, def otherAttrs) {
def attrs = [
'Manifest-Version' : '1.0',
'Title' : PRODUCT_NAME,
'Bundle-Name' : "${PRODUCT_NAME} ${PRODUCT_VERSION} ${PRODUCT_RELEASE_STAGE}",
'Bundle-Version' : PRODUCT_VERSION,
'Bundle-Vendor' : PRODUCT_VENDOR,
'Bundle-SymbolicName' : symname,
'Bundle-ActivationPolicy' : 'lazy',
'Bundle-NativeCode' : 'com/sun/jna/win32-x86/jnidispatch.dll; processor=x86;osname=win32, com/sun/jna/win32-x86-64/jnidispatch.dll; processor=x86-64;osname=win32, com/sun/jna/w32ce-arm/jnidispatch.dll; processor=arm;osname=wince, com/sun/jna/sunos-x86/libjnidispatch.so; processor=x86;osname=sunos, com/sun/jna/sunos-x86-64/libjnidispatch.so; processor=x86-64;osname=sunos, com/sun/jna/sunos-sparc/libjnidispatch.so; processor=sparc;osname=sunos, com/sun/jna/sunos-sparcv9/libjnidispatch.so; processor=sparcv9;osname=sunos, com/sun/jna/aix-ppc/libjnidispatch.a; processor=ppc;osname=aix, com/sun/jna/aix-ppc64/libjnidispatch.a; processor=ppc64;osname=aix, com/sun/jna/linux-ppc/libjnidispatch.so; processor=ppc;osname=linux, com/sun/jna/linux-ppc64/libjnidispatch.so; processor=ppc64;osname=linux, com/sun/jna/linux-x86/libjnidispatch.so; processor=x86;osname=linux, com/sun/jna/linux-x86-64/libjnidispatch.so; processor=x86-64;osname=linux, com/sun/jna/linux-arm/libjnidispatch.so; processor=arm;osname=linux, com/sun/jna/linux-ia64/libjnidispatch.so; processor=ia64;osname=linux, com/sun/jna/freebsd-x86/libjnidispatch.so; processor=x86;osname=freebsd, com/sun/jna/freebsd-x86-64/libjnidispatch.so; processor=x86-64;osname=freebsd, com/sun/jna/openbsd-x86/libjnidispatch.so; processor=x86;osname=openbsd, com/sun/jna/openbsd-x86-64/libjnidispatch.so; processor=x86-64;osname=openbsd, com/sun/jna/darwin/libjnidispatch.jnilib; osname=macosx;processor=x86;processor=x86-64;processor=ppc',
'DynamicImport-Package' : imports,
'Export-Package' : exports
]
attrs.putAll(otherAttrs)
return attrs
}
def generateCommonManifest(def pdir, def bdir) {
def ddir = "${bdir}/resources/main/META-INF/"
def fdir = new File(ddir)
fdir.exists() || fdir.mkdirs()
copy {
from "${pdir}/.."
into ddir
include 'LICENSE*'
include 'NOTICE*'
}
}
def replaceRegex(def fileDir, def fileName, def regex, def replacement) {
def tmpDir = "${buildDir}/tmp"
def filePath = "${fileDir}/${fileName}"
copy {
from filePath
into tmpDir
filter { line ->
line.replaceAll(regex, replacement)
}
}
delete filePath
file("${tmpDir}/${fileName}").renameTo(file(filePath))
}
def getProcessId() {
def name = java.lang.mangement.ManagementFactory.getRuntimeMXBean().getName()
return name[0..name.indexOf('@') - 1]
}
def getStackTrace(def t) {
java.io.StringWriter sw = new java.io.StringWriter()
java.io.PrintWriter pw = new java.io.PrintWriter(sw)
org.codehaus.groovy.runtime.StackTraceUtils.sanitize(t).printStackTrace(pw)
return sw.toString()
}
def now() {
return new Date().format('yyyy-MM-dd HH:mm:ss.SSS Z')
}
task cleanTestOutput { doLast {
def testDir = "${testResultsBase}/junit"
delete testDir
file(testDir).mkdirs()
} }
task cleanDUnitOutput { doLast {
def testDir = "${testResultsBase}/dunit"
delete testDir
file(testDir).mkdirs()
// writeTestProperties(testDir, '.')
} }
task cleanWanOutput { doLast {
def testDir = "${testResultsBase}/wan"
delete testDir
file(testDir).mkdirs()
} }
task cleanIntegrationOutput { doLast {
def testDir = "${testResultsBase}/integration"
delete testDir
file(testDir).mkdirs()
} }
task cleanReports { doLast {
def reportsDir = "${testResultsBase}/combined-reports"
delete reportsDir
file(reportsDir).mkdirs()
} }
subprojects {
int maxWorkers = project.hasProperty('org.gradle.workers.max') ?
project.property('org.gradle.workers.max') as int :
Runtime.getRuntime().availableProcessors()
// apply compiler options
compileJava.options.encoding = 'UTF-8'
javadoc {
options {
charSet = 'UTF-8'
windowTitle = 'GemFire XD Java API Documentation'
docTitle = "<h1>GemFire XD ${project.version} Java API</h1>"
header = "<i>GemFire XD ${project.version}</i>"
bottom = '<i>Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.</i>'
use = true
links = [ 'http://docs.oracle.com/javase/7/docs/api/' ]
// verbose = true
}
}
configurations {
testOutput {
extendsFrom testCompile
description 'a dependency that exposes test artifacts'
}
shadowInclude {
description = 'a dependency that is included only in the shadow jar'
canBeResolved = true
canBeConsumed = false
}
}
// Here we want to disable all transitive dependencies on external artifacts. This
// allows us to lock down library versions. However, we want project dependencies to
// be transitive such that the libraries of a dependent project are automatically included.
configurations.all { conf ->
if (!conf.name.startsWith('test')) {
dependencies.all { dep ->
if (dep instanceof ModuleDependency && !(dep instanceof ProjectDependency)) {
dep.transitive = false
}
}
resolutionStrategy {
// fail eagerly on version conflict (includes transitive dependencies)
// e.g. multiple different versions of the same dependency (group and name are equal)
failOnVersionConflict()
}
}
}
sourceSets {
test.compileClasspath += configurations.compileOnly
test.runtimeClasspath += configurations.compileOnly
}
dependencies {
compileOnly 'com.google.code.findbugs:annotations:3.0.1'
compile "org.slf4j:slf4j-api:${slf4jVersion}"
testCompile "junit:junit:${junitVersion}"
testCompile "org.hamcrest:hamcrest-core:${hamcrestVersion}"
testCompile "org.hamcrest:hamcrest-library:${hamcrestVersion}"
testCompile "org.mockito:mockito-core:${mockitoVersion}"
testCompile "org.jmock:jmock:${jmockVersion}"
testCompile "org.jmock:jmock-legacy:${jmockVersion}"
testCompile "edu.umd.cs.mtc:multithreadedtc:${multiThreadedTCVersion}"
testRuntime "cglib:cglib-nodep:${cglibVersion}"
testRuntime "org.objenesis:objenesis:${objenesisVersion}"
}
test {
dependsOn "${subprojectBase}storeProduct"
maxParallelForks = maxWorkers
minHeapSize = '1g'
maxHeapSize = '1g'
includes.clear()
def single = System.getProperty('junit.single')
if (single == null || single.length() == 0) {
single = rootProject.hasProperty('junit.single') ?
rootProject.property('junit.single') : null
}
if (single == null || single.length() == 0) {
include '**/*Test.class'
exclude '**/*TestUtil*'
exclude '**/*TestBase.class'
exclude '**/*HDFS*.class'
exclude '**/*DUnit*.class'
exclude '**/derbyTesting/**'
exclude '**/offheap/**/*Test.class'
exclude '**/gemstone/gemfire/cache/hdfs/**'
exclude '**/gemstone/gemfire/cache/query/**'
exclude '**/*Offheap*Test.class'
exclude '**/*OffHeap*Test.class'
exclude '**/*OHAddress*Test.class'
} else {
include single
}
useJUnit {
excludeCategories 'com.gemstone.junit.IntegrationTest'
excludeCategories 'com.gemstone.junit.DistributedTest'
}
workingDir = "${testResultsBase}/junit"
binResultsDir = file("${workingDir}/binary/${project.name}")
reports.html.destination = file("${workingDir}/html/${project.name}")
reports.junitXml.destination = file(workingDir)
}
if (rootProject.name == 'snappy-store') {
task dunitTest(type:Test) {
dependsOn "${subprojectBase}storeProduct"
maxParallelForks = Math.max(Math.sqrt(maxWorkers + 1) + 1 as int, 2)
minHeapSize = '2g'
maxHeapSize = '2g'
includes.clear()
def single = System.getProperty('dunit.single')
if (single == null || single.length() == 0) {
single = rootProject.hasProperty('dunit.single') ?
rootProject.property('dunit.single') : null
}
if (single == null || single.length() == 0) {
includes = [ '**/*DUnitTest.class', '**/*DUnit.class' ]
excludes = [
'**/*Suite.class', '**/*DUnitSecurityTest.class', '**/NCJ*DUnit.class', '**/*HDFS*DUnit*.class',
'**/BackwardCompatabilityPart*DUnit.class', '**/*Perf*DUnit.class', '**/ListAggDUnit.class',
'**/SingleHop*TransactionDUnit.class', '**/*Parallel*AsyncEvent*DUnit.class',
'**/pivotal/gemfirexd/wan/**/*DUnit.class', '**/*DUnitRecoveryTest.class',
'**/offheap/**/*DUnit*.class', '**/*OffHeap*DUnit*.class', '**/*Offheap*DUnit*.class'
]
} else {
include single
}
workingDir = "${testResultsBase}/dunit"
binResultsDir = file("${workingDir}/binary/${project.name}")
reports.html.destination = file("${workingDir}/html/${project.name}")
reports.junitXml.destination = file(workingDir)
// try to avoid long "tail" in parallel runs where some workers finish early
forkEvery 10
}
} else {
tasks.named('dunitTest').configure {
dependsOn "${subprojectBase}storeProduct"
maxParallelForks = Math.max(Math.sqrt(maxWorkers + 1) + 1 as int, 2)
minHeapSize = '2g'
maxHeapSize = '2g'
workingDir = "${testResultsBase}/dunit"
binResultsDir = file("${workingDir}/binary/${project.name}")
reports.html.destination = file("${workingDir}/html/${project.name}")
reports.junitXml.destination = file(workingDir)
// try to avoid long "tail" in parallel runs where some workers finish early
forkEvery 10
}
}
task wanTest(type:Test) {
dependsOn "${subprojectBase}storeProduct"
maxParallelForks = Math.sqrt(maxWorkers / 2 + 1) as int
minHeapSize = '1g'
maxHeapSize = '1g'
includes.clear()
def single = System.getProperty('wan.single')
if (single == null || single.length() == 0) {
single = rootProject.hasProperty('wan.single') ?
rootProject.property('wan.single') : null
}
if (single == null || single.length() == 0) {
include '**/pivotal/gemfirexd/wan/**/*DUnit.class'
exclude '**/pivotal/gemfirexd/wan/**/offheap/**/*DUnit.class'
exclude '**/*Offheap*DUnit.class'
exclude '**/*OffHeap*DUnit.class'
} else {
include single
}
exclude '**/*NCJ*DUnit.class'
workingDir = "${testResultsBase}/wan"
binResultsDir = file("${workingDir}/binary/${project.name}")
reports.html.destination = file("${workingDir}/html/${project.name}")
reports.junitXml.destination = file(workingDir)
// increase the number of JVMs for WAN tests
systemProperties 'gemfire.DUnitLauncher.NUM_VMS' : '8'
}
task integrationTest(type:Test) {
dependsOn "${subprojectBase}storeProduct"
maxParallelForks = maxWorkers
includes.clear()
include '**/*Test.class'
exclude '**/*DUnitTest.class'
exclude '**/*DUnit.class'
useJUnit {
includeCategories 'com.gemstone.junit.IntegrationTest'
excludeCategories 'com.gemstone.junit.UnitTest'
excludeCategories 'com.gemstone.junit.DistributedTest'
}
workingDir = "${testResultsBase}/integration"
binResultsDir = file("${workingDir}/binary/${project.name}")
reports.html.destination = file("${workingDir}/html/${project.name}")
reports.junitXml.destination = file(workingDir)
}
test.dependsOn subprojectBase + 'cleanTestOutput'
dunitTest.dependsOn subprojectBase + 'cleanDUnitOutput'
wanTest.dependsOn subprojectBase + 'cleanWanOutput'
wanTest.mustRunAfter dunitTest
integrationTest.dependsOn subprojectBase + 'cleanIntegrationOutput'
check.dependsOn.clear()
check.dependsOn test, dunitTest, wanTest
}
// maven publish tasks
subprojects {
if (rootProject.name == 'snappy-store') {
task packageSources(type: Jar, dependsOn: classes) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
}
task packageDocs(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc
}
task packageTests(type: Jar, dependsOn: testClasses) {
description 'Assembles a jar archive of test classes.'
from sourceSets.test.output.classesDirs
archiveClassifier.set('tests')
}
artifacts {
testOutput packageTests
}
} else {
publishArtifacts.add(packageDocs)
if (rootProject.hasProperty('enablePublish')) {
publishing.publications {
maven(MavenPublication) {
pom {
name = PRODUCT_NAME
packaging = 'jar'
// optionally artifactId can be defined here
description = 'SnappyData store based off Pivotal GemFireXD'
url = 'https://github.com/TIBCOSoftware/snappydata'
scm {
connection = 'scm:git:https://github.com/TIBCOSoftware/snappy-store.git'
developerConnection = 'scm:git:https://github.com/TIBCOSoftware/snappy-store.git'
url = 'https://github.com/TIBCOSoftware/snappy-store'
}
}
}
}
}
}
}
int getLast(includeTestFiles, pattern) {
includeTestFiles.findLastIndexOf {
File f -> f.name.indexOf(pattern) >= 0
}
}
// apply common test and misc configuration
gradle.taskGraph.whenReady { graph ->
def allTasks = subprojects.collect { it.tasks }.flatten()
allTasks.each { task ->
if (task instanceof Tar) {
def tar = (Tar)task
tar.compression = Compression.GZIP
tar.extension = 'tar.gz'
} else if (task instanceof Test) {
def test = (Test)task
test.configure {
jvmArgs = ['-XX:+UseParNewGC', '-XX:+UseConcMarkSweepGC',
'-XX:CMSInitiatingOccupancyFraction=50',
'-XX:+CMSClassUnloadingEnabled', '-ea']
testLogging.exceptionFormat = 'full'
systemProperties 'gemfire.DEFAULT_MAX_OPLOG_SIZE' : '10',
'gemfire.disallowMcastDefaults' : 'true',
'java.net.preferIPv4Stack' : 'true',
'jline.terminal' : 'scala.tools.jline.UnsupportedTerminal',
'store.test.resourceDir' : "${project.projectDir}/src/test/resources",
'GEMFIREXD' : productDir.getAbsolutePath(),
'gemfire.DUnitLauncher.CHILD_HEAPSIZE': '1g'
def logLevel = System.getProperty('logLevel')
if (logLevel != null && logLevel.length() > 0) {
systemProperties 'gemfire.log-level' : logLevel,
'logLevel' : logLevel
}
logLevel = System.getProperty('securityLogLevel')
if (logLevel != null && logLevel.length() > 0) {
systemProperties 'gemfire.security-log-level' : logLevel,
'securityLogLevel' : logLevel
}
environment 'GEMFIREXD' : productDir.getAbsolutePath(),
'JUNIT_JAR' : project.sourceSets.test.java.outputDir
if (rootProject.name == 'snappy-store') {
def failureCount = new java.util.concurrent.atomic.AtomicInteger(0)
def progress = new File(workingDir, 'progress.txt')
def output = new File(workingDir, 'output.txt')
def eol = System.getProperty('line.separator')
int numTestClasses = 0
def testCount = new java.util.concurrent.atomic.AtomicInteger(0)
doFirst {
numTestClasses = test.getCandidateClassFiles().getFiles().size()
}
beforeSuite { desc ->
if (desc.className != null) {
def count = testCount.incrementAndGet()
println "${now()} Start ${desc.className} ($count/$numTestClasses)"
}
}
afterSuite { desc, result ->
if (desc.className != null) {
println "${now()} END ${desc.className}"
}
}
beforeTest { desc ->
String now = now()
progress << "${now} Starting test ${desc.className} ${desc.name}${eol}"
output << "${now} STARTING TEST ${desc.className} ${desc.name}${eol}${eol}"
}
onOutput { desc, event ->
def msg = event.message
if (event.destination.toString() == 'StdErr') {
msg = msg.replace(eol, "${eol}[error] ")
}
output << msg
}
afterTest { desc, result ->
String now = now()
progress << "${now} Completed test ${desc.className} ${desc.name} with result: ${result.resultType}${eol}"
output << "${eol}${now} COMPLETED TEST ${desc.className} ${desc.name} with result: ${result.resultType}${eol}${eol}"
def exceptions = result.exceptions
if (exceptions.size() > 0) {
exceptions.each { t ->
progress << " EXCEPTION: ${getStackTrace(t)}${eol}"
output << "${getStackTrace(t)}${eol}"
}
failureCount.incrementAndGet()
}
}
doLast {
def report = "${test.reports.html.destination}/index.html"
if (failureCount.get() > 0) {
println()
def failureMsg = "FAILED: There were ${failureCount.get()} failures.${eol}"
failureMsg += " See the progress report in: file://$progress${eol}"
failureMsg += " HTML report in: file://$report"
throw new GradleException(failureMsg)
} else {
println()
println("SUCCESS: See the progress report in: file://$progress")
println(" HTML report in: file://$report")
println()
}
}
}
}
}
}
}
task junit {
dependsOn "${subprojectBase}snappydata-store-tools:test"
}
task dunit {
dependsOn "${subprojectBase}snappydata-store-tools:dunitTest"
}
task wan {
dependsOn "${subprojectBase}snappydata-store-tools:wanTest"
}
task integrationTest {
dependsOn subprojects.integrationTest
}
task combineReports(type: TestReport) {
description 'Combines the test reports.'
dependsOn cleanReports
destinationDir = file("${testResultsBase}/combined-reports")
mustRunAfter test, junit, dunit, wan, integrationTest
}
gradle.taskGraph.whenReady { graph ->
tasks.getByName('combineReports').reportOn rootProject.subprojects.collect{ it.tasks.withType(Test) }.flatten()
}
check.dependsOn.clear()
check.dependsOn junit, dunit
if (!rootProject.hasProperty('wan.skip')) {
check.dependsOn wan
}
// skip combineReports for top-level builds which has its own combineReports
if (!rootProject.hasProperty('store')) {
check.dependsOn combineReports
}
task generateSources {
dependsOn subprojectBase + 'gemfire-jgroups:jgMagic'
dependsOn subprojectBase + 'gemfire-core:createVersionPropertiesFile'
dependsOn subprojectBase + 'snappydata-store-core:compileJavacc'
dependsOn subprojectBase + 'snappydata-store-core:generatePropertiesFiles'
dependsOn subprojectBase + 'gemfire-core:createVersionPropertiesFile'
dependsOn subprojectBase + 'snappydata-store-shared:createVersionPropertiesFile'
dependsOn subprojectBase + 'snappydata-store-core:doSplit'
dependsOn subprojectBase + 'snappydata-store-core:odbcMeta'
dependsOn subprojectBase + 'snappydata-store-client:generatePropertiesFiles'
dependsOn subprojectBase + 'snappydata-store-tools:compileJavacc'
dependsOn subprojectBase + 'snappydata-store-tools:generatePropertiesFiles'
}
def includeJar(def jarFile) {
def jarName = jarFile.getName()
return jarName.contains('jetty') || jarName.contains('spring') ||
jarName.contains('hadoop') || jarName.contains('protobuf') ||
jarName.contains('jersey') || jarName.contains('jetty') ||
jarName.contains('jsr305') || jarName.contains('jline')
}
jar.enabled = false
// pack the entire GemFireXD product tree
task storeProduct(dependsOn: [ subprojectBase + 'snappydata-store-client:shadowJar',
subprojectBase + 'snappydata-store-core:shadowJar',
subprojectBase + 'snappydata-store-tools:shadowJar' ]) { doLast {
delete productDir
def sharedProject = project(subprojectBase + 'snappydata-store-shared')
def clientProject = project(subprojectBase + 'snappydata-store-client')
def gemcoreProject = project(subprojectBase + 'gemfire-core')
def coreProject = project(subprojectBase + 'snappydata-store-core')
def toolsProject = project(subprojectBase + 'snappydata-store-tools')
def gcmDir = System.getProperty('GCMDIR', '/gcm')
def extraJars = (gemcoreProject.configurations.compileOnly - gemcoreProject.configurations.runtime +
coreProject.configurations.compileOnly - coreProject.configurations.runtime +
toolsProject.configurations.compileOnly - toolsProject.configurations.runtime).filter {
includeJar(it)
}
// first copy the product and dependent jars
copy {
from(clientProject.jar.destinationDir) {
include clientProject.shadowJar.archiveName
}
from(coreProject.jar.destinationDir) {
include coreProject.shadowJar.archiveName
}
from(toolsProject.jar.destinationDir) {
include toolsProject.shadowJar.archiveName
}
from extraJars
into "${productDir}/lib"
}
// next the scripts
copy {
from(toolsProject.projectDir.getAbsolutePath() + '/bin') {
include 'gfxd'
include 'color'
include 'appdirector/gemfirexd*'
include 'dataextractor'
include 'dataextractloader'
include 'gfxd-completion.bash'
if (osName.isWindows()) {
include 'gfxd.bat'
include 'dataextractor.bat'
include 'dataextractloader.bat'
}
}
into "${productDir}/bin"
filter { line ->
line.replaceAll('__VERSION__', version)
}
fileMode 0755
}
// the native JNI libraries
if (osName.isLinux()) {
copy {
from gemcoreProject.projectDir.getAbsolutePath() + '/lib'
into "${productDir}/lib"
include '*.so'
}
copy {
from coreProject.projectDir.getAbsolutePath() + '/lib'
into "${productDir}/lib"
}
}
if (osName.isWindows()) {
copy {
from gemcoreProject.projectDir.getAbsolutePath() + '/lib'
into "${productDir}/lib"
include '*.dll'
}
}
// examples, javadocs, vsd
copy {
from(project(subprojectBase + 'snappydata-store-core').projectDir.getAbsolutePath() + '/../examples') {
exclude 'src/main/java/mapreduce/README.txt'
exclude 'src/main/java/mapreduce/pom.xml'
}
from(coreProject.projectDir.getAbsolutePath()) {
include 'src/main/java/com/pivotal/gemfirexd/callbacks/DBSynchronizer.java'
include 'src/main/java/com/pivotal/gemfirexd/callbacks/AsyncEventHelper.java'
}
into "${productDir}/examples"
}
copy {
from(project(subprojectBase + 'snappydata-store-core').projectDir.getAbsolutePath() + '/../examples') {
include 'src/main/java/mapreduce/README.txt'
include 'src/main/java/mapreduce/pom.xml'
}
into "${productDir}/examples"
filter { line ->
line.replaceAll('__VERSION__', version)
}
}
copy {
from (project(subprojectBase + 'snappydata-store-core').projectDir.getAbsolutePath() + '/../quickstart')
into "${productDir}/quickstart"
}
copy {
from "${gcmDir}/where/vsd/70/vsd"
into "${productDir}/tools/vsd"
}
if (rootProject.hasProperty('docs')) {
copy {
from sharedProject.javadoc.destinationDir
from coreProject.javadoc.destinationDir
into "${productDir}/docs/japi"
}
}
copy {
from(rootDir.getAbsolutePath() + '/release/images') {
include 'GemFireXD_190x81.png'
}
from(rootDir.getAbsolutePath() + '/release/docfiles') {
include 'copyright.html'
include 'support.html'
include 'DocIndex.css'
include 'gfxd-index.html'
}
into "${productDir}/docs"
rename 'gfxd-index.html', 'index.html'
}
copy {
from (project(subprojectBase + 'gemfire-tests').sourceSets.main.java.srcDirs) {
include '**/*.bt'
include '**/*.conf'
include '**/*.inc'
include '**/*.sql'
include '**/*.prop'
include '**/*.spec'
include '**/*.gold'
include '**/*.properties'
include '**/*.keystore'
include '**/*.ts'
include '**/*.pl'
include 'bin/testManagerLogWriter.sh'
include 'hydratest/hydracheck/*.sh'
include 'bin/scaleperf/*'
}
from (project(subprojectBase + 'snappydata-store-tests').sourceSets.main.java.srcDirs) {
include '**/*.bt'
include '**/*.conf'
include '**/*.inc'
include '**/*.sql'
include '**/*.prop'
include '**/*.spec'
include '**/*.gold'
include '**/*.properties'
include '**/*.keystore'
include '**/*.ts'
include '**/*.pl'
}
into (project(subprojectBase + 'snappydata-store-tests').sourceSets.main.java.outputDir)
}
} }
if (rootProject.hasProperty('docs')) {
storeProduct.dependsOn subprojectBase + 'snappydata-store-shared:javadoc',
subprojectBase + 'snappydata-store-core:javadoc'
}
task cleanAll {
dependsOn clean, subprojects.clean
}
task buildAll {
dependsOn subprojects.assemble, subprojects.testClasses, storeProduct
mustRunAfter cleanAll
}
check.mustRunAfter buildAll
task precheckin {
if (rootProject.hasProperty('gfxd')) {
dependsOn cleanAll, buildAll, check
}
}