-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
120 lines (97 loc) · 3.34 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
plugins {
// Just a normal application id, nothing to see here
id 'application'
// jlink/jpackage plugins are always nice
id 'org.beryx.jlink' version '2.25.0'
}
group('org.lucasstarsz')
version('0.2.1')
// Build
def currentOs = org.gradle.internal.os.OperatingSystem.current()
java {
modularity.inferModulePath.set(true)
}
application {
mainModule.set('Compose.main')
mainClass.set('org.lucasstarsz.composeapp.core.ComposeApp')
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.fxmisc.richtext:richtextfx:0.10.9'
implementation 'org.fxmisc.undo:undofx:2.1.1'
implementation 'org.fxmisc.flowless:flowless:0.6.9'
// since gradle 6.6, we grab dependencies straight from the source
def platform = (currentOs.windows ? 'win' : currentOs.linux ? 'linux' : currentOs.macOsX ? 'mac' : '')
implementation "org.openjfx:javafx-base:17:${platform}"
implementation "org.openjfx:javafx-controls:17:${platform}"
implementation "org.openjfx:javafx-graphics:17:${platform}"
implementation "org.openjfx:javafx-fxml:17:${platform}"
}
// Testing
// TODO: add tests for utility methods
test {
useJUnitPlatform()
}
// Packaging & Distribution
boolean usingSnapshot = false
def snapshotVersion = "SNAPSHOT"
def distributionName = "Compose Text Editor${usingSnapshot ? "-$snapshotVersion" : ""}"
jlink {
addExtraDependencies("javafx")
options.addAll('--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages')
launcher {
name = distributionName
noConsole = true
}
jpackage {
// cross-platform options
jvmArgs += ['-XX:+CreateCoredumpOnCrash', '-XX:+UseZGC']
installerOptions += [
'--description', 'A clean, simple text editor.',
'--vendor', 'Andrew Dey',
'--copyright', 'Copyright© 2020-2022 Andrew Dey',
'--license-file', 'LICENSE.txt',
'--file-associations', 'src/main/resources/extensions/ext_txt.properties',
'--file-associations', 'src/main/resources/extensions/ext_text.properties',
'--app-version', project.version
]
// platform-specific options
def iconPath = 'src/main/resources/icons/compose'
if (currentOs.windows) {
installerType = "msi"
icon = "${iconPath}_ico.ico"
installerOptions += [
'--win-per-user-install',
'--install-dir', distributionName,
'--win-dir-chooser',
'--win-shortcut',
'--win-menu', '--win-menu-group', 'Compose Text Editor'
]
} else if (currentOs.linux) {
installerType = "deb"
icon = "${iconPath}_png.png"
installerOptions += [
'--linux-menu-group', 'Office',
'--linux-shortcut',
'--linux-deb-maintainer', '[email protected]'
]
} else if (currentOs.macOsX) {
installerType = "pkg"
icon = "${iconPath}_icns.icns"
installerOptions += [
'--mac-package-name', 'Compose'
]
}
}
}
// Java 17 is a must!
compileJava {
options.release.set(17)
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}