-
Notifications
You must be signed in to change notification settings - Fork 129
/
build.gradle
executable file
·239 lines (201 loc) · 7.23 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
buildscript {
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
}
plugins {
id "de.undercouch.download" version "4.1.2"
}
subprojects {
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
apply plugin: 'eclipse'
repositories {
mavenCentral()
}
}
repositories {
mavenCentral()
}
//=========================================================================================
//
// RELEASE VERSION, RELEASE DATE AND BINARY PACK INFORMATION ARE
// CONTROLLED BY THE SECTION BELOW
//
//=========================================================================================
ext.YEAR = '2024'
ext.BuildDate = 'Thu Sep 30 22:00:00 CDT ' + "$YEAR"
ext.SpecificationVersion = '3.8.2.0'
ext.SpecificationVersionShort = '3.8.2'
// Comment out line below to publish offical release
// ext.SpecificationVersion = "$SpecificationVersion" + "-SNAPSHOT"
// Update below to L1.all.rrg, G1.all.gload, or E1.all.eload when needed
ext.etaImplementationVersion = 'etaj' + "$SpecificationVersionShort" + '.L1.all.rrg'
ext.emaImplementationVersion = 'emaj' + "$SpecificationVersionShort" + '.L1.all.rrg'
// NOTE! update with new asset version
ext.BINARY_PACK_VERSION_TO_DOWNLOAD = '2.2.2.L1'
//=========================================================================================
//
// END OF SECTION CONTROLLING THE RELEASE INFORMATION
//
//=========================================================================================
ext.vendor = 'LSEG'
ext.javadoc_footer = '<a href="https://developers.lseg.com/" target=_top>LSEG</a>'
ext.javadoc_header = '<a href="https://developers.lseg.com/" target=_top>LSEG</a>'
ext.javadoc_bottom = '<i>Copyright @ ' + "$YEAR" + ' LSEG. All Rights Reserved.</i>'
task downloadBinaryPack(type: Download) {
description 'This task downloads the RTSDK-BinaryPack file from GitHub.'
def releaseToDownload = "RTSDK-BinaryPack-" + BINARY_PACK_VERSION_TO_DOWNLOAD
def zipFileToDownload = releaseToDownload + ".zip"
src 'https://github.com/Refinitiv/Real-Time-SDK/releases/download/Real-Time-SDK-' + BINARY_PACK_VERSION_TO_DOWNLOAD + '/' + zipFileToDownload
dest new File('../.', 'RTSDK-BinaryPack.zip')
}
task unzipBinaryPack(dependsOn: downloadBinaryPack, type: Copy) {
ext.temp = new File('../temp')
from zipTree(downloadBinaryPack.dest)
into ext.temp
}
task getBinaryPack () {
// check if we are in GSG package
File gsgDir = file('../RTSDK-BinaryPack')
if (!gsgDir.exists()) {
dependsOn unzipBinaryPack
}
else
{
println "RTSDK-BinaryPack already exists, skip downloading."
}
doLast {
// check if Binary Pack exists
File gsgDirNew = file('../RTSDK-BinaryPack')
if (!gsgDirNew.exists()) {
// move the file
file('../temp/RTSDK-BinaryPack').renameTo(file('../RTSDK-BinaryPack'))
// delete temp directory and downloaded file
unzipBinaryPack.ext.temp.deleteDir()
downloadBinaryPack.dest.delete()
}
}
}
allprojects {
apply plugin: 'java'
dependencies {
testImplementation ('junit:junit:4.13.2') {
exclude group: 'org.hamcrest'
}
testImplementation 'org.hamcrest:hamcrest-core:1.3'
testImplementation 'org.mockito:mockito-core:3.12.4'
}
compileJava {
options.compilerArgs += ["-Xlint:cast"]
options.compilerArgs += ["-Xlint:deprecation"]
options.compilerArgs += ["-Xlint:divzero"]
options.compilerArgs += ["-Xlint:empty"]
options.compilerArgs += ["-Xlint:fallthrough"]
options.compilerArgs += ["-Xlint:finally"]
options.compilerArgs += ["-Xlint:overrides"]
options.compilerArgs += ["-Xlint:path"]
options.compilerArgs += ["-Xlint:serial"]
options.compilerArgs += ["-Xlint:unchecked"]
options.compilerArgs += ["-Xlint:-options"] //suppresses warning "warning: [options] source value 8 is obsolete and will be removed in a future release"
}
tasks.withType( JavaCompile ) {
dependsOn getBinaryPack
options.fork = true
options.incremental = true
}
// set the jvmArgs and commandLineArgs for all applications
tasks.withType ( JavaExec ) {
if ( project.hasProperty("vmArgs") ) {
jvmArgs Eval.me( buildArgsList( vmArgs ) )
}
if ( project.hasProperty("commandLineArgs") ) {
args Eval.me( buildArgsList( commandLineArgs ) )
}
}
// set the jvmArgs for junit
tasks.withType ( Test ) {
if ( project.hasProperty("vmArgs") ) {
jvmArgs Eval.me( buildArgsList( vmArgs ) )
}
minHeapSize = "1024m"
maxHeapSize = "2048m"
testLogging {
// set options for log level LIFECYCLE
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
showStackTraces true
// print tests summary
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
}
wrapper {
gradleVersion = '8.9'
if (GradleVersion.current() < GradleVersion.version("8.9")) {
throw new GradleException("This project requires Gradle 8.9 or higher. Please upgrade your Gradle version.")
}
}
task uploadAll ( ) {
group 'Upload'
description 'Uploads All artifacts to maven central, run with -Pmavencentral'
if (project.hasProperty("mavencentral"))
{
dependsOn ':Eta:AnsiPage:publish'
dependsOn ':Eta:Core:publish'
dependsOn ':Eta:ValueAdd:publish'
dependsOn ':Eta:ValueAddCache:publish'
dependsOn ':Eta:Converter:publish'
dependsOn ':Ema:Core:publish'
}
else
{
doLast {
println ""
println "/////////////////////////////////////////////////////////"
println ""
println "This task needs to be run with -Pmavencentral option"
println "Exiting without publishing to Maven Central"
println ""
println "/////////////////////////////////////////////////////////"
println ""
}
}
}
// this method creates a list of arguments that are used in setting the jvmArgs and commandLineArgs
def buildArgsList ( options ) {
// remove spaces
def arguments = options.tokenize()
// create a string that can be used by Eval
def cla = "["
// go through the list to get each argument
arguments.each {
cla += "'" + "${it}" + "',"
}
// remove last "," add "]" and set the args
return cla.substring( 0, cla.lastIndexOf(',') ) + "]"
}
// can't use a dynamic date for manifest since it triggers a build each time even when nothing changed
def getDate() {
def date = new Date()
def formattedDate = date.format('E MMM dd HH:mm:ss z yyyy ')
return formattedDate
}
// disable creating empty Java.jar file
jar.enabled = false