-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
140 lines (118 loc) · 4.43 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
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* User Manual available at https://docs.gradle.org/5.2.1/userguide/tutorial_java_projects.html
*/
plugins {
// Apply the java plugin to add support for Java
id 'java'
// Apply the application plugin to add support for building an application
id 'application'
id 'checkstyle'
}
sourceCompatibility = 11
targetCompatibility = 11
repositories {
mavenCentral()
}
dependencies {
// Use JUnit test framework
testImplementation('org.junit.jupiter:junit-jupiter:5.4.2')
// Command line parsing
compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
// Logging
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.26'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
// Units
compile group: 'javax.measure', name: 'unit-api', version: '2.0-PRD'
compile group: 'tec.units', name: 'unit-ri', version: '1.0.3'
// Braille translation - native library JNI wrapper
compile 'org.liblouis:liblouis-java:4.2.0'
// CSV parsing
compile "com.opencsv:opencsv:4.6"
// SVG
compile group: 'org.jfree', name: 'jfreesvg', version: '3.4'
}
tasks.withType(Test) {
useJUnitPlatform()
}
// Copy Braille tables from submodule to working dir
def brailleTablesCopySpec = copySpec {
from "$projectDir/third_party/liblouis/tables/"
}
task copyBrailleTables(type: Copy) {
with brailleTablesCopySpec
into "$projectDir/src/main/resources/mapping/liblouis"
}
task copyBrailleTablesTest(type: Copy) {
with brailleTablesCopySpec
into "$projectDir/src/test/resources/mapping/liblouis"
}
task copyBrailleTablesIntegrationTest(type: Copy) {
with brailleTablesCopySpec
into "$projectDir/src/integrationTest/resources/mapping/liblouis"
}
processResources.dependsOn copyBrailleTables
processResources.dependsOn copyBrailleTablesTest
processResources.dependsOn copyBrailleTablesIntegrationTest
// Abort if files are missing
gradle.taskGraph.afterTask { copyBrailleTables ->
if(copyBrailleTables.state.noSource){
throw new GradleException("Could not find liblouis Braille tables in \"$projectDir/third_party/liblouis/tables/\". Please make sure you updated all git submodules using \"git submodule update --init --recursive\" ")
}
}
// Delete tables on "clean" task
clean {
delete "$projectDir/src/main/resources/mapping/liblouis"
delete "$projectDir/src/test/resources/mapping/liblouis"
delete "$projectDir/src/integrationTest/resources/mapping/liblouis"
}
// Copy native liblouis libraries for major platforms to the resource folder
def liblouisBinaryCopySpec = copySpec {
from "$projectDir/third_party/liblouis_bin/bin/"
}
task copyLibLouisBinary(type: Copy) {
with liblouisBinaryCopySpec
into "$projectDir/src/main/resources/native/liblouis"
}
task copyLibLouisBinaryTest(type: Copy) {
with liblouisBinaryCopySpec
into "$projectDir/src/test/resources/native/liblouis"
}
task copyLibLouisBinaryIntegrationTest(type: Copy) {
with liblouisBinaryCopySpec
into "$projectDir/src/integrationTest/resources/native/liblouis"
}
processResources.dependsOn copyLibLouisBinary
processResources.dependsOn copyLibLouisBinaryTest
processResources.dependsOn copyLibLouisBinaryIntegrationTest
// Abort if files are missing
gradle.taskGraph.afterTask { copyLibLouisBinary ->
if(copyLibLouisBinary.state.noSource){
throw new GradleException("Could not find liblouis native libraries in \"$projectDir/third_party/liblouis_bin/bin/\". Please make sure you updated all git submodules using \"git submodule update --init --recursive\" ")
}
}
// Delete libraries on "clean" task
clean {
delete "$projectDir/src/main/resources/native/liblouis"
delete "$projectDir/src/test/resources/native/liblouis"
delete "$projectDir/src/integrationTest/resources/native/liblouis"
}
// Define the main class for the application
mainClassName = 'de.tudresden.inf.mci.brailleplot.App'
jar {
manifest {
attributes "Main-Class": "de.tudresden.inf.mci.brailleplot.App"
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
checkstyleTest {
showViolations = true
checkstyleTest.enabled = false
}
// Include integration tests
apply from: "$rootDir/integrationTest.gradle"