@@ -38,10 +38,7 @@ String appIdentifier = "airsquared.blobsaver.app"
3838String copyright = " Copyright (c) 2020 airsquared"
3939def os = DefaultNativePlatform . currentOperatingSystem
4040
41- startScripts. enabled = false
42- distZip. enabled = false
43- distTar. enabled = false
44- assemble. dependsOn jpackage
41+ startScripts. enabled = distZip. enabled = distTar. enabled = false
4542
4643repositories {
4744 mavenCentral()
@@ -105,14 +102,21 @@ jlink {
105102 noConsole = true
106103 }
107104 jpackage {
105+ icon = " ${ projectDir} /${ icon} "
106+ imageOptions = [ ' --copyright' , copyright, ' --vendor' , ' airsquared' ]
107+
108108 if (os. isMacOsX()) {
109109 installerType = " dmg"
110+ imageOptions. addAll ' --mac-package-identifier' , appIdentifier
110111 icon = " dist/macos/Contents/Resources/blob.icns"
111- } else if (os. isWindows()) icon = " dist/windows/blob.ico"
112- else icon = " src/main/resources/airsquared/blobsaver/app/blob_emoji.png"
113-
114- icon = " ${ projectDir} /${ icon} "
115- imageOptions = [ ' --copyright' , copyright]
112+ } else if (os. isWindows()) {
113+ installerOptions. addAll ' --win-dir-chooser' , ' --win-menu' , ' --win-shortcut'
114+ icon = " dist/windows/blob.ico"
115+ } else {
116+ installerOptions. addAll ' --linux-shortcut' , ' --linux-menu-group' , ' Utility;Archiving;Java' ,
117+ ' --linux-rpm-license-type' , ' GPLv3'
118+ icon = " src/main/resources/airsquared/blobsaver/app/blob_emoji.png"
119+ }
116120 }
117121 if (os. isMacOsX()) jpackageImage. doLast {
118122 copy {
@@ -125,44 +129,32 @@ jlink {
125129 from " ${ projectDir} /LICENSE" , " ${ projectDir} /libraries_used.txt"
126130 into " ${ buildDir} /jpackage/blobsaver.app/Contents/Resources"
127131 }
128- }
129-
130- /* Need to figure out how to exclude the following unnecessary files/directories: "about.fxml", "about.css",
131- "aix-ppc/*", "aix-ppc64/*", "linux-ppc/*", "linux-ppc64le/*", "linux-s390x/*", "linux-mips64el/*",
132- "darwin/*", "win32-x86/*", "win32-x86-64/*", "openbsd-x86/*", "openbsd-x86-64/*", "freebsd-x86/*",
133- "freebsd-x86-64/*", "sunos-sparc/*", "sunos-sparcv9/*", "sunos-x86/*", "sunos-x86-64/*"
134- */
135- }
136-
137- // if your platform isn't Windows, wine is required to run this task
138- task createWindowsInstaller () {
139- inputs. dir(" ${ projectDir} /dist/windows/" )
140- inputs. file(" ${ buildDir} /launch4j/blobsaver.exe" )
141- outputs. file(" ${ buildDir} /distributions/blobsaver-windows.exe" )
142-
143- doFirst {
144- delete " ${ buildDir} /tmp/innosetup"
132+ } else if (os. isWindows()) jpackageImage. doLast {
145133 copy {
146- from " ${ projectDir} /dist/windows" into " ${ buildDir} /tmp/innosetup "
134+ from " ${ projectDir} /dist/windows/files " from " ${ buildDir} /jpackage/blobsaver/runtime/bin/zip.dll "
147135 rename " LICENSE_windows" , " LICENSE"
148136 rename " libraries_used_windows.txt" , " libraries_used.txt"
137+ into " ${ buildDir} /jpackage/blobsaver"
149138 }
139+ } else jpackageImage. doLast {
150140 copy {
151- from " ${ projectDir} /dist/windows/blobsaver.iss" into " ${ buildDir} /tmp/innosetup"
152- filter(ReplaceTokens , tokens : [AppName : project. name, AppVersion : version, AppCopyright : copyright, AppMutex : appIdentifier])
141+ from " ${ projectDir} /dist/linux" into " ${ buildDir} /jpackage/blobsaver/lib"
153142 }
143+ }
144+
145+ }
146+
147+ task windowsInstaller (dependsOn : jpackageImage) { // requires inno setup to be installed
148+ doFirst {
154149 copy {
155- from " ${ buildDir} /launch4j/blobsaver.exe" into " ${ buildDir} /tmp/innosetup/files"
150+ from " ${ projectDir} /dist/windows/blobsaver.iss" into " ${ buildDir} /jpackage"
151+ filter(ReplaceTokens , tokens : [AppName : project. name, AppVersion : version, AppCopyright : copyright, AppMutex : appIdentifier])
156152 }
157- mkdir " ${ buildDir} /distributions/"
158- println " running Inno Setup Compiler"
159153 exec {
160- workingDir = projectDir
161- if (os. isWindows()) {
162- commandLine " gradle\\ InnoSetup6\\ ISCC.exe" , " /Qp" , " ${ buildDir} \\ tmp\\ innosetup\\ blobsaver.iss"
163- } else {
164- commandLine " wine" , " gradle/InnoSetup6/ISCC.exe" , " /Qp" , " ${ buildDir} /tmp/innosetup/blobsaver.iss"
165- }
154+ commandLine " iscc" , " /Qp" , " ${ buildDir} \\ jpackage\\ blobsaver.iss"
166155 }
156+ delete " ${ buildDir} /jpackage/blobsaver.iss"
167157 }
168158}
159+
160+ assemble. dependsOn os. isWindows() ? windowsInstaller : jpackage
0 commit comments