forked from BrightSpots/rcv
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
265 lines (229 loc) · 9.04 KB
/
Copy pathbuild.gradle
File metadata and controls
265 lines (229 loc) · 9.04 KB
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
plugins {
id "application"
id "checkstyle"
// Latest version at: https://github.com/spotbugs/spotbugs-gradle-plugin/tags
id "com.github.spotbugs" version "6.1.10"
id "idea"
id "java-library"
// Latest version at: https://github.com/beryx/badass-jlink-plugin/tags
id "org.beryx.jlink" version "3.1.1"
// Latest version at: https://github.com/openjfx/javafx-gradle-plugin/tags
id "org.openjfx.javafxplugin" version "0.0.14"
}
repositories {
mavenCentral()
}
dependencies {
implementation 'commons-cli:commons-cli:1.9.0'
implementation 'org.apache.commons:commons-csv:1.14.0'
implementation 'org.apache.poi:poi-ooxml:5.4.1'
implementation 'com.fasterxml.jackson.core:jackson-core:2.19.0'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.19.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.19.0'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.19.0'
implementation "com.github.spotbugs:spotbugs:4.9.3"
testImplementation platform('org.junit:junit-bom:5.12.2')
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
// ### Application plugin settings
application {
mainModule = "network.brightspots.rcv"
mainClass = "network.brightspots.rcv.Main"
}
// Required to accept a name and tiebreak interactively via CLI
run {
standardInput = System.in
// Uncomment below line to quickly switch into CLI mode for development
// args = ["--cli", "path/to/config"]
}
// ### Checkstyle plugin settings
checkstyle {
// Latest version at https://github.com/checkstyle/checkstyle/tags
toolVersion = '10.23.1'
// Keep the below file updated along with subsequent versions of Checkstyle (make sure to choose
// the tag matching the toolVersion above):
// https://github.com/checkstyle/checkstyle/blob/checkstyle-10.3.2/src/main/resources/google_checks.xml
// NOTE: After updating the local version of config/checkstyle/google_checks.xml again in the
// future, you will need to make two manual changes:
//
// 1. Replace the following line in the local copy to prevent suppressions from being ignored:
// "${org.checkstyle.google.suppressionfilter.config}"
// with:
// "${config_loc}/checkstyle-suppressions.xml"
// Additional context: https://github.com/gradle/gradle/issues/21409
//
// 2. Add the following property into the MissingJavadocMethod module
// to allow omitting Javadoc on short functions:
// <property name="minLineCount" value="2"/>
configFile = file("$projectDir/config/checkstyle/google_checks.xml")
maxWarnings = 0
ignoreFailures = false
}
spotbugs {
// Latest version at: https://github.com/spotbugs/spotbugs/tags
toolVersion = '4.9.3'
excludeFilter = file("config/spotbugs/exclude.xml")
}
// ### Idea plugin settings
idea {
module {
outputDir = file("out/production/classes")
}
}
// ### Java plugin settings
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
test {
jvmArgs += [
'--add-exports', 'org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED',
'--add-exports', 'org.junit.platform.commons/org.junit.platform.commons.logging=ALL-UNNAMED'
]
maxHeapSize = "2056m"
useJUnitPlatform()
testLogging {
events "PASSED", "FAILED", "SKIPPED"
}
}
// ### JavaFX plugin settings
javafx {
// Latest version here: https://gluonhq.com/products/javafx/
version = "21.0.7"
modules = ["javafx.base", "javafx.controls", "javafx.fxml", "javafx.graphics"]
}
def JLINK_DIR = "$buildDir/rcv"
// Comma-separated list of modules
// Necessary to explicitly include due to https://github.com/BrightSpots/rcv/issues/625
def MODULES_TO_ADD = "com.ctc.wstx"
// ### jlink plugin settings
jlink {
imageDir = file(JLINK_DIR)
imageZip = file(JLINK_DIR + ".zip")
addOptions '--add-modules', MODULES_TO_ADD,
'--strip-debug', '--compress', '2',
'--no-header-files', '--no-man-pages'
mergedModule {
requires "java.xml"
}
launcher {
// TODO Sync version number with release.yml and Main.java (github.com/BrightSpots/rcv/issues/662)
name = "RCTab"
version = "1.3.999"
}
jpackage {
installerOptions += [
'--verbose',
'--vendor', 'Ranked Choice Voting Resource Center'
]
if (org.gradle.internal.os.OperatingSystem.current().isLinux()) {
imageOptions += [
'--icon', 'src/main/resources/network/brightspots/rcv/launcher.png',
]
installerOptions += [
'--linux-package-name', 'rctab',
'--linux-deb-maintainer', 'info@rcvresources.org',
'--linux-shortcut'
]
}
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
imageOptions += [
'--icon', 'src/main/resources/network/brightspots/rcv/launcher.ico',
]
installerOptions += [
'--win-per-user-install',
'--win-dir-chooser',
'--win-menu',
'--win-shortcut'
]
}
if (org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
// .App is signed with the Application certificate
imageOptions += [
'--icon', 'src/main/resources/network/brightspots/rcv/launcher.icns',
'--resource-dir', 'src/main/resources/network/brightspots/rcv/',
'--mac-sign',
'--mac-signing-key-user-name', 'Developer ID Application: Election Administration Resource Center (A257HB4NS4',
'--mac-signing-keychain', 'build.keychain'
]
// DMG is signed with the Installer certificate
installerOptions += [
'--type', 'dmg',
'--icon', 'src/main/resources/network/brightspots/rcv/launcher.icns',
'--resource-dir', 'src/main/resources/network/brightspots/rcv/',
'--mac-sign',
'--mac-signing-key-user-name', 'Developer ID Installer: Election Administration Resource Center (A257HB4NS4)',
'--mac-signing-keychain', 'build.keychain',
'--mac-package-name', 'RCTab',
'--mac-package-identifier', 'network.brightspots.rcv',
'--mac-package-signing-prefix', 'network.brightspots.rcv'
]
}
}
}
def docsToCopy = copySpec {
from("$projectDir") {
include "README.md", "LICENSE", "config_file_documentation.txt"
}
}
def sampleInputToCopy = copySpec {
includeEmptyDirs = false
from("$projectDir/src/test/resources/network/brightspots/rcv/test_data") {
// Config example: interactive tiebreaking
include "sample_interactive_tiebreak/sample_interactive_tiebreak_config.json"
include "sample_interactive_tiebreak/sample_interactive_tiebreak_sequential_config.json"
include "sample_interactive_tiebreak/sample_interactive_tiebreak_cvr.xlsx"
// Config example: by-precinct
include "precinct_example/precinct_example_config.json"
include "precinct_example/precinct_example_cvr.xlsx"
// CVR example: CDF
include "aliases_cdf_json/aliases_cdf_json_config.json"
include "aliases_cdf_json/aliases_cdf_json_expected_summary.csv"
// CVR example: Clear Ballot
include "clear_ballot_kansas_primary/clear_ballot_kansas_primary_config.json"
include "clear_ballot_kansas_primary/clear_ballot_kansas_primary.cvr.csv"
// CVR example: Dominion
include "dominion_kansas/dominion_kansas_config.json"
include "dominion_kansas/dominion_kansas/kansas_input_data/*.json"
// CVR example: ES&S
include "2015_portland_mayor/2015_portland_mayor_config.json"
include "2015_portland_mayor/2015_portland_mayor_cvr.xlsx"
// CVR example: Hart
include "hart_cedar_park_school_board/hart_cedar_park_school_board_config.json"
include "_shared/hart_cvr_archive/*.xml"
// CSV example: Hart
include "generic_csv_test/generic_csv_test_config.json"
include "generic_csv_test/generic_csv_test_cvr.json"
exclude "output"
exclude "**/*expected*"
}
}
tasks.processTestResources {
exclude '**/output/**'
}
tasks.jlink.doLast {
copy {
with docsToCopy
into JLINK_DIR + "/docs"
}
copy {
with sampleInputToCopy
into JLINK_DIR + "/sample_input"
}
}
// Ensure reproducible hashes
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
dirPermissions {
unix(0755)
}
filePermissions {
unix(0644)
}
}