forked from mediathekview/MServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
272 lines (234 loc) · 7.77 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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
import java.nio.file.Files
plugins {
id 'application'
id 'com.github.jk1.dependency-license-report' version "2.0"
id "org.sonarqube" version "3.4.0.2513"
id 'org.openjfx.javafxplugin' version '0.0.13'
}
repositories {
mavenLocal()
// Use Maven Central for resolving dependencies.
mavenCentral()
}
application {
// Define the main class for the application.
mainClass = 'mServer.Main'
}
javafx {
version = "19"
modules = [ 'javafx.base', 'javafx.controls', 'javafx.fxml', 'javafx.graphics', 'javafx.media' ]
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
group = 'de.mediathekview'
archivesBaseName = "MServer"
version = '3.1.229'
def jarName = 'MServer.jar'
def mainClass = 'mServer.Main'
dependencies {
implementation 'de.mediathekview:MLib:3.0.13'
implementation 'commons-net:commons-net:3.9.0'
implementation 'org.apache.commons:commons-compress:1.22'
implementation 'org.apache.commons:commons-text:1.10.0'
implementation 'org.tukaani:xz:1.9'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'org.glassfish.jersey.core:jersey-client:3.0.8'
implementation 'org.glassfish.jersey.inject:jersey-hk2:3.0.8'
implementation 'org.jsoup:jsoup:1.15.4'
implementation 'javax.activation:activation:1.1.1'
implementation 'com.google.guava:guava:31.1-jre'
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
implementation 'fm.void.jetm:jetm:1.2.3'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:4.11.0'
testImplementation 'com.squareup.okhttp3:mockwebserver:4.10.0'
testImplementation "org.hamcrest:hamcrest-all:1.3"
testImplementation 'org.assertj:assertj-core:3.23.1'
}
sourceSets {
developTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/test/developTest/java')
}
resources.srcDir file('src/test/developTest/resources')
}
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/test/integrationTest/java')
}
resources.srcDir file('src/test/integrationTest/resources')
}
performanceTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/test/performanceTest/java')
}
resources.srcDir file('src/test/performanceTest/resources')
}
}
configurations {
deployerJars
developTestImplementation.extendsFrom testImplementation
developTestRuntime.extendsFrom testRuntime
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntime.extendsFrom testRuntime
performanceTestImplementation.extendsFrom testImplementation
performanceTestRuntime.extendsFrom testRuntime
}
test {
}
task developTest(type: Test) {
testClassesDirs = sourceSets.developTest.output.classesDirs
classpath = sourceSets.developTest.runtimeClasspath
outputs.upToDateWhen { false }
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
}
task integrationTest(type: Test) {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false }
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
}
task performanceTest(type: Test) {
logger.info("hier")
testClassesDirs = sourceSets.performanceTest.output.classesDirs
classpath = sourceSets.performanceTest.runtimeClasspath
outputs.upToDateWhen { false }
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
}
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}
ext {
propsFile = file('src/main/resources/version.properties').absoluteFile
if (!propsFile.exists()) {
Files.createFile(propsFile.toPath())
}
}
def loadVersionProperties() {
Properties props = new Properties()
props.load(propsFile.newDataInputStream())
return props
}
task updateVersion {
doLast {
Properties props = loadVersionProperties()
def oldVersion = props.getProperty('VERSION')
String buildDate = new Date().format('dd.MM.yyyy HH:mm:ss')
if (oldVersion != project.version) {
logger.lifecycle "==mserver======================"
logger.lifecycle "Version: $project.version"
logger.lifecycle "Baudatum: $buildDate"
logger.lifecycle "==mserver======================"
props.setProperty('VERSION', project.version)
props.setProperty('DATE', buildDate)
props.store(propsFile.newWriter(), null)
}
}
}
processResources.dependsOn updateVersion
licenseReport {
outputDir = rootProject.projectDir.toPath().resolve("build/Copyright/").toString()
excludes = [':MSearch', 'MediathekView:MLib']
configurations = ['compile']
}
processResources.dependsOn generateLicenseReport
[distZip, distTar]*.shouldRunAfter compileJava, updateVersion, jar
distTar.compression = Compression.GZIP
distTar.extension = 'tar.gz'
jar {
manifest {
attributes(
'Main-Class': mainClass,
'Class-Path': configurations.compileClasspath.files.collect { "lib/$it.name" }.join(' ')
)
}
archiveName = jarName
}
distributions {
main {
contents {
from('dist') {
filesMatching('**/*.sh') {
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [JARNAME: jarName])
}
filesMatching('**/*.txt') {
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [JARNAME: jarName])
}
filesMatching('**/*.command') {
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [JARNAME: jarName])
}
}
from('build/libs') {
include '*.jar'
}
from('build') {
include 'Copyright/*'
}
}
}
}
/**
* This is how you pass arguments: "./gradlew start -Pargs=arg1,arg2,arg3
*/
task start(type: JavaExec, dependsOn: classes) {
main = mainClass
classpath = sourceSets.main.runtimeClasspath
if (project.hasProperty('args')) {
args(project.args.split(','))
}
}
/**
* HOWTO debug:
* 1. run "gradle debug"
* 2. Call your IDE to connect to a remote java application on port 5005.
*
* This is how you pass arguments: "./gradlew debug -Pargs=arg1,arg2,arg3
*/
task debug(type: JavaExec, dependsOn: classes) {
main = mainClass
classpath = sourceSets.main.runtimeClasspath
debug true
if (project.hasProperty('args')) {
args(project.args.split(','))
}
}
/**
* <b>You don't have to call this. Travis will do it for you if a new releass (tag) will be build!<b/>
* Call this so: './gradlew build release -PrepoPw=[PASSWORD]'
*/
task release(dependsOn: 'uploadArchives') {
doLast {
println 'Released Version ' + version
}
}
/**
* <b>You don't have to call this. Travis will do it for you if you push to develop!<b/>
* Call this so: './gradlew build releaseSnapshot -PrepoPw=[PASSWORD]'
*/
task releaseSnapshot(dependsOn: 'uploadArchives') {
doLast {
println 'Released Snapshot Version ' + version
}
}
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(releaseSnapshot)) {
version = version + '-SNAPSHOT'
}
}
sonarqube {
properties {
property "sonar.projectKey", "mediathekview_MServer"
}
}