-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.gradle
More file actions
164 lines (146 loc) · 5.09 KB
/
build.gradle
File metadata and controls
164 lines (146 loc) · 5.09 KB
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
import java.time.LocalDate
/*
* This file was generated by the Gradle 'init' task.
*/
plugins {
id 'java'
id 'java-library'
id 'maven-publish'
id 'application'
id 'org.javamodularity.moduleplugin' version '1.8.15'
id 'org.openjfx.javafxplugin' version '0.1.0'
id 'org.beryx.jlink' version '3.0.1'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'net.harawata:appdirs:1.4.0'
implementation 'com.google.code.gson:gson:2.13.1'
implementation 'org.apache.commons:commons-lang3:3.18.0'
implementation 'commons-io:commons-io:2.20.0'
implementation 'org.apache.maven.plugins:maven-compiler-plugin:3.14.0'
implementation 'org.tinylog:tinylog-api:2.7.0'
implementation 'org.tinylog:tinylog-impl:2.7.0'
implementation 'io.github.mkpaz:atlantafx-base:2.1.0'
implementation 'org.kordamp.ikonli:ikonli-core:12.4.0'
implementation 'org.kordamp.ikonli:ikonli-javafx:12.4.0'
implementation 'org.kordamp.ikonli:ikonli-materialdesign2-pack:12.4.0'
implementation 'org.kordamp.ikonli:ikonli-fontawesome5-pack:12.4.0'
}
javafx {
version = "23.0.2"
modules = ['javafx.controls', 'javafx.fxml', 'javafx.fxml', 'javafx.web']
}
version = '1.0.0'
description = 'MyApp'
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
application {
mainClass = 'myapp.App'
mainModule = 'myapp'
}
run {
jvmArgs = []
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
}
jlink {
addOptions('--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages')
addExtraDependencies("javafx")
launcher {
name = 'MyApp'
jvmArgs = []
}
jpackage { //not to be called without Params
installerOptions = [
'--description', project.description,
'--copyright', 'Copyrigth 2023-' + getCurrentYear() + ' www.myapp.com'
]
installerType = project.findProperty('installerType')
// we will pass this from the command line (example: -PinstallerType=exe)
if (installerType == 'exe') {
imageOptions += ['--icon', 'src/main/resources/myapp/icon.ico']
installerOptions += [
'--win-dir-chooser',
'--win-menu',
'--win-shortcut'
]
}
if (installerType == 'msi') {
imageOptions += ['--icon', 'src/main/resources/myapp/icon.ico']
installerOptions += [
'--win-per-user-install', '--win-dir-chooser',
'--win-menu', '--win-shortcut'
]
}
if (installerType == 'pkg') {
imageOptions += ['--icon', 'src/main/resources/myapp/icon.ico']
}
// apt-get install binutils
// apt-get install fakeroot
if (installerType == 'deb' || installerType == 'rpm') {
imageOptions += ['--icon', 'src/main/resources/myapp/icon.png']
installerOptions += [
'--linux-menu-group', 'Office',
'--linux-shortcut',
'--resource-dir', "build/jpackage/MyApp/lib",
'--description', project.description,
'--app-version', version
]
}
if (installerType == 'deb') {
installerOptions += [
'--linux-deb-maintainer', 'contact@myapp.fr'
]
}
if (installerType == 'rpm') {
installerOptions += [
'--linux-menu-group', 'Office',
'--linux-shortcut',
'--resource-dir', "build/jpackage/MyApp/lib",
'--description', project.description,
'--app-version', version,
'--linux-deb-maintainer', 'contact@myapp.fr'
]
}
if (installerType == 'dmg') {//https://codetinkering.com/how-to-use-jpackage-tool-cli-for-macos-apps/
imageOptions += ['--icon', 'src/main/resources/myapp/icon.icns']
installerOptions += [
'--name', 'MyApp',
'--description', project.description,
'--app-version', version,
'--verbose'
]
}
}
}
tasks.register('buildExeForWindows', GradleBuild) {
group = "release"
startParameter.projectProperties = ['installerType':'exe']
tasks = ['jpackage']
}
tasks.register('buildMsiForWindows', GradleBuild) {
group = "release"
startParameter.projectProperties = ['installerType':'msi']
tasks = ['jpackage']
}
tasks.register('buildDebForLinux', GradleBuild) {
group = "release"
startParameter.projectProperties = ['installerType':'deb']
tasks = ['jpackage']
}
tasks.register('buildRpmForLinux', GradleBuild) {
group = "release"
startParameter.projectProperties = ['installerType':'rpm']
tasks = ['jpackage']
}
tasks.register('buildDmgForMacOS', GradleBuild) {
group = "release"
startParameter.projectProperties = ['installerType':'dmg']
tasks = ['jpackage']
}
static def getCurrentYear() {
return LocalDate.now().format("yyyy")
}