-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathbuild.gradle
246 lines (217 loc) · 8.66 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
plugins {
id "application"
id "checkstyle"
// Latest version at: https://github.com/spotbugs/spotbugs-gradle-plugin/tags
id "com.github.spotbugs" version "5.0.14"
id "idea"
id "java-library"
// Latest version at: https://github.com/beryx/badass-jlink-plugin/tags
id "org.beryx.jlink" version "2.26.0"
// 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.5.0'
implementation 'org.apache.commons:commons-csv:1.10.0'
implementation 'org.apache.poi:poi-ooxml:5.2.3'
implementation 'com.fasterxml.jackson.core:jackson-core:2.15.2'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.15.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.2'
implementation "com.github.spotbugs:spotbugs:4.8.3"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.3'
}
// ### Application plugin settings
application {
mainModule = "${moduleName}"
mainClass = "${moduleName}.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.12.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, it may be necessary to subsequently 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
configFile = file("$projectDir/config/checkstyle/google_checks.xml")
maxWarnings = 0
ignoreFailures = false
}
System.setProperty("org.checkstyle.google.suppressionfilter.config",
"$projectDir/config/checkstyle/checkstyle-suppressions.xml")
spotbugs {
// Latest version at: https://github.com/spotbugs/spotbugs/tags
toolVersion = '4.8.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(20))
}
}
test {
moduleOptions {
addExports = [
"org.junit.platform.commons/org.junit.platform.commons.util" : "ALL-UNNAMED",
"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 = "20.0.1"
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', '[email protected]',
'--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.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
dirMode = 0755
fileMode = 0644
}