Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions Whisky.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
8C2AEFC82AED79B700CB568F /* WhiskyKit in Frameworks */ = {isa = PBXBuildFile; productRef = 8C2AEFC72AED79B700CB568F /* WhiskyKit */; };
8C2AEFCA2AED79CD00CB568F /* WhiskyKit in Frameworks */ = {isa = PBXBuildFile; productRef = 8C2AEFC92AED79CD00CB568F /* WhiskyKit */; };
8C73E1342AF472FC00B6FB45 /* ProgramMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C73E1332AF472FC00B6FB45 /* ProgramMenuView.swift */; };
8CB681E52AED7C6F0018D319 /* WhiskyKit in Resources */ = {isa = PBXBuildFile; fileRef = 8CB681E42AED7C6F0018D319 /* WhiskyKit */; };
8CB681E72AED7CD00018D319 /* WhiskyKit in Frameworks */ = {isa = PBXBuildFile; productRef = 8CB681E62AED7CD00018D319 /* WhiskyKit */; };
DB696FC82AFAE5DA0037EB2F /* PinCreationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB696FC72AFAE5DA0037EB2F /* PinCreationView.swift */; };
EB58FB552A499896002DC184 /* SemanticVersion in Frameworks */ = {isa = PBXBuildFile; productRef = EB58FB542A499896002DC184 /* SemanticVersion */; };
Expand Down Expand Up @@ -556,7 +555,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8CB681E52AED7C6F0018D319 /* WhiskyKit in Resources */,
6E40495D29CCA19C006E3F1B /* Preview Assets.xcassets in Resources */,
6EB58AC92AEACE5E00B1ED3F /* Localizable.xcstrings in Resources */,
6E40495A29CCA19C006E3F1B /* Assets.xcassets in Resources */,
Expand Down Expand Up @@ -801,7 +799,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 43;
CURRENT_PROJECT_VERSION = 44;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Whisky/Preview Content\"";
DEVELOPMENT_TEAM = "";
Expand All @@ -820,7 +818,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 2.3.5;
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.istorry.Brandy;
PRODUCT_MODULE_NAME = Whisky;
PRODUCT_NAME = Brandy;
Expand All @@ -841,7 +839,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 43;
CURRENT_PROJECT_VERSION = 44;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Whisky/Preview Content\"";
DEVELOPMENT_TEAM = "";
Expand All @@ -860,7 +858,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 2.3.5;
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.istorry.Brandy;
PRODUCT_MODULE_NAME = Whisky;
PRODUCT_NAME = Brandy;
Expand Down Expand Up @@ -930,7 +928,7 @@
CODE_SIGN_ENTITLEMENTS = WhiskyThumbnail/WhiskyThumbnail.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 43;
CURRENT_PROJECT_VERSION = 44;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -946,7 +944,7 @@
"@executable_path/../../../../Frameworks",
);
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 2.3.5;
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.istorry.Brandy.Thumbnail;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -965,7 +963,7 @@
CODE_SIGN_ENTITLEMENTS = WhiskyThumbnail/WhiskyThumbnail.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 43;
CURRENT_PROJECT_VERSION = 44;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -981,7 +979,7 @@
"@executable_path/../../../../Frameworks",
);
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 2.3.5;
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.istorry.Brandy.Thumbnail;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
65 changes: 65 additions & 0 deletions scripts/package-brandy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash
#
# package-brandy.sh
# Brandy
#
# Builds Brandy for release without a Developer ID and packages it as a disk image.
# An ad-hoc signature has no Team ID, so the hardened runtime's library validation would refuse to
# load the embedded Sparkle.framework and the app would exit at launch. Every piece of code is
# therefore signed ad-hoc without the runtime, inside out, keeping each target's entitlements.
#
# Usage: scripts/package-brandy.sh [output folder] (run from the repository root; default build/release)
#

set -euo pipefail

readonly APP_NAME="Brandy"
readonly APP_ENTITLEMENTS="Whisky/Whisky.entitlements"
readonly THUMBNAIL_ENTITLEMENTS="WhiskyThumbnail/WhiskyThumbnail.entitlements"

output="${1:-build/release}"
mkdir -p "$output"
output="$(cd "$output" && pwd)"
work="$(mktemp -d)"
trap 'rm -rf "$work"' EXIT

echo "Building $APP_NAME"
xcodebuild build -quiet -project Whisky.xcodeproj -scheme Whisky -configuration Release \
-destination "generic/platform=macOS" -derivedDataPath "$work/DerivedData" -onlyUsePackageVersionsFromResolvedFile \
CODE_SIGNING_ALLOWED=NO CODE_SIGN_IDENTITY=""

app="$work/$APP_NAME.app"
ditto "$work/DerivedData/Build/Products/Release/$APP_NAME.app" "$app"
contents="$app/Contents"
sparkle="$contents/Frameworks/Sparkle.framework"

sign() {
codesign --force --sign - --timestamp=none "$@"
}

echo "Signing"
sign --preserve-metadata=entitlements \
"$sparkle/Versions/B/XPCServices/Installer.xpc" \
"$sparkle/Versions/B/XPCServices/Downloader.xpc" \
"$sparkle/Versions/B/Autoupdate" \
"$sparkle/Versions/B/Updater.app"
sign "$sparkle"
sign "$contents/Resources/WhiskyCmd" "$contents/Resources/cabextract"
sign --entitlements "$THUMBNAIL_ENTITLEMENTS" "$contents/PlugIns/WhiskyThumbnail.appex"
sign --entitlements "$APP_ENTITLEMENTS" "$app"
codesign --verify --deep --strict "$app"

version="$(plutil -extract CFBundleShortVersionString raw -o - "$contents/Info.plist")"
build="$(plutil -extract CFBundleVersion raw -o - "$contents/Info.plist")"
image="$output/$APP_NAME-$version.dmg"

echo "Packaging $APP_NAME $version ($build)"
staging="$work/staging"
mkdir "$staging"
mv "$app" "$staging/"
ln -s /Applications "$staging/Applications"
hdiutil create -quiet -volname "$APP_NAME" -srcfolder "$staging" -fs HFS+ -format UDZO -ov "$image"
hdiutil verify -quiet "$image"

echo "$image"
shasum -a 256 "$image"
Loading