-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathbuild.gradle
235 lines (209 loc) · 7.75 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
/*
* To run JGEX, just use
*
* ./gradlew run
*
* This is how you should create installer packages for JGEX:
*
* ./gradlew package # build and package the software via the javapackager plugin
* ./gradlew distZip # build and package the software as a .zip via the application plugin
*
* Prerequisites: You need the msgfmt utility (in your PATH) to have internationalized texts.
* (It is part of the gettext system.)
*/
import io.github.fvarrui.javapackager.model.FileAssociation
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'io.github.fvarrui:javapackager:1.7.5'
}
}
plugins {
id 'application'
}
apply plugin: 'io.github.fvarrui.javapackager.plugin'
// Global settings:
group = 'io.github.kovzol'
ext.softwareVersion = '0.86'
// These are default settings based on Gradle's standard layout:
ext.poDir = 'src/main/po'
ext.classesDir = 'build/classes/java/main'
ext.applicationMainClass = 'wprover.GExpert'
version = softwareVersion
tasks.addRule("Pattern: msgFmt_<FILE>Po: Compile <FILE>.po into <FILE>.class.") { String taskName ->
if (taskName.startsWith('msgFmt_') && taskName.endsWith('Po')) {
def language = (taskName - 'Po').substring('msgFmt_'.length())
task(taskName) {
def input = "${poDir}/${language}.po"
inputs.file input
def output = "${classesDir}/i18n/Messages_${language}.class"
outputs.file output
doLast {
def msgFmtCmd = "msgfmt --java2 -d ${classesDir} -r i18n.Messages -l ${language} ${input}"
exec {
ignoreExitValue true
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
commandLine 'cmd', '/c', msgFmtCmd
} else {
commandLine 'bash', '-c', msgFmtCmd
}
}
}
}
}
}
tasks.register("msgFmtAll") {
description "Creates the .class files from the .po translations."
group "build"
def list = []
FileTree files = fileTree(dir: poDir)
files.visit { f ->
if (f.name.endsWith('.po')) {
def msgFmtAllTask = 'msgFmt_' + f.name - '.po' + 'Po'
list << msgFmtAllTask
}
}
dependsOn list
}
tasks.named("classes") { finalizedBy("msgFmtAll") }
tasks.addRule("Pattern: msgMerge_<FILE>Po: Merge the file keys.pot into <FILE>.po.") { String taskName ->
if (taskName.startsWith('msgMerge_') && taskName.endsWith('Po')) {
def language = (taskName - 'Po').substring('msgMerge_'.length())
task(taskName) {
def input = "${poDir}/keys.pot"
inputs.file input
def output = "${poDir}/${language}.po"
outputs.file output
doLast {
def msgFmtCmd = "msgmerge -U ${output} ${input}"
exec {
ignoreExitValue true
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
commandLine 'cmd', '/c', msgFmtCmd
} else {
commandLine 'bash', '-c', msgFmtCmd
}
}
}
}
}
}
tasks.register("msgMergeAll") {
description "Updates the .po files from the .pot template."
group "translation"
def list = []
FileTree files = fileTree(dir: poDir)
files.visit { f ->
if (f.name.endsWith('.po')) {
def msgMergeAllTask = 'msgMerge_' + f.name - '.po' + 'Po'
list << msgMergeAllTask
}
}
dependsOn list
}
distributions {
main {
distributionBaseName = 'jgex'
contents {
into("bin") { from 'src/docs'}
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.apache.xmlgraphics:batik-anim:1.18',
'org.apache.xmlgraphics:batik-awt-util:1.18',
'org.apache.xmlgraphics:batik-bridge:1.18',
'org.apache.xmlgraphics:batik-constants:1.18',
'org.apache.xmlgraphics:batik-css:1.18',
'org.apache.xmlgraphics:batik-dom:1.18',
'org.apache.xmlgraphics:batik-ext:1.18',
'org.apache.xmlgraphics:batik-gui-util:1.18',
'org.apache.xmlgraphics:batik-gvt:1.18',
'org.apache.xmlgraphics:batik-i18n:1.18',
'org.apache.xmlgraphics:batik-parser:1.18',
'org.apache.xmlgraphics:batik-script:1.18',
'org.apache.xmlgraphics:batik-svg-dom:1.18',
'org.apache.xmlgraphics:batik-swing:1.18',
'org.apache.xmlgraphics:batik-util:1.18',
'org.apache.xmlgraphics:batik-xml:1.18',
'org.apache.xmlgraphics:xmlgraphics-commons:2.9',
'com.googlecode.gettext-commons:gettext-commons:0.9.8',
'org.graphper:graph-support:1.4.0',
'ch.qos.logback:logback-core:1.2.9',
'org.slf4j:slf4j-simple:2.0.7',
'xml-apis:xml-apis:1.4.01',
'xml-apis:xml-apis-ext:1.3.04',
'commons-cli:commons-cli:1.4'
}
application {
mainClass = applicationMainClass
}
jar {
manifest {
attributes(
'Main-Class': application.mainClass
)
}
mustRunAfter "msgFmtAll"
}
run {
mustRunAfter "msgFmtAll"
File runningDir = new File('src/docs')
workingDir = runningDir
}
javadoc {
mustRunAfter "msgFmtAll"
}
javapackager {
description = "JGEX combines dynamic geometry software, automated geometry theorem prover with a visually dynamic approach for presenting proofs."
mainClass = applicationMainClass
bundleJre = true
additionalResources = [ file ("src/docs/examples"), file ("src/docs/help"), file("src/docs/import"), file("src/docs/rules") ]
organizationName = "JGEX Contributors"
url = "https://github.com/kovzol/Java-Geometry-Expert"
organizationEmail = "[email protected]"
version = softwareVersion
fileAssociations = [
new FileAssociation(mimeType: 'application/vnd.geometry-expert', extension: 'gex', description: 'Geometry Expert File')
]
winConfig.generateMsi = false
winConfig.setupLanguages.english = "compiler:Default.isl"
// winConfig.setupLanguages.spanish = "compiler:Languages\\Spanish.isl" // TODO: Create the Spanish translation.
winConfig.setupLanguages.german = "compiler:Languages\\German.isl"
winConfig.setupLanguages.italian = "compiler:Languages\\Italian.isl"
winConfig.setupLanguages.portuguese = "compiler:Languages\\Portuguese.isl"
// See https://github.com/HeliumProject/InnoSetup/tree/master/Languages
winConfig.disableFinishedPage = false
winConfig.disableRunAfterInstall = false
linuxConfig.categories = ["Education", "Graphics", "Science"]
}
/*
* The following tasks are tests for the GProver. Seemingly, there are
* a couple of unhandled exceptions in the original codebase that are silently
* catched with error messages for now, but all of this should be checked and fixed.
*
* The first task is a command line based test, and the second one allows
* to select a file in a file chooser window, however, there is no report on success.
* TODO.
*/
task runGproverMain(type: JavaExec) {
description "A command line based test for the GProver, checking all input examples."
mustRunAfter "msgFmtAll"
classpath = sourceSets.main.runtimeClasspath
File runningDir = new File('src/docs')
workingDir = runningDir
mainClass = 'gprover.Main'
}
task runGproverMain2(type: JavaExec) {
description "A test for the GProver that allows to select a .gex file for checking."
mustRunAfter "msgFmtAll"
classpath = sourceSets.main.runtimeClasspath
File runningDir = new File('src/docs')
workingDir = runningDir
mainClass = 'gprover.Main2'
}