1
+ plugins {
2
+ id ' application'
3
+ id ' org.openjfx.javafxplugin' version ' 0.0.13'
4
+ id ' org.beryx.jlink' version ' 2.25.0'
5
+ id ' com.github.node-gradle.node' version ' 3.3.0'
6
+ }
7
+
8
+ group ' eu.mihosoft.vmf'
9
+ version ' 1.0.0-SNAPSHOT'
10
+
11
+ // installer version (used for jlink/jpackge)
12
+ // parse version with three '.' separated numbers from full version string
13
+ def installerVersionList = version. tokenize(' .' )
14
+ def majorVersion = installerVersionList[0 ]
15
+ def minorVersion = installerVersionList[1 ]
16
+ // parse leading integer from patch version string (remove the rest)
17
+ def patchVersion = ((Number )java.text.NumberFormat . getInstance(). parse(installerVersionList[2 ])). intValue()
18
+
19
+ def installerVersionStr = " ${ majorVersion} .${ minorVersion} .${ patchVersion} "
20
+ def appName = " VMFEdit"
21
+
22
+ repositories {
23
+ mavenCentral()
24
+ }
25
+
26
+ ext {
27
+ junitVersion = ' 5.8.2'
28
+ }
29
+
30
+ sourceCompatibility = ' 17'
31
+ targetCompatibility = ' 17'
32
+
33
+ tasks. withType(JavaCompile ) {
34
+ options. encoding = ' UTF-8'
35
+ }
36
+
37
+ application {
38
+ mainModule = ' eu.mihosoft.vmf.vmfedit'
39
+ mainClass = ' eu.mihosoft.vmf.vmfedit.JsonEditorApplication'
40
+ }
41
+
42
+ javafx {
43
+ version = ' 17.0.2'
44
+ modules = [' javafx.controls' , ' javafx.fxml' , ' javafx.web' ]
45
+ }
46
+
47
+ dependencies {
48
+ implementation(' org.controlsfx:controlsfx:11.1.1' )
49
+
50
+ testImplementation(" org.junit.jupiter:junit-jupiter-api:${ junitVersion} " )
51
+ testRuntimeOnly(" org.junit.jupiter:junit-jupiter-engine:${ junitVersion} " )
52
+ }
53
+
54
+ test {
55
+ useJUnitPlatform()
56
+ }
57
+
58
+ ext. os = org.gradle.internal.os.OperatingSystem . current()
59
+ jlink {
60
+ version = installerVersionStr
61
+ imageZip = project. file(" ${ buildDir} /distributions/app-${ javafx.platform.classifier} .zip" )
62
+ options = [' --strip-debug' , " --compress=zip-6" , ' --no-header-files' , ' --no-man-pages' ]
63
+ launcher {
64
+ name = appName
65
+ }
66
+ jpackage {
67
+ if (os. windows) {
68
+ installerType = ' msi'
69
+ installerOptions = [' --win-per-user-install' , ' --win-menu' ]
70
+ }
71
+ }
72
+ }
73
+
74
+
75
+
76
+ jlinkZip {
77
+ group = ' distribution'
78
+ }
79
+
80
+ node {
81
+ version = ' 16.13.1'
82
+ download = true
83
+ }
84
+
85
+ task installJsonEditor (type : NpmTask ) {
86
+ args
= [
' install' ,
' @json-editor/[email protected] ' ]
87
+ }
88
+
89
+ task copyJsonEditorToResources (type : Copy ) {
90
+ from ' node_modules/@json-editor/json-editor/dist'
91
+ into ' src/main/resources/json-editor'
92
+ include ' **/*'
93
+ }
94
+
95
+ task installFontAwesome (type : NpmTask ) {
96
+ args
= [
' install' ,
' @fortawesome/[email protected] ' ]
97
+ }
98
+
99
+ task copyFontAwesomeToResources (type : Copy ) {
100
+ from ' node_modules/@fortawesome/fontawesome-free/'
101
+ into ' src/main/resources/eu/mihosoft/vmf/vmfedit/fontawesome-free'
102
+ include ' **/*'
103
+ }
104
+
105
+ task installBootStrap (type : NpmTask ) {
106
+ args
= [
' install' ,
' [email protected] ' ]
107
+ }
108
+
109
+ task copyBootStrapToResources (type : Copy ) {
110
+ from ' node_modules/bootstrap/dist'
111
+ into ' src/main/resources/eu/mihosoft/vmf/vmfedit/bootstrap'
112
+ include ' **/*'
113
+ }
114
+
115
+
116
+ copyJsonEditorToResources. dependsOn installJsonEditor
117
+ processResources. dependsOn copyJsonEditorToResources
118
+
119
+ copyFontAwesomeToResources. dependsOn installFontAwesome
120
+ processResources. dependsOn copyFontAwesomeToResources
121
+
122
+ copyBootStrapToResources. dependsOn installBootStrap
123
+ processResources. dependsOn copyBootStrapToResources
0 commit comments