-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
119 lines (105 loc) · 4.14 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
plugins {
id 'org.beryx.runtime'
id 'com.google.osdetector'
}
configurations {
assembly
}
def dist = tasks.register('distribution', Zip) {
group = "distribution"
archiveBaseName = "grafikon"
archiveVersion = scmVersion.shortVersion
destinationDirectory = file("${layout.buildDirectory}/dist")
from configurations.assembly
from file("${projectDir}/src/main/deployment/scripts")
rename "grafikon-start.*", "grafikon.jar"
}
tasks.register('unzippedDistribution', Sync) {
group = "distribution"
dependsOn dist
from zipTree(dist.get().archiveFile)
into "${layout.buildDirectory}/unzipped-dist"
}
tasks.register('jpackageImageZip', Zip) {
group = "distribution"
archiveBaseName = "grafikon"
archiveVersion = scmVersion.shortVersion
archiveClassifier = osdetector.classifier
destinationDirectory = file("${layout.buildDirectory}/jpackage-zip")
dependsOn tasks.named('jpackageImage')
dependsOn tasks.named('jpackage')
from file("${layout.buildDirectory}/jpackage/" + (osdetector.os == "osx" ? "grafikon.app" : "grafikon"))
}
ext {
gMainClass = 'net.parostroj.timetable.gui.Main'
}
tasks.register('runMain', JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass = gMainClass
group = "application"
description = "Runs application"
}
dependencies {
assembly project
implementation project(':grafikon-gui')
implementation project(':grafikon-save')
implementation project(':grafikon-templates')
runtimeOnly project(':grafikon-ls')
runtimeOnly project(':grafikon-ls4')
implementation 'org.apache.logging.log4j:log4j-slf4j2-impl'
implementation 'org.apache.logging.log4j:log4j-core'
implementation 'org.glassfish.jaxb:jaxb-runtime'
}
tasks.named('jar').configure {
manifest {
attributes(
'Main-Class': gMainClass,
'Class-Path': configurations.runtimeClasspath.files.collect { file -> file.name }.join(' '),
'SplashScreen-Image': 'images/splashscreen.png'
)
}
}
application {
mainClass = gMainClass
applicationName = 'grafikon'
}
tasks.named('distZip').configure { enabled = false }
tasks.named('distTar').configure { enabled = false }
runtime {
options = ['--strip-debug', '--compress', 'zip-6', '--no-header-files', '--no-man-pages']
modules = ['java.xml', 'java.desktop', 'java.logging', 'java.scripting', 'java.management',
'jdk.xml.dom', 'java.naming', 'jdk.zipfs', 'jdk.localedata', 'java.compiler', 'jdk.crypto.ec']
imageDir = file("${layout.buildDirectory}/grafikon-image")
imageZip = file("${layout.buildDirectory}/image-zip/grafikon-image-${scmVersion.shortVersion}-${osdetector.classifier}.zip")
launcher {
noConsole = true
}
jpackage {
imageName = 'grafikon'
installerName = 'grafikon'
def commonOptions = ['--copyright', "(c) ${scmVersion.year} jub", '--vendor', 'www.parostroj.net',
'--description', 'Train diagram editor']
installerOptions = commonOptions
imageOptions = commonOptions
if (osdetector.os == 'windows') {
appVersion = project.findProperty('appVersion') ?: scmVersion.baseVersion
installerOptions += ['--win-dir-chooser', '--win-menu', '--win-menu-group', '',
'--win-upgrade-uuid', '2318a3ac-b334-4978-90d1-987da0d4379f',
'--file-associations', 'src/main/deployment/resources/win-associations.properties']
imageOptions += ['--icon', 'src/main/deployment/icons/grafikon.ico']
installerType = project.findProperty('installerType') ?: 'msi'
} else if (osdetector.os == 'linux') {
appVersion = project.findProperty('appVersion') ?: scmVersion.shortVersion
installerOptions += ['--linux-shortcut', '--resource-dir', 'src/main/deployment/linux-resources',
'--file-associations', 'src/main/deployment/resources/linux-associations.properties']
imageOptions += ['--icon', 'src/main/deployment/icons/grafikon.png']
installerType = project.findProperty('installerType') ?: 'deb'
} else if (osdetector.os == "osx") {
appVersion = project.findProperty('appVersion') ?: scmVersion.baseVersion
installerOptions += ['--mac-package-name', 'Grafikon',
'--file-associations', 'src/main/deployment/resources/mac-associations.properties']
imageOptions += ['--icon', 'src/main/deployment/icons/grafikon.icns']
installerType = project.findProperty('installerType') ?: 'dmg'
}
}
}