Initial Commit

This commit is contained in:
Mark Gregory
2026-10-23 07:10:24 +01:00
commit d3db58bc8d
61 changed files with 3033 additions and 0 deletions
+276
View File
@@ -0,0 +1,276 @@
#!/bin/bash
set -euo pipefail
# ============================================================
# Orion Toolbar - Direct Distribution Build
# ============================================================
APP_NAME="OrionToolbar"
SCHEME="OrionToolbar"
PROJECT="OrionToolbar.xcodeproj"
# Change this if your Developer ID identity has a different name.
SIGNING_IDENTITY="B99D353C88996866C49E4389B375645F76870A3F"
# Existing notarytool Keychain profile.
# Change if you use a different profile name.
NOTARY_PROFILE="orion-notary"
ROOT_DIR="$(cd "$(dirname "$0")" && pwd)"
BUILD_DIR="$ROOT_DIR/build"
ARCHIVE_PATH="$BUILD_DIR/$APP_NAME.xcarchive"
EXPORT_DIR="$BUILD_DIR/export"
DMG_STAGE="$BUILD_DIR/dmg"
DMG_PATH="$ROOT_DIR/$APP_NAME.dmg"
EXPORT_OPTIONS="$BUILD_DIR/ExportOptions.plist"
echo
echo "============================================================"
echo " ORION TOOLBAR - DIRECT DISTRIBUTION"
echo "============================================================"
echo
cd "$ROOT_DIR"
# ------------------------------------------------------------
# Clean
# ------------------------------------------------------------
echo "==> Cleaning previous build..."
rm -rf "$BUILD_DIR"
rm -f "$DMG_PATH"
mkdir -p "$BUILD_DIR"
mkdir -p "$EXPORT_DIR"
mkdir -p "$DMG_STAGE"
# ------------------------------------------------------------
# Export options
# ------------------------------------------------------------
cat > "$EXPORT_OPTIONS" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>developer-id</string>
<key>signingStyle</key>
<string>automatic</string>
<key>teamID</key>
<string>39R6U3437D</string>
</dict>
</plist>
EOF
# ------------------------------------------------------------
# Archive
# ------------------------------------------------------------
echo
echo "==> Creating Release archive..."
xcodebuild \
-project "$PROJECT" \
-scheme "$SCHEME" \
-configuration Release \
-destination "generic/platform=macOS" \
-archivePath "$ARCHIVE_PATH" \
clean archive
echo
echo "==> Archive created."
# ------------------------------------------------------------
# Export Developer ID application
# ------------------------------------------------------------
echo
echo "==> Exporting Developer ID application..."
xcodebuild \
-exportArchive \
-archivePath "$ARCHIVE_PATH" \
-exportPath "$EXPORT_DIR" \
-exportOptionsPlist "$EXPORT_OPTIONS"
APP_PATH="$EXPORT_DIR/$APP_NAME.app"
if [ ! -d "$APP_PATH" ]; then
echo
echo "ERROR: Exported application not found:"
echo "$APP_PATH"
exit 1
fi
# ------------------------------------------------------------
# Verify application signature
# ------------------------------------------------------------
echo
echo "==> Verifying application signature..."
codesign \
--verify \
--deep \
--strict \
--verbose=2 \
"$APP_PATH"
echo
echo "==> Signature information..."
codesign -dv --verbose=4 "$APP_PATH" 2>&1 | \
grep -E "Identifier=|Authority=|TeamIdentifier=|Runtime Version=" || true
# ------------------------------------------------------------
# Notarize application
# ------------------------------------------------------------
echo
echo "==> Creating notarization ZIP..."
APP_ZIP="$BUILD_DIR/$APP_NAME.zip"
ditto \
-c \
-k \
--keepParent \
"$APP_PATH" \
"$APP_ZIP"
echo
echo "==> Submitting application to Apple notarization..."
xcrun notarytool submit \
"$APP_ZIP" \
--keychain-profile "$NOTARY_PROFILE" \
--wait
echo
echo "==> Stapling notarization ticket to application..."
xcrun stapler staple "$APP_PATH"
echo
echo "==> Validating application ticket..."
xcrun stapler validate "$APP_PATH"
echo
echo "==> Gatekeeper application check..."
spctl \
--assess \
--type execute \
--verbose=4 \
"$APP_PATH"
# ------------------------------------------------------------
# Build DMG contents
# ------------------------------------------------------------
echo
echo "==> Preparing DMG..."
rm -rf "$DMG_STAGE"
mkdir -p "$DMG_STAGE"
ditto "$APP_PATH" "$DMG_STAGE/$APP_NAME.app"
ln -s /Applications "$DMG_STAGE/Applications"
# ------------------------------------------------------------
# Create DMG
# ------------------------------------------------------------
echo
echo "==> Creating DMG..."
hdiutil create \
-volname "$APP_NAME" \
-srcfolder "$DMG_STAGE" \
-ov \
-format UDZO \
"$DMG_PATH"
# ------------------------------------------------------------
# Sign DMG
# ------------------------------------------------------------
echo
echo "==> Signing DMG..."
codesign \
--force \
--timestamp \
--sign "$SIGNING_IDENTITY" \
"$DMG_PATH"
echo
echo "==> Verifying DMG signature..."
codesign \
--verify \
--verbose=2 \
"$DMG_PATH"
# ------------------------------------------------------------
# Notarize DMG
# ------------------------------------------------------------
echo
echo "==> Submitting DMG to Apple notarization..."
xcrun notarytool submit \
"$DMG_PATH" \
--keychain-profile "$NOTARY_PROFILE" \
--wait
echo
echo "==> Stapling notarization ticket to DMG..."
xcrun stapler staple "$DMG_PATH"
echo
echo "==> Validating DMG ticket..."
xcrun stapler validate "$DMG_PATH"
# ------------------------------------------------------------
# Final verification
# ------------------------------------------------------------
echo
echo "==> Final Gatekeeper assessment..."
spctl \
--assess \
--type open \
--context context:primary-signature \
--verbose=4 \
"$DMG_PATH" || true
echo
echo "==> DMG information..."
ls -lh "$DMG_PATH"
echo
echo "==> SHA-256..."
shasum -a 256 "$DMG_PATH"
echo
echo "============================================================"
echo " RELEASE BUILD COMPLETE"
echo "============================================================"
echo
echo "DMG:"
echo "$DMG_PATH"
echo
+200
View File
@@ -0,0 +1,200 @@
#!/bin/bash
set -euo pipefail
APP_NAME="OrionToolbar"
SCHEME="OrionToolbar"
PROJECT="OrionToolbar.xcodeproj"
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
BUILD_DIR="$ROOT_DIR/.build"
LOG_DIR="$ROOT_DIR/build-logs"
CONFIGURATION="Release"
LAUNCH=false
RUN_TESTS=true
for arg in "$@"; do
case "$arg" in
--launch)
LAUNCH=true
;;
--no-tests)
RUN_TESTS=false
;;
*)
echo "Unknown argument: $arg"
echo "Usage: $0 [--launch] [--no-tests]"
exit 2
;;
esac
done
mkdir -p "$BUILD_DIR" "$LOG_DIR"
LOG_FILE="$LOG_DIR/build-test-$(date +%Y%m%d-%H%M%S).log"
exec > >(tee -a "$LOG_FILE") 2>&1
echo
echo "============================================================"
echo " ORION TOOLBAR - RELEASE BUILD AND TEST"
echo "============================================================"
echo
cd "$ROOT_DIR"
echo "==> Environment"
xcodebuild -version
swift --version
echo
echo "==> Checking project"
test -d "$PROJECT" || {
echo "ERROR: Xcode project not found."
exit 1
}
echo
echo "==> Checking Parallels"
PRLCTL=""
for candidate in \
/usr/local/bin/prlctl \
"/Applications/Parallels Desktop.app/Contents/MacOS/prlctl"
do
if [ -x "$candidate" ]; then
PRLCTL="$candidate"
break
fi
done
if [ -n "$PRLCTL" ]; then
echo "Parallels CLI: $PRLCTL"
echo
echo "==> Discovering virtual machines"
"$PRLCTL" list -a -j | python3 -c '
import json
import sys
machines = json.load(sys.stdin)
print(f"Discovered {len(machines)} virtual machines")
print()
for machine in machines:
print(
f"{machine.get('name', 'Unknown'):<35} "
f"{machine.get('status', 'unknown'):<12} "
f"{machine.get('uuid', '')}"
)
'
else
echo "WARNING: Parallels CLI not found."
fi
echo
echo "==> Building Release configuration"
xcodebuild \
-project "$PROJECT" \
-scheme "$SCHEME" \
-configuration "$CONFIGURATION" \
-destination "generic/platform=macOS" \
-derivedDataPath "$BUILD_DIR" \
CODE_SIGNING_ALLOWED=NO \
clean build
APP_PATH="$BUILD_DIR/Build/Products/$CONFIGURATION/$APP_NAME.app"
if [ ! -d "$APP_PATH" ]; then
echo "ERROR: Built application not found."
exit 1
fi
echo
echo "==> Validating application bundle"
plutil -lint "$APP_PATH/Contents/Info.plist"
echo
echo "==> Application information"
defaults read "$APP_PATH/Contents/Info" \
CFBundleIdentifier || true
defaults read "$APP_PATH/Contents/Info" \
CFBundleShortVersionString || true
defaults read "$APP_PATH/Contents/Info" \
CFBundleVersion || true
echo
echo "==> Checking executable"
EXECUTABLE=$(
/usr/libexec/PlistBuddy \
-c "Print CFBundleExecutable" \
"$APP_PATH/Contents/Info.plist"
)
test -x "$APP_PATH/Contents/MacOS/$EXECUTABLE"
file "$APP_PATH/Contents/MacOS/$EXECUTABLE"
echo
echo "==> Checking available test targets"
if [ "$RUN_TESTS" = true ]; then
TEST_OUTPUT="$LOG_DIR/test-targets.txt"
xcodebuild \
-list \
-project "$PROJECT" > "$TEST_OUTPUT"
if grep -Eq '^[[:space:]]+.*Tests$' "$TEST_OUTPUT"; then
echo "Test targets detected."
xcodebuild \
-project "$PROJECT" \
-scheme "$SCHEME" \
-configuration "$CONFIGURATION" \
-destination "platform=macOS" \
-derivedDataPath "$BUILD_DIR" \
CODE_SIGNING_ALLOWED=NO \
test
else
echo "No test targets detected; skipping XCTest."
fi
fi
echo
echo "==> Build size"
du -sh "$APP_PATH"
if [ "$LAUNCH" = true ]; then
echo
echo "==> Launching OrionToolbar"
open "$APP_PATH"
fi
echo
echo "============================================================"
echo " BUILD AND TEST COMPLETE"
echo "============================================================"
echo
echo "Application:"
echo "$APP_PATH"
echo
echo "Log:"
echo "$LOG_FILE"
echo
+318
View File
@@ -0,0 +1,318 @@
#!/bin/bash
set -euo pipefail
# ============================================================
# OrionToolbar - Developer ID Release
# ============================================================
APP_NAME="OrionToolbar"
SCHEME="OrionToolbar"
PROJECT="OrionToolbar.xcodeproj"
SIGNING_IDENTITY="B99D353C88996866C49E4389B375645F76870A3F"
TEAM_ID="39R6U3437D"
NOTARY_PROFILE="orion-notary"
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
BUILD_DIR="$ROOT_DIR/build"
LOG_DIR="$ROOT_DIR/build-logs"
ARCHIVE_PATH="$BUILD_DIR/$APP_NAME.xcarchive"
EXPORT_DIR="$BUILD_DIR/export"
DMG_STAGE="$BUILD_DIR/dmg"
DMG_PATH="$ROOT_DIR/$APP_NAME.dmg"
EXPORT_OPTIONS="$BUILD_DIR/ExportOptions.plist"
mkdir -p "$LOG_DIR"
LOG_FILE="$LOG_DIR/release-$(date +%Y%m%d-%H%M%S).log"
exec > >(tee -a "$LOG_FILE") 2>&1
echo
echo "============================================================"
echo " ORION TOOLBAR - DIRECT DISTRIBUTION"
echo "============================================================"
echo
cd "$ROOT_DIR"
# ------------------------------------------------------------
# Prerequisites
# ------------------------------------------------------------
echo "==> Checking signing identity"
security find-identity -v -p codesigning
if ! security find-identity -v -p codesigning | \
grep -q "$SIGNING_IDENTITY"; then
echo "ERROR: Developer ID signing identity unavailable."
exit 1
fi
echo
echo "==> Checking notarization profile"
xcrun notarytool history \
--keychain-profile "$NOTARY_PROFILE" \
>/dev/null
echo "Notarization profile available."
# ------------------------------------------------------------
# Clean
# ------------------------------------------------------------
echo
echo "==> Cleaning previous release"
rm -rf "$BUILD_DIR"
rm -f "$DMG_PATH"
mkdir -p \
"$BUILD_DIR" \
"$EXPORT_DIR" \
"$DMG_STAGE"
# ------------------------------------------------------------
# Export options
# ------------------------------------------------------------
cat > "$EXPORT_OPTIONS" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"\>
<plist version="1.0">
<dict>
<key>method</key>
<string>developer-id</string>
<key>signingStyle</key>
<string>automatic</string>
<key>teamID</key>
<string>$TEAM_ID</string>
</dict>
</plist>
EOF
# ------------------------------------------------------------
# Archive
# ------------------------------------------------------------
echo
echo "==> Creating Release archive"
xcodebuild \
-project "$PROJECT" \
-scheme "$SCHEME" \
-configuration Release \
-destination "generic/platform=macOS" \
-archivePath "$ARCHIVE_PATH" \
clean archive
echo
echo "==> Archive created"
# ------------------------------------------------------------
# Export
# ------------------------------------------------------------
echo
echo "==> Exporting Developer ID application"
xcodebuild \
-exportArchive \
-archivePath "$ARCHIVE_PATH" \
-exportPath "$EXPORT_DIR" \
-exportOptionsPlist "$EXPORT_OPTIONS"
APP_PATH="$EXPORT_DIR/$APP_NAME.app"
if [ ! -d "$APP_PATH" ]; then
echo "ERROR: Exported application not found."
exit 1
fi
# ------------------------------------------------------------
# Verify signature
# ------------------------------------------------------------
echo
echo "==> Verifying application signature"
codesign \
--verify \
--deep \
--strict \
--verbose=2 \
"$APP_PATH"
echo
echo "==> Checking signing team"
ACTUAL_TEAM=$(
codesign -dv --verbose=4 "$APP_PATH" 2>&1 |
sed -n 's/^TeamIdentifier=//p'
)
if [ "$ACTUAL_TEAM" != "$TEAM_ID" ]; then
echo "ERROR: Incorrect signing team: $ACTUAL_TEAM"
exit 1
fi
echo "Signing team verified: $ACTUAL_TEAM"
# ------------------------------------------------------------
# Notarize application
# ------------------------------------------------------------
echo
echo "==> Creating notarization ZIP"
APP_ZIP="$BUILD_DIR/$APP_NAME.zip"
ditto \
-c \
-k \
--keepParent \
"$APP_PATH" \
"$APP_ZIP"
echo
echo "==> Notarizing application"
xcrun notarytool submit \
"$APP_ZIP" \
--keychain-profile "$NOTARY_PROFILE" \
--wait
echo
echo "==> Stapling application"
xcrun stapler staple "$APP_PATH"
echo
echo "==> Validating application ticket"
xcrun stapler validate "$APP_PATH"
echo
echo "==> Gatekeeper application verification"
spctl \
--assess \
--type execute \
--verbose=4 \
"$APP_PATH"
# ------------------------------------------------------------
# Prepare DMG
# ------------------------------------------------------------
echo
echo "==> Preparing DMG"
rm -rf "$DMG_STAGE"
mkdir -p "$DMG_STAGE"
ditto "$APP_PATH" "$DMG_STAGE/$APP_NAME.app"
ln -s /Applications "$DMG_STAGE/Applications"
# ------------------------------------------------------------
# Create DMG
# ------------------------------------------------------------
echo
echo "==> Creating DMG"
hdiutil create \
-volname "$APP_NAME" \
-srcfolder "$DMG_STAGE" \
-ov \
-format UDZO \
"$DMG_PATH"
# ------------------------------------------------------------
# Sign DMG
# ------------------------------------------------------------
echo
echo "==> Signing DMG"
codesign \
--force \
--timestamp \
--sign "$SIGNING_IDENTITY" \
"$DMG_PATH"
echo
echo "==> Verifying DMG signature"
codesign \
--verify \
--verbose=2 \
"$DMG_PATH"
# ------------------------------------------------------------
# Notarize DMG
# ------------------------------------------------------------
echo
echo "==> Notarizing DMG"
xcrun notarytool submit \
"$DMG_PATH" \
--keychain-profile "$NOTARY_PROFILE" \
--wait
echo
echo "==> Stapling DMG"
xcrun stapler staple "$DMG_PATH"
echo
echo "==> Validating DMG ticket"
xcrun stapler validate "$DMG_PATH"
# ------------------------------------------------------------
# Final verification
# ------------------------------------------------------------
echo
echo "==> Final Gatekeeper verification"
spctl \
--assess \
--type open \
--context context:primary-signature \
--verbose=4 \
"$DMG_PATH"
echo
echo "==> Final DMG information"
ls -lh "$DMG_PATH"
echo
echo "==> SHA-256"
shasum -a 256 "$DMG_PATH"
echo
echo "============================================================"
echo " RELEASE BUILD COMPLETE"
echo "============================================================"
echo
echo "DMG:"
echo "$DMG_PATH"
echo
echo "Build log:"
echo "$LOG_FILE"
echo