Skip to content

Commit b0cdc2d

Browse files
committed
Greatly improve building/distribution of application, reduce application size
1 parent 28bc774 commit b0cdc2d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+190
-920
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Declare files that will always have CRLF line endings on checkout.
22
gpl-3.0.txt text eol=lf
3-
gpl-3.0_windows.txt text eol=crlf
3+
LICENSE_windows.txt text eol=crlf
44
libraries_used.txt text eol=lf
55
libraries_used_windows.txt text eol=crlf
66
gradlew.bat text eol=crlf

blobsaver.iss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ AppUpdatesURL={#MyAppURL}
2222
DefaultDirName={pf}\{#MyAppName}
2323
DisableDirPage=yes
2424
DisableProgramGroupPage=yes
25-
LicenseFile=src\main\resources\com\airsquared\blobsaver\gpl-3.0_windows.txt
26-
OutputDir=build\innosetup
27-
OutputBaseFilename=blobsaver_setup
25+
LicenseFile=build\tmp\innosetup\LICENSE
26+
OutputDir=build\distributions
27+
OutputBaseFilename=blobsaver-windows
2828
SetupIconFile=icons\blob_emoji.ico
2929
Compression=lzma
3030
SolidCompression=yes
@@ -37,8 +37,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
3737
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
3838

3939
[Files]
40-
Source: "build\launch4j\blobsaver.exe"; DestDir: "{app}"; Flags: ignoreversion
41-
Source: "build\launch4j\lib\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
40+
Source: "build\tmp\innosetup\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
4241
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
4342

4443
[Icons]

build.gradle

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

5657
shadowJar {
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

6268
macAppBundle {
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

73108
launch4j { // 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
}

dist/linux/blobsaver

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
if [[ -x "$(command -v java)" ]]; then
4+
# java executable is in $PATH
5+
JAVA=java
6+
elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
7+
# java excecutable is in $JAVA_HOME
8+
JAVA="$JAVA_HOME/bin/java"
9+
else
10+
echo "ERROR: java was not found in \$PATH or \$JAVA_HOME"
11+
echo "Please install java before continuing."
12+
echo "See https://github.com/airsquared/blobsaver/wiki/Installing-Java for instructions on how to install java."
13+
MESSAGE="java was not found in \$PATH or \$JAVA_HOME. Please install java before continuing. \
14+
See https://github.com/airsquared/blobsaver/wiki/Installing-Java for instructions on how to install java."
15+
TITLE="Error: blobsaver"
16+
if [[ -x "$(command -v zenity)" ]]; then
17+
zenity --error --width=400 --title="$TITLE" --text="$MESSAGE" 2>/dev/null
18+
elif [[ -x "$(command -v kdialog)" ]]; then
19+
kdialog --error --title $TITLE $MESSAGE 2>/dev/null
20+
elif [[ -x "$(command -v gxmessage)" ]]; then
21+
gxmessage -center -wrap -title $TITLE $MESSAGE 2>/dev/null
22+
elif [[ -x "$(command -v xmessage)" ]]; then
23+
xmessage -center -title $TITLE $MESSAGE 2>/dev/null
24+
fi
25+
exit 1
26+
fi
27+
# find the directory this bash script is in (https://stackoverflow.com/a/246128/)
28+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)"
29+
$JAVA -jar $DIR/blobsaver.jar "$@"

src/main/resources/com/airsquared/blobsaver/tsschecker_linux renamed to dist/linux/tsschecker

File renamed without changes.

src/main/resources/com/airsquared/blobsaver/libimobiledevice_mac/iproxy renamed to dist/macos/Frameworks/iproxy

File renamed without changes.
27.4 KB
Binary file not shown.

src/main/resources/com/airsquared/blobsaver/libimobiledevice_mac/libcrypto.1.0.0.dylib renamed to dist/macos/Frameworks/libcrypto.1.0.0.dylib

File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
libideviceactivation.dylib

src/main/resources/com/airsquared/blobsaver/libimobiledevice_mac/libideviceactivation.dylib renamed to dist/macos/Frameworks/libideviceactivation.dylib

File renamed without changes.

0 commit comments

Comments
 (0)