Skip to content

Commit d7a17c8

Browse files
committed
build: optimize release binary size — disable coverage, enable LTO, strip helpers
1 parent 85b2c3a commit d7a17c8

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

TablePro.xcodeproj/xcshareddata/xcschemes/TablePro.xcscheme

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
</BuildAction>
2626
<TestAction
2727
buildConfiguration = "Debug"
28+
codeCoverageEnabled = "NO"
2829
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2930
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
3031
shouldUseLaunchSchemeArgsEnv = "YES"

scripts/build-release.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,11 @@ build_for_arch() {
345345
CODE_SIGN_IDENTITY="$SIGN_IDENTITY" \
346346
CODE_SIGN_STYLE=Manual \
347347
DEVELOPMENT_TEAM="$TEAM_ID" \
348+
GCC_OPTIMIZATION_LEVEL=s \
349+
SWIFT_OPTIMIZATION_LEVEL=-O \
350+
LLVM_LTO=YES_THIN \
351+
CLANG_COVERAGE_MAPPING=NO \
352+
ENABLE_CODE_COVERAGE=NO \
348353
${ANALYTICS_HMAC_SECRET:+ANALYTICS_HMAC_SECRET="$ANALYTICS_HMAC_SECRET"} \
349354
-skipPackagePluginValidation \
350355
-clonedSourcePackagesDirPath "$SPM_CACHE_DIR" \
@@ -429,6 +434,20 @@ build_for_arch() {
429434
echo "🔪 Main binary: $before$after"
430435
fi
431436

437+
# Strip helper executables in Contents/MacOS
438+
for helper in "$BUILD_DIR/$OUTPUT_NAME/Contents/MacOS"/*; do
439+
[ -f "$helper" ] || continue
440+
[ "$(basename "$helper")" = "TablePro" ] && continue
441+
local hname
442+
hname=$(basename "$helper")
443+
local before
444+
before=$(ls -lh "$helper" | awk '{print $5}')
445+
strip -x "$helper"
446+
local after
447+
after=$(ls -lh "$helper" | awk '{print $5}')
448+
echo " $hname: $before$after"
449+
done
450+
432451
# Strip PluginKit framework
433452
local pluginkit_binary="$BUILD_DIR/$OUTPUT_NAME/Contents/Frameworks/TableProPluginKit.framework/Versions/A/TableProPluginKit"
434453
if [ -f "$pluginkit_binary" ]; then

0 commit comments

Comments
 (0)