forked from marytts/marytts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplicationLogic.gradle
134 lines (113 loc) · 3.82 KB
/
applicationLogic.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
apply plugin: 'application'
repositories {
exclusiveContent {
forRepository {
maven {
url 'https://raw.githubusercontent.com/DFKI-MLT/Maven-Repository/main'
}
}
filter {
includeGroup 'de.dfki.lt.jtok'
}
}
}
dependencies {
runtimeOnly project(':marytts-runtime')
runtimeOnly project(':marytts-languages').subprojects
runtimeOnly project(':voice-cmu-slt-hsmm')
}
mainClassName = 'marytts.server.Mary'
run {
dependsOn installDist
// Define "mary.base"
systemProperties << ['mary.base': installDist.destinationDir]
// Forward server variables
if ("socket.addr" in System.properties) {
systemProperties << ['socket.addr': System.properties["socket.addr"]]
}
if ("socket.port" in System.properties) {
systemProperties << ['socket.port': System.properties["socket.port"]]
}
// Forward logger variables
if (logger.isEnabled(LogLevel.INFO)) {
systemProperties << ['log4j.logger.marytts': 'INFO,stderr']
}
if (logger.isEnabled(LogLevel.DEBUG)) {
systemProperties << ['log4j.logger.marytts': 'DEBUG,stderr']
}
// Override logger
if ("log4j.logger.marytts" in System.properties) {
systemProperties << ["log4j.logger.marytts": System.properties["log4j.logger.marytts"]]
}
doFirst {
classpath += fileTree(installDist.destinationDir).include('lib/voice-*.jar', 'lib/marytts-lang-*.jar')
}
}
task runInstallerGui(type: JavaExec) {
group 'Application'
description 'Runs the MaryTTS Installer GUI as a JVM application'
dependsOn installDist
classpath run.classpath
mainClass = 'marytts.tools.install.InstallerGUI'
systemProperties << ['mary.base': installDist.destinationDir]
}
distributions {
main {
contents {
from 'download', {
into 'download'
}
from 'LICENSE.md'
}
}
}
distTar {
compression = Compression.BZIP2
archiveExtension = 'tar.bz2'
}
startScripts {
applicationName = 'marytts-server'
}
task installerGuiStartScripts(type: CreateStartScripts) {
applicationName = 'marytts-component-installer'
outputDir = startScripts.outputDir
classpath = startScripts.classpath
mainClass = 'marytts.tools.install.InstallerGUI'
startScripts.finalizedBy it
}
tasks.named('distTar').configure {
dependsOn installerGuiStartScripts
}
tasks.named('distZip').configure {
dependsOn installerGuiStartScripts
}
tasks.withType(CreateStartScripts) {
group 'Distribution'
description startScripts.description
doLast {
// hack mary.base property into DEFAULT_JVM_OPTS
unixScript.text = unixScript.text.replaceAll('DEFAULT_JVM_OPTS=""', 'DEFAULT_JVM_OPTS="-Dmary.base=\\$APP_HOME"')
windowsScript.text = windowsScript.text.replaceAll('set DEFAULT_JVM_OPTS=', 'set DEFAULT_JVM_OPTS="-Dmary.base=%APP_HOME%"')
// hack classpath
unixScript.text = unixScript.text.replaceAll('-classpath "\\\$CLASSPATH"', '-classpath "\\\$APP_HOME/lib/*\"')
windowsScript.text = windowsScript.text.replaceAll('-classpath "%CLASSPATH%"', '-classpath "%APP_HOME%\\\\lib\\\\*"')
}
}
installDist {
preserve {
include 'download/*', 'installed/*', 'lib/**'
}
}
def testStartScriptsTask = tasks.register('testStartScripts') {
dependsOn tasks.withType(CreateStartScripts)
doLast {
tasks.withType(CreateStartScripts).each { startScriptTask ->
def unixScript = startScriptTask.unixScript
def lastClasspathLine = unixScript.readLines().findAll { it.contains('-classpath') }.last()
assert lastClasspathLine =~ '\\\$APP_HOME/lib/*': "$unixScript does not contain expected classpath"
}
}
}
tasks.named('check') {
dependsOn testStartScriptsTask
}