-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
192 lines (158 loc) · 5.84 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
plugins {
id "de.undercouch.download" version "3.4.3"
}
// This allows us to compile either groovy or java from the same set of directories
apply plugin: 'java'
apply plugin: 'groovy'
repositories {
jcenter()
mavenCentral()
}
sourceSets {
main {
java { srcDirs = [] }
groovy { srcDirs += ['src/main'] }
}
test {
java { srcDirs = [] }
groovy { srcDirs += ['src/test'] }
}
}
dependencies {
// Groovy - used to compile Groovy projects. This is what allows IntelliJ to provide groovy code completion & introspection
compile group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.5.6'
// Common lib for logging
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.26'
// Common lib for logging
// https://mvnrepository.com/artifact/org.slf4j/slf4j-simple
compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.26'
// Websocket library used to communicate with the UI
compile group: 'org.java-websocket', name: 'Java-WebSocket', version: '1.4.0'
// YAML parser used for reading config files
// https://mvnrepository.com/artifact/org.yaml/snakeyaml
compile group: 'org.yaml', name: 'snakeyaml', version: '1.24'
// Include all jar files in 'lib' automatically
compile fileTree(dir: 'lib', include: ['**/*.jar'])
//processing Core
// https://mvnrepository.com/artifact/org.processing/core
//compile group: 'org.processing', name: 'core', version: '3.3.7'
//processing Serial, this link does not work, possibly missing native bindings
//https://mvnrepository.com/artifact/org.processing/serial
compile group: 'org.processing', name: 'serial', version: '3.3.7'
//////////////// For unit/integration tests
// https://mvnrepository.com/artifact/junit/junit
testCompile group: 'junit', name: 'junit', version: '4.12'
// Mocking library
// https://mvnrepository.com/artifact/org.mockito/mockito-core
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.28.2'
// Lets us mock even harder. To the max
// https://mvnrepository.com/artifact/org.powermock/powermock-core
testCompile group: 'org.powermock', name: 'powermock-core', version: '2.0.2'
// https://mvnrepository.com/artifact/org.powermock/powermock-module-junit4
testCompile group: 'org.powermock', name: 'powermock-module-junit4', version: '2.0.2'
// https://mvnrepository.com/artifact/org.powermock/powermock-api-mockito2
testCompile group: 'org.powermock', name: 'powermock-api-mockito2', version: '2.0.2'
// Hamcrest junit matchers
// https://mvnrepository.com/artifact/org.hamcrest/java-hamcrest
testCompile group: 'org.hamcrest', name: 'java-hamcrest', version: '2.0.0.0'
// Hamcrest junit matchers
// https://mvnrepository.com/artifact/org.hamcrest/hamcrest-junit
testCompile group: 'org.hamcrest', name: 'hamcrest-junit', version: '2.0.0.0'
// Allows capturing logs and exit status from commands
// https://mvnrepository.com/artifact/com.github.stefanbirkner/system-rules
testCompile group: 'com.github.stefanbirkner', name: 'system-rules', version: '1.19.0'
// Some random io utilities
// https://mvnrepository.com/artifact/commons-io/commons-io
testCompile group: 'commons-io', name: 'commons-io', version: '2.6'
}
task downloadProcessingVideoLibrary() {
doLast {
download {
println "Downloading processing video library"
src 'https://github.com/processing/processing-video/releases/download/latest-processing3/video.zip'
dest new File("${rootDir}/tmp", 'processing-video-lib-latest-processing3.zip')
onlyIfModified true
}
}
}
task unzipProcessingVideoLibrary(dependsOn: downloadProcessingVideoLibrary) {
doLast {
copy {
println "Unzipping processing video library"
from zipTree("${rootDir}/tmp/processing-video-lib-latest-processing3.zip")
into "${rootDir}/lib"
}
}
}
task downloadProcessingUdpLibrary() {
doLast {
download {
println "Downloading processing udp library"
src 'http://ubaa.net/shared/processing/udp/udp.zip'
dest new File("${rootDir}/tmp", 'udp.zip')
onlyIfModified true
}
}
}
task unzipProcessingUdpLibrary(dependsOn: downloadProcessingUdpLibrary) {
doLast {
copy {
println "Unzipping processing udp library"
from zipTree("${rootDir}/tmp/udp.zip")
into "${rootDir}/lib"
}
}
}
task downloadProcessingCoreLibrary() {
doLast {
download {
println "Downloading processing core library"
src 'http://download.processing.org/processing-3.5.3-linux64.tgz'
dest new File("${rootDir}/tmp", 'processing-3.5.3-linux64.tgz')
onlyIfModified true
}
}
}
task untarProcessingCoreLibrary(dependsOn: downloadProcessingCoreLibrary) {
doLast {
copy {
println "Untarring processing core library"
from tarTree("${rootDir}/tmp/processing-3.5.3-linux64.tgz")
into "${rootDir}/tmp"
}
copy {
from("${rootDir}/tmp/processing-3.5.3/core/library/core.jar")
into("${rootDir}/lib/processing-core")
}
delete "${rootDir}/tmp/processing-3.5.3"
}
}
task downloadJoglJar() {
doLast {
download {
println "Downloading jogl jar"
src 'https://public-deps.s3-us-west-2.amazonaws.com/jogamp-2.3.2-patched.jar'
dest new File("${rootDir}/lib/jogl-2.3.2-patched", 'jogamp-2.3.2-patched.jar')
onlyIfModified true
}
}
}
// To do this, I googled 'gradle build fat jar' and copied this from the first link (with a couple modifications)
// https://www.baeldung.com/gradle-fat-jar
task fatJar(type: Jar) {
manifest {
attributes 'Main-Class': 'app.TesseractMain'
}
baseName = 'TesseractFatJar'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
test {
dependsOn cleanTest
testLogging {
showStandardStreams = true
events "passed", "skipped", "failed"
exceptionFormat = 'full'
}
}