@@ -51,23 +51,58 @@ jar {
5151 manifest {
5252 attributes ' Main-Class' : ' com.airsquared.blobsaver.Main'
5353 }
54+ jar. finalizedBy shadowJar // make shadowJar always overwrite the jar task
5455}
5556
5657shadowJar {
5758 archiveClassifier. set(null ) // remove '-all' suffix
58- from " LICENSE"
59- assemble. mustRunAfter shadowJar
59+ // the jna libraries are bundled separately to reduce application size
60+ exclude " about.fxml" , " about.css" ,
61+ " **/aix-ppc/*" , " **/aix-ppc64/*" , " **/linux-ppc/*" , " **/linux-ppc64le/*" , " **/linux-s390x/*" , " **/linux-mips64el/*" ,
62+ " **/darwin/*" , " **/win32-x86/*" , " **/win32-x86-64/*" , " **/openbsd-x86/*" , " **/openbsd-x86-64/*" ,
63+ " **/freebsd-x86/*" , " **/freebsd-x86-64/*" , " **/sunos-sparc/*" , " **/sunos-sparcv9/*" , " **/sunos-x86/*" , " **/sunos-x86-64/*"
64+ includeEmptyDirs = false
65+ jar. group = " other"
6066}
6167
6268macAppBundle {
6369 mainClassName = " com.airsquared.blobsaver.Main"
64- // bundleJRE = true
6570 icon = " icons/blob_emoji.icns"
6671 backgroundImage = " icons/dmg_background.png"
6772 appName = ' blobsaver'
6873 dmgName = ' blobsaver-macos'
6974 volumeName = ' blobsaver-macos'
75+ jarTask = " shadowJar"
7076 bundleExtras. put(" LSUIElement" , " YES" )
77+ createDmg. group = " build"
78+ }
79+
80+ task copyFilesIntoMacApp (dependsOn : createApp) {
81+ doFirst {
82+ copy {
83+ from " ${ projectDir} /dist/macos/Frameworks"
84+ into " ${ buildDir} /macApp/blobsaver.app/Contents/Frameworks"
85+ }
86+ copy {
87+ from " ${ projectDir} /dist/macos/tsschecker"
88+ into " ${ buildDir} /macApp/blobsaver.app/Contents/MacOS"
89+ }
90+ copy {
91+ from " ${ projectDir} /LICENSE" , " ${ projectDir} /libraries_used.txt"
92+ into " ${ buildDir} /macApp/blobsaver.app/Contents/Resources"
93+ }
94+ }
95+ createApp. finalizedBy copyFilesIntoMacApp
96+ group = " macappbundle"
97+ }
98+
99+ task createLinuxTargz (type : Tar , dependsOn : shadowJar) {
100+ archiveFileName = " blobsaver-linux.tar.gz"
101+ destinationDirectory = file(" ${ buildDir} /distributions/" )
102+ from " ${ buildDir} /libs/blobsaver.jar" , " ${ projectDir} /dist/linux/"
103+
104+ assemble. dependsOn createLinuxTargz
105+ group = " build"
71106}
72107
73108launch4j { // Windows only, don't use this, use createWindowsInstaller
@@ -77,23 +112,35 @@ launch4j { // Windows only, don't use this, use createWindowsInstaller
77112 icon = " ${ projectDir} /icons/blob_emoji.ico"
78113 jreMinVersion = " 1.8.0"
79114 jreMaxVersion = " 1.8.0_999"
115+ createExe. dependsOn shadowJar
80116}
81117
82118// if your platform isn't Windows, "wine" is required to run this task
83- task createWindowsInstaller (type : Exec , dependsOn : ' createExe' ) {
119+ task createWindowsInstaller (dependsOn : createExe) {
84120 // IMPORTANT: first make sure you have installed Inno Setup
85121 // Install Inno Setup Preprocessor (ISPP) along with Inno Setup
86122 // and make sure you have wine in your path if you are not on windows
87123 // Inno Setup **MUST** be installed to C:\Program Files (x86)\Inno Setup 5\
88124 doFirst {
89- new File (projectDir, " build/innosetup/" ). mkdirs()
90- workingDir = projectDir
125+ delete " ${ buildDir} /launch4j/lib"
126+ copy {
127+ from " ${ projectDir} /dist/windows/" , " ${ buildDir} /launch4j/blobsaver.exe"
128+ into " ${ buildDir} /tmp/innosetup/"
129+
130+ rename " LICENSE_windows" , " LICENSE"
131+ rename " libraries_used_windows.txt" , " libraries_used.txt"
132+ }
133+ new File (" ${ buildDir} /distributions/" ). mkdirs()
91134 println " running Inno Setup Compiler"
92- if (System . getProperty(" os.name" ). toUpperCase(). contains(" WINDOWS" )) {
93- commandLine ' C:\\ Program Files (x86)\\ Inno Setup 5\\ ISCC.exe' , ' /Qp' , ' blobsaver.iss'
94- } else {
95- commandLine ' wine' , ' C:\\ Program Files (x86)\\ Inno Setup 5\\ ISCC.exe' , ' /Qp' , ' blobsaver.iss'
135+ exec {
136+ workingDir = projectDir
137+ if (System . getProperty(" os.name" ). toUpperCase(). contains(" WINDOWS" )) {
138+ commandLine ' C:\\ Program Files (x86)\\ Inno Setup 5\\ ISCC.exe' , ' /Qp' , ' blobsaver.iss'
139+ } else {
140+ commandLine ' wine' , ' C:\\ Program Files (x86)\\ Inno Setup 5\\ ISCC.exe' , ' /Qp' , ' blobsaver.iss'
141+ }
96142 }
97143 }
98144 assemble. dependsOn createWindowsInstaller
145+ group = " build"
99146}
0 commit comments