forked from mediathekview/MediathekView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
288 lines (246 loc) · 7.74 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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
import org.apache.tools.ant.filters.ReplaceTokens
import java.nio.file.Files
plugins {
id "com.github.jk1.dependency-license-report" version "0.3.5"
id 'edu.sc.seis.launch4j' version '2.0.1'
}
apply plugin: 'java'
apply plugin: 'distribution'
apply plugin: 'maven'
apply from: "${project.rootDir}/gradle/eclipse.gradle"
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'de.mediathekview'
version = '13.0.1'
def jarName = 'MediathekView.jar'
def mainClass = 'mediathek.Main'
ext {
swingxVersion = '1.6.6-SNAPSHOT'
swingxGroup = ''
propsFile = file('src/main/resources/version.properties').absoluteFile
if (!propsFile.exists()) {
Files.createFile(propsFile.toPath())
}
repoZugangFile = file('scripte/deploy/RepoZugang.properties').absoluteFile
if (!repoZugangFile.exists()) {
Files.createFile(repoZugangFile.toPath())
}
}
def loadVersionProperties() {
Properties props = new Properties()
props.load(propsFile.newDataInputStream())
return props
}
def loadRepoZugangProperties() {
Properties props = new Properties()
props.load(repoZugangFile.newDataInputStream())
return props
}
compileJava {
options.compilerArgs = ['-Xlint:all']
}
compileTestJava {
options.compilerArgs = ['-Xlint:all']
}
repositories {
maven {
url "https://repo.mediathekview.de/repository/maven-public/"
}
flatDir {
dirs 'libs'
}
}
dependencies {
compile 'de.mediathekview:MSearch:2.1.1'
compile "$swingxGroup:swingx-action:$swingxVersion"
compile "$swingxGroup:swingx-autocomplete:$swingxVersion"
compile "$swingxGroup:swingx-beaninfo:$swingxVersion"
compile "$swingxGroup:swingx-common:$swingxVersion"
compile "$swingxGroup:swingx-core:$swingxVersion"
compile "$swingxGroup:swingx-graphics:$swingxVersion"
compile "$swingxGroup:swingx-painters:$swingxVersion"
compile "$swingxGroup:swingx-plaf:$swingxVersion"
compile 'org.apache.commons:commons-lang3:3.5'
compile 'com.fasterxml.jackson.core:jackson-core:2.7.0'
compile 'com.jidesoft:jide-oss:3.6.16'
compile 'org.tukaani:xz:1.5'
compile 'com.jgoodies:jgoodies-forms:1.9.0'
compile 'net.sf.jchart2d:jchart2d:3.3.2'
compileOnly 'com.yuvimasory:orange-extensions:1.3.0'
}
uploadArchives {
repositories.mavenDeployer {
Properties props = loadRepoZugangProperties()
def nexusUser = props.getProperty('repoUser')
def nexusPw = props.getProperty('repoPw')
repository(url: "https://repo.mediathekview.de/repository/maven-releases/") {
authentication(userName: nexusUser, password: nexusPw)
}
snapshotRepository(url: "https://repo.mediathekview.de/repository/maven-snapshots/") {
authentication(userName: nexusUser, password: nexusPw)
}
}
}
build.dependsOn(install)
task updateVersion << {
Properties props = loadVersionProperties()
def oldVersion = props.getProperty('VERSION')
if (!oldVersion.equals(project.version)) {
logger.lifecycle "==msearch======================"
logger.lifecycle "Version: $project.version"
logger.lifecycle "==msearch======================"
props.setProperty('VERSION', project.version)
props.store(propsFile.newWriter(), null)
}
}
processResources.dependsOn updateVersion
/*
licenseReport {
outputDir = "res/Copyright/"
excludes = [':MSearch', 'MediathekView:MSearch']
configurations = ['compile']
}
processResources.dependsOn generateLicenseReport
*/
tasks.withType(Zip) { task ->
task.doLast {
ant.checksum(algorithm: 'SHA-1', file: it.archivePath)
}
}
tasks.withType(Tar) { task ->
task.doLast {
ant.checksum(algorithm: 'SHA-1', file: it.archivePath)
}
}
task copyProgrammIconsInRes(type: Copy) {
logger.lifecycle 'Copying Programm icons.'
from 'src/main/resources/mediathek/res/programm'
into 'res/Icons/Programm/Version-' + version
include '*.png'
exclude 'about'
}
processResources.dependsOn copyProgrammIconsInRes
task copySenderIconsInRes(type: Copy) {
logger.lifecycle 'Copying Sender icons.'
from 'src/main/resources/mediathek/res/sender'
into 'res/Icons/Sender'
include '*.png'
exclude '*.xcv'
}
processResources.dependsOn copySenderIconsInRes
[distZip, distTar]*.shouldRunAfter compileJava, updateVersion, jar
jar {
manifest {
attributes(
'SplashScreen-Image': 'mediathek/res/splash.png',
'Main-Class': mainClass,
'Class-Path': configurations.runtime.files.collect { "lib/$it.name" }.join(' ')
)
}
archiveName = jarName
}
distributions {
main {
baseName = 'MediathekView'
contents {
into('lib') {
from configurations.compile
}
from('res') {
filesMatching('**/*.sh') {
filter(ReplaceTokens, tokens: [JARNAME: jarName])
}
filesMatching('**/*.txt') {
filter(ReplaceTokens, tokens: [JARNAME: jarName])
}
filesMatching('**/*.command') {
filter(ReplaceTokens, tokens: [JARNAME: jarName])
}
}
from('build/libs') {
include '*.jar'
}
from('build/launch4j') {
include '*.exe'
exclude 'lib'
}
}
}
}
//Windows executable generation
launch4j {
mainClassName = mainClass
icon = "../../res/Info/MediathekView.ico"
jar = jarName
dontWrapJar = true
outfile = "MediathekView_ohne_feste_Speicherzuweisung.exe"
}
task creatMitSpeicherExe(type: edu.sc.seis.launch4j.tasks.Launch4jLibraryTask) {
outfile = "MediathekView.exe"
initialHeapSize = 256
maxHeapSize = 2048
maxHeapPercent = 80
}
task createIpv4Exe(type: edu.sc.seis.launch4j.tasks.Launch4jLibraryTask) {
outfile = "MediathekView_ipv4.exe"
opt = "-Djava.net.preferIPv4Stack=true"
initialHeapSize = 256
maxHeapSize = 2048
maxHeapPercent = 80
}
task createPortableExe(type: edu.sc.seis.launch4j.tasks.Launch4jLibraryTask) {
outfile = "MediathekView_Portable.exe"
cmdLine = "Einstellungen/.mediathek3"
initialHeapSize = 256
maxHeapSize = 2048
maxHeapPercent = 80
}
assemble.dependsOn createAllExecutables
/**
* This is how you pass arguments: "./gradlew run -Pargs=arg1,arg2,arg3
*/
task run(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 -PnexusUser=[NEXUS_USER] -PnexusPw=[NEXUS_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 -PnexusUser=[NEXUS_USER] -PnexusPw=[NEXUS_PASSWORD]'
*/
task releaseSnapshot(dependsOn: 'uploadArchives') {
doLast {
println 'Released Snapshot Version '+version
}
}
gradle.taskGraph.whenReady {taskGraph ->
if (taskGraph.hasTask(releaseSnapshot)) {
version = version+'-SNAPSHOT'
}
}