diff --git a/README.md b/README.md
index 823b174..708d91d 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,7 @@ Before you add an account, the window shows a welcome screen with a card for eac
- **Shareable links:** copy a presigned URL that expires in an hour, a day or seven days, or copy the `s3://` URI.
- **Transfers popover** with progress, cancel and Show in Finder. Large files upload in parallel multipart chunks.
- **Credentials live in the Keychain.** Account settings (names, regions, endpoints) go in user defaults; access keys never do.
+- **Private by design.** No analytics, no tracking, and no servers of ours: the app only talks to the storage endpoints you add. See the [privacy policy](docs/privacy.md).
- **iCloud sync.** In a build signed with a Developer ID, accounts and keys sync through iCloud Keychain, so they come back after a reinstall and show up on your other Macs.
## Requirements
@@ -65,7 +66,7 @@ Apple only lets apps signed by a developer team use iCloud Keychain. Ad-hoc sign
If Xcode manages your Developer ID certificate in the cloud, its private key isn't in your keychain and `SIGN_IDENTITY` won't work. Sign through Xcode instead. Run `scripts/build-app.sh`, then:
```sh
-DEV_PROFILE=path/to/development.provisionprofile scripts/export-developer-id.sh
+DEV_PROFILE=path/to/development.provisionprofile scripts/export-app.sh
```
`DEV_PROFILE` is a Mac development profile for your team that covers `com.bucketbrowser.app`, such as the "Mac Team Provisioning Profile: *" that Xcode keeps in `~/Library/Developer/Xcode/UserData/Provisioning Profiles`. The script wraps the app in an archive and has `xcodebuild -exportArchive` sign it with Developer ID through the account you're signed in to in Xcode. The signed app is written to `build/export/Bucket Browser.app`.
@@ -74,6 +75,23 @@ CI signs the app the same way when these repository secrets are set: `MACOS_CERT
The first time a signed build runs, it moves any accounts saved by an unsigned build into iCloud Keychain. Make sure iCloud Keychain is on in System Settings › Apple Account › iCloud › Passwords & Keychain.
+## Mac App Store
+
+The app runs in the App Sandbox with three entitlements, listed in `Resources/BucketBrowser.entitlements`: outgoing network connections, and read-write access to files and folders the user picks in an open panel or drops on the window. Every app bundle the scripts build is sandboxed, so what you test locally behaves like the App Store copy. (`swift run` isn't sandboxed.) The bundle also carries a privacy manifest (`Resources/PrivacyInfo.xcprivacy`) that declares no tracking and no collected data.
+
+To build an App Store package, with Xcode signed in to an account on the team:
+
+```sh
+UNIVERSAL=1 scripts/build-app.sh
+DEV_PROFILE=path/to/development.provisionprofile scripts/export-app.sh app-store
+```
+
+This writes `build/export/Bucket Browser.pkg`, signed for the App Store through Xcode's cloud-managed distribution certificates. Upload it with Transporter, or run the export with `UPLOAD=1` to have Xcode upload it to App Store Connect directly. The app record must exist in App Store Connect first.
+
+`VERSION` sets the marketing version (1.0.0 by default). The build number defaults to the number of commits on the branch, so each upload from a newer commit gets a higher number, as App Store Connect requires. Set `BUILD_NUMBER` to override it.
+
+The App Store copy uses the same keychain access group as the Developer ID copy, so accounts saved by either one sync through iCloud Keychain to the other.
+
## Adding an account
Choose **Add Account** at the bottom of the sidebar, or open **Settings › Accounts**.
@@ -104,7 +122,7 @@ BUCKET_BROWSER_DEMO=1 swift run BucketBrowser
## App icon
-The icon's source is `Resources/AppIcon.svg`. To regenerate `Resources/AppIcon.png`, run `python3 scripts/render-icon.py` (it needs `cairosvg` and `Pillow`). `scripts/build-app.sh` turns the PNG into `AppIcon.icns`.
+The icon's source is `Resources/AppIcon.svg`. To regenerate `Resources/AppIcon.png` and the ten sizes in `Resources/Assets.xcassets/AppIcon.appiconset`, run `python3 scripts/render-icon.py` (it needs `cairosvg` and `Pillow`). `scripts/build-app.sh` compiles the asset catalog with `actool` into `Assets.car` and `AppIcon.icns`.
## Tests
diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json b/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000..8815e3e
--- /dev/null
+++ b/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,68 @@
+{
+ "images": [
+ {
+ "filename": "icon_16x16.png",
+ "idiom": "mac",
+ "scale": "1x",
+ "size": "16x16"
+ },
+ {
+ "filename": "icon_16x16@2x.png",
+ "idiom": "mac",
+ "scale": "2x",
+ "size": "16x16"
+ },
+ {
+ "filename": "icon_32x32.png",
+ "idiom": "mac",
+ "scale": "1x",
+ "size": "32x32"
+ },
+ {
+ "filename": "icon_32x32@2x.png",
+ "idiom": "mac",
+ "scale": "2x",
+ "size": "32x32"
+ },
+ {
+ "filename": "icon_128x128.png",
+ "idiom": "mac",
+ "scale": "1x",
+ "size": "128x128"
+ },
+ {
+ "filename": "icon_128x128@2x.png",
+ "idiom": "mac",
+ "scale": "2x",
+ "size": "128x128"
+ },
+ {
+ "filename": "icon_256x256.png",
+ "idiom": "mac",
+ "scale": "1x",
+ "size": "256x256"
+ },
+ {
+ "filename": "icon_256x256@2x.png",
+ "idiom": "mac",
+ "scale": "2x",
+ "size": "256x256"
+ },
+ {
+ "filename": "icon_512x512.png",
+ "idiom": "mac",
+ "scale": "1x",
+ "size": "512x512"
+ },
+ {
+ "filename": "icon_512x512@2x.png",
+ "idiom": "mac",
+ "scale": "2x",
+ "size": "512x512"
+ }
+ ],
+ "info": {
+ "author": "xcode",
+ "version": 1
+ }
+}
diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/icon_128x128.png b/Resources/Assets.xcassets/AppIcon.appiconset/icon_128x128.png
new file mode 100644
index 0000000..b84d9da
Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/icon_128x128.png differ
diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png b/Resources/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png
new file mode 100644
index 0000000..05b06fb
Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png differ
diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/icon_16x16.png b/Resources/Assets.xcassets/AppIcon.appiconset/icon_16x16.png
new file mode 100644
index 0000000..e6e3567
Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/icon_16x16.png differ
diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png b/Resources/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png
new file mode 100644
index 0000000..7cd1b9b
Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png differ
diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/icon_256x256.png b/Resources/Assets.xcassets/AppIcon.appiconset/icon_256x256.png
new file mode 100644
index 0000000..05b06fb
Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/icon_256x256.png differ
diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png b/Resources/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png
new file mode 100644
index 0000000..8339315
Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png differ
diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/icon_32x32.png b/Resources/Assets.xcassets/AppIcon.appiconset/icon_32x32.png
new file mode 100644
index 0000000..7cd1b9b
Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/icon_32x32.png differ
diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png b/Resources/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png
new file mode 100644
index 0000000..9514196
Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png differ
diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/icon_512x512.png b/Resources/Assets.xcassets/AppIcon.appiconset/icon_512x512.png
new file mode 100644
index 0000000..8339315
Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/icon_512x512.png differ
diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png b/Resources/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png
new file mode 100644
index 0000000..08f2fcd
Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png differ
diff --git a/Resources/Assets.xcassets/Contents.json b/Resources/Assets.xcassets/Contents.json
new file mode 100644
index 0000000..74d6a72
--- /dev/null
+++ b/Resources/Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info": {
+ "author": "xcode",
+ "version": 1
+ }
+}
diff --git a/Resources/BucketBrowser.entitlements b/Resources/BucketBrowser.entitlements
new file mode 100644
index 0000000..df37460
--- /dev/null
+++ b/Resources/BucketBrowser.entitlements
@@ -0,0 +1,15 @@
+
+
+
+
+
+ com.apple.security.app-sandbox
+
+
+ com.apple.security.network.client
+
+
+ com.apple.security.files.user-selected.read-write
+
+
+
diff --git a/Resources/PrivacyInfo.xcprivacy b/Resources/PrivacyInfo.xcprivacy
new file mode 100644
index 0000000..bf429b0
--- /dev/null
+++ b/Resources/PrivacyInfo.xcprivacy
@@ -0,0 +1,26 @@
+
+
+
+
+
+ NSPrivacyTracking
+
+ NSPrivacyTrackingDomains
+
+ NSPrivacyCollectedDataTypes
+
+ NSPrivacyAccessedAPITypes
+
+
+
+ NSPrivacyAccessedAPIType
+ NSPrivacyAccessedAPICategoryUserDefaults
+ NSPrivacyAccessedAPITypeReasons
+
+ CA92.1
+
+
+
+
+
diff --git a/Sources/S3Kit/S3Client.swift b/Sources/S3Kit/S3Client.swift
index dd21513..1e47903 100644
--- a/Sources/S3Kit/S3Client.swift
+++ b/Sources/S3Kit/S3Client.swift
@@ -124,8 +124,7 @@ public final class S3Client: @unchecked Sendable {
/// Uploads a local file, switching to a multipart upload for large files.
public func uploadFile(_ fileURL: URL, bucket: String, key: String, contentType: String? = nil, progress: TransferProgress? = nil) async throws {
- let attributes = try FileManager.default.attributesOfItem(atPath: fileURL.path)
- let size = (attributes[.size] as? NSNumber)?.int64Value ?? 0
+ let size = Int64(try fileURL.resourceValues(forKeys: [.fileSizeKey]).fileSize ?? 0)
if size > multipartThreshold {
try await multipartUpload(fileURL, size: size, bucket: bucket, key: key, contentType: contentType, progress: progress)
return
diff --git a/docs/privacy.md b/docs/privacy.md
new file mode 100644
index 0000000..0c3bbcc
--- /dev/null
+++ b/docs/privacy.md
@@ -0,0 +1,23 @@
+# Bucket Browser privacy policy
+
+_Last updated: October 20, 2026_
+
+Bucket Browser is a Mac app for browsing Amazon S3, Cloudflare R2 and other S3-compatible storage. It doesn't collect, store or share any information about you.
+
+## What the app stores
+
+- **Access keys** for the accounts you add are stored in your Mac's keychain. If iCloud Keychain is on, they sync to your other devices through it, end-to-end encrypted by Apple. The developer can't see them.
+- **Account settings** (names, regions, endpoints and bucket names) are stored in the app's preferences on your Mac and, with iCloud Keychain on, in iCloud Keychain.
+- **Previews** of files you open with Quick Look are cached on your Mac and can be deleted at any time.
+
+## Network connections
+
+The app connects only to the storage endpoints of the accounts you add, such as Amazon S3 or Cloudflare R2, to list, upload, download, rename and delete your files. Those services handle your data under their own privacy policies. The app has no servers of its own and sends nothing to the developer.
+
+## Analytics and tracking
+
+None. The app contains no analytics, advertising or tracking code, and it doesn't link your data to your identity.
+
+## Contact
+
+Questions about this policy: open an issue at https://github.com/chiranjeebhub/S3_R2_bucket_browser/issues.
diff --git a/scripts/add-team-entitlements.sh b/scripts/add-team-entitlements.sh
new file mode 100755
index 0000000..95e61ac
--- /dev/null
+++ b/scripts/add-team-entitlements.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+# Adds the entitlements that tie the app to a developer team to an entitlements file:
+# the application identifier and the keychain access group that iCloud Keychain sync uses.
+# Usage: scripts/add-team-entitlements.sh
+set -euo pipefail
+
+FILE="$1"
+APP_ID="$2.$3"
+BUDDY=/usr/libexec/PlistBuddy
+"$BUDDY" -c "Add :com.apple.application-identifier string $APP_ID" "$FILE"
+"$BUDDY" -c "Add :com.apple.developer.team-identifier string $2" "$FILE"
+"$BUDDY" -c "Add :keychain-access-groups array" "$FILE"
+"$BUDDY" -c "Add :keychain-access-groups:0 string $APP_ID" "$FILE"
diff --git a/scripts/build-app.sh b/scripts/build-app.sh
index 3d41184..769b01f 100755
--- a/scripts/build-app.sh
+++ b/scripts/build-app.sh
@@ -2,6 +2,12 @@
# Builds "Bucket Browser.app" from the Swift package and signs it.
# Usage: scripts/build-app.sh [debug|release] (default: release)
#
+# The app runs in the App Sandbox (Resources/BucketBrowser.entitlements), as the Mac App Store
+# requires. For an App Store build, see scripts/export-app.sh.
+#
+# VERSION is the marketing version (default 1.0.0). BUILD_NUMBER defaults to the commit count,
+# so every build of a later commit has a higher number, which App Store Connect requires.
+#
# By default the app is ad-hoc signed, which can't use iCloud Keychain. To build a copy
# that syncs accounts through iCloud, sign it with your team's Developer ID:
# SIGN_IDENTITY="Developer ID Application: Your Name (4TK5PNR392)" \
@@ -15,35 +21,45 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
APP_NAME="Bucket Browser"
BUNDLE_ID="com.bucketbrowser.app"
TEAM_ID="${TEAM_ID:-4TK5PNR392}"
-VERSION="${VERSION:-0.1.0}"
-BUILD_NUMBER="${BUILD_NUMBER:-1}"
+VERSION="${VERSION:-1.0.0}"
+BUILD_NUMBER="${BUILD_NUMBER:-$(git -C "$ROOT" rev-list --count HEAD 2>/dev/null || echo 1)}"
+COPYRIGHT="${COPYRIGHT:-Copyright © $(date +%Y) Chiranjeeb Jena. All rights reserved.}"
OUT="$ROOT/build"
APP="$OUT/$APP_NAME.app"
cd "$ROOT"
-ARCH_FLAGS=()
+BUILD_FLAGS=()
if [[ "${UNIVERSAL:-0}" == "1" ]]; then
- ARCH_FLAGS=(--arch arm64 --arch x86_64)
+ BUILD_FLAGS=(--arch arm64 --arch x86_64)
fi
+# SwiftPM records the deployment target as the SDK version in the binary, and App Store Connect
+# rejects apps that look built with an old SDK, so pass the real SDK version to the linker.
+SDK_VERSION="$(xcrun --sdk macosx --show-sdk-version)"
+BUILD_FLAGS+=(-Xlinker -platform_version -Xlinker macos -Xlinker 14.0 -Xlinker "$SDK_VERSION")
# The ${a[@]+...} form keeps bash 3.2 (the macOS default) happy with an empty array under `set -u`.
-swift build -c "$CONFIG" ${ARCH_FLAGS[@]+"${ARCH_FLAGS[@]}"}
-BIN_DIR="$(swift build -c "$CONFIG" ${ARCH_FLAGS[@]+"${ARCH_FLAGS[@]}"} --show-bin-path)"
+swift build -c "$CONFIG" ${BUILD_FLAGS[@]+"${BUILD_FLAGS[@]}"}
+BIN_DIR="$(swift build -c "$CONFIG" ${BUILD_FLAGS[@]+"${BUILD_FLAGS[@]}"} --show-bin-path)"
rm -rf "$APP"
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
cp "$BIN_DIR/BucketBrowser" "$APP/Contents/MacOS/BucketBrowser"
-# App icon: Resources/AppIcon.png (1024x1024, from scripts/render-icon.py) -> AppIcon.icns
-ICONSET="$OUT/AppIcon.iconset"
-rm -rf "$ICONSET"
-mkdir -p "$ICONSET"
-for size in 16 32 128 256 512; do
- sips -z "$size" "$size" "$ROOT/Resources/AppIcon.png" --out "$ICONSET/icon_${size}x${size}.png" >/dev/null
- double=$((size * 2))
- sips -z "$double" "$double" "$ROOT/Resources/AppIcon.png" --out "$ICONSET/icon_${size}x${size}@2x.png" >/dev/null
-done
-iconutil -c icns "$ICONSET" -o "$APP/Contents/Resources/AppIcon.icns"
-rm -rf "$ICONSET"
+# App icon: the asset catalog (from scripts/render-icon.py) compiles to Assets.car and AppIcon.icns.
+xcrun actool "$ROOT/Resources/Assets.xcassets" --compile "$APP/Contents/Resources" \
+ --platform macosx --target-device mac --minimum-deployment-target 14.0 \
+ --app-icon AppIcon --output-partial-info-plist "$OUT/assets-info.plist" \
+ --errors --warnings --output-format human-readable-text >/dev/null
+
+# Required-reason API declarations for App Store review.
+cp "$ROOT/Resources/PrivacyInfo.xcprivacy" "$APP/Contents/Resources/PrivacyInfo.xcprivacy"
+
+# The toolchain keys Xcode writes into every app. App Store Connect reads them to check that
+# the app was built with a supported Xcode and SDK.
+XCODE_VERSION="$(xcodebuild -version | awk 'NR == 1 { print $2 }')"
+IFS=. read -r XCODE_MAJOR XCODE_MINOR XCODE_PATCH <<< "$XCODE_VERSION"
+DT_XCODE="$(printf '%d%d%d' "$XCODE_MAJOR" "${XCODE_MINOR:-0}" "${XCODE_PATCH:-0}")"
+DT_XCODE_BUILD="$(xcodebuild -version | awk 'NR == 2 { print $3 }')"
+SDK_BUILD="$(xcrun --sdk macosx --show-sdk-build-version)"
cat > "$APP/Contents/Info.plist" <
@@ -58,17 +74,35 @@ cat > "$APP/Contents/Info.plist" <CFBundleShortVersionString$VERSION
CFBundleVersion$BUILD_NUMBER
CFBundleIconFileAppIcon
+ CFBundleIconNameAppIcon
+ CFBundleInfoDictionaryVersion6.0
+ CFBundleDevelopmentRegionen
+ CFBundleSupportedPlatformsMacOSX
+ NSHumanReadableCopyright$COPYRIGHT
LSMinimumSystemVersion14.0
LSApplicationCategoryTypepublic.app-category.developer-tools
+ ITSAppUsesNonExemptEncryption
NSHighResolutionCapable
NSPrincipalClassNSApplication
NSSupportsAutomaticTermination
+ BuildMachineOSBuild$(sw_vers -buildVersion)
+ DTCompilercom.apple.compilers.llvm.clang.1_0
+ DTPlatformNamemacosx
+ DTPlatformVersion$SDK_VERSION
+ DTPlatformBuild$SDK_BUILD
+ DTSDKNamemacosx$SDK_VERSION
+ DTSDKBuild$SDK_BUILD
+ DTXcode$DT_XCODE
+ DTXcodeBuild$DT_XCODE_BUILD
PLIST
+ENTITLEMENTS="$OUT/BucketBrowser.entitlements"
+cp "$ROOT/Resources/BucketBrowser.entitlements" "$ENTITLEMENTS"
+
if [[ -z "${SIGN_IDENTITY:-}" ]]; then
- codesign --force --deep --sign - "$APP"
+ codesign --force --deep --entitlements "$ENTITLEMENTS" --sign - "$APP"
echo "Built $APP (ad-hoc signed; iCloud sync is off)"
exit 0
fi
@@ -81,19 +115,7 @@ if [[ -z "${PROVISIONING_PROFILE:-}" ]]; then
fi
cp "$PROVISIONING_PROFILE" "$APP/Contents/embedded.provisionprofile"
-ENTITLEMENTS="$OUT/BucketBrowser.entitlements"
-cat > "$ENTITLEMENTS" <
-
-
-
- com.apple.application-identifier$TEAM_ID.$BUNDLE_ID
- com.apple.developer.team-identifier$TEAM_ID
- keychain-access-groups
- $TEAM_ID.$BUNDLE_ID
-
-
-PLIST
+"$ROOT/scripts/add-team-entitlements.sh" "$ENTITLEMENTS" "$TEAM_ID" "$BUNDLE_ID"
codesign --force --options runtime --timestamp \
--entitlements "$ENTITLEMENTS" --sign "$SIGN_IDENTITY" "$APP"
diff --git a/scripts/export-app.sh b/scripts/export-app.sh
new file mode 100755
index 0000000..33315f5
--- /dev/null
+++ b/scripts/export-app.sh
@@ -0,0 +1,119 @@
+#!/usr/bin/env bash
+# Wraps "Bucket Browser.app" in an Xcode archive and has Xcode sign and export it, using the
+# certificates Xcode manages in the cloud for your team.
+#
+# Usage: DEV_PROFILE=path/to/development.provisionprofile scripts/export-app.sh [developer-id|app-store]
+#
+# developer-id (default) An app signed with your Developer ID, for running outside the App
+# Store, in build/export/Bucket Browser.app.
+# app-store An installer package signed for the Mac App Store, in
+# build/export/Bucket Browser.pkg. With UPLOAD=1, Xcode uploads it to
+# App Store Connect instead; the app record must already exist there.
+#
+# Run scripts/build-app.sh first; the ad-hoc build is the input. For the App Store, build it
+# with UNIVERSAL=1 so it runs on Intel Macs too. Xcode must be signed in to an
+# account on team TEAM_ID (default 4TK5PNR392) that can create Developer ID signatures.
+# DEV_PROFILE is a Mac development profile that covers com.bucketbrowser.app and the keychain
+# access group, such as the "Mac Team Provisioning Profile: *" Xcode keeps in
+# ~/Library/Developer/Xcode/UserData/Provisioning Profiles. The exporter replaces it with a
+# Developer ID or Mac App Store profile.
+set -euo pipefail
+
+METHOD="${1:-developer-id}"
+case "$METHOD" in
+ developer-id) EXPORT_METHOD=developer-id ;;
+ app-store) EXPORT_METHOD=app-store-connect ;;
+ *) echo "Usage: scripts/export-app.sh [developer-id|app-store]" >&2; exit 1 ;;
+esac
+
+ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+APP_NAME="Bucket Browser"
+BUNDLE_ID="com.bucketbrowser.app"
+TEAM_ID="${TEAM_ID:-4TK5PNR392}"
+DEV_IDENTITY="${DEV_IDENTITY:-Apple Development}"
+OUT="$ROOT/build"
+SOURCE_APP="$OUT/$APP_NAME.app"
+ARCHIVE="$OUT/BucketBrowser.xcarchive"
+EXPORT="$OUT/export"
+
+if [[ ! -d "$SOURCE_APP" ]]; then
+ echo "Run scripts/build-app.sh first" >&2
+ exit 1
+fi
+if [[ -z "${DEV_PROFILE:-}" ]]; then
+ echo "DEV_PROFILE must point to a Mac development profile for $BUNDLE_ID on team $TEAM_ID" >&2
+ exit 1
+fi
+
+rm -rf "$ARCHIVE" "$EXPORT"
+mkdir -p "$ARCHIVE/Products/Applications"
+ARCHIVED_APP="$ARCHIVE/Products/Applications/$APP_NAME.app"
+cp -R "$SOURCE_APP" "$ARCHIVED_APP"
+cp "$DEV_PROFILE" "$ARCHIVED_APP/Contents/embedded.provisionprofile"
+
+# The exporter keeps the entitlements the archived app is signed with, so sign it with them here.
+ENTITLEMENTS="$OUT/BucketBrowser.entitlements"
+cp "$ROOT/Resources/BucketBrowser.entitlements" "$ENTITLEMENTS"
+"$ROOT/scripts/add-team-entitlements.sh" "$ENTITLEMENTS" "$TEAM_ID" "$BUNDLE_ID"
+codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$DEV_IDENTITY" "$ARCHIVED_APP"
+SIGNED_BY="$(codesign -dvv "$ARCHIVED_APP" 2>&1 | sed -n 's/^Authority=//p' | head -1)"
+
+PLIST_INFO="$ARCHIVED_APP/Contents/Info.plist"
+VERSION="$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "$PLIST_INFO")"
+BUILD_NUMBER="$(/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' "$PLIST_INFO")"
+ARCHS=""
+if [[ "$METHOD" == app-store ]] && ! lipo -archs "$ARCHIVED_APP/Contents/MacOS/BucketBrowser" | grep -q x86_64; then
+ echo "Warning: this build is Apple silicon only. Run UNIVERSAL=1 scripts/build-app.sh to support Intel Macs too." >&2
+fi
+for arch in $(lipo -archs "$ARCHIVED_APP/Contents/MacOS/BucketBrowser"); do
+ ARCHS="$ARCHS$arch"
+done
+
+cat > "$ARCHIVE/Info.plist" <
+
+
+
+ ApplicationProperties
+
+ ApplicationPathApplications/$APP_NAME.app
+ Architectures$ARCHS
+ CFBundleIdentifier$BUNDLE_ID
+ CFBundleShortVersionString$VERSION
+ CFBundleVersion$BUILD_NUMBER
+ SigningIdentity$SIGNED_BY
+ Team$TEAM_ID
+
+ ArchiveVersion2
+ CreationDate$(date -u +%Y-%m-%dT%H:%M:%SZ)
+ Name$APP_NAME
+ SchemeNameBucketBrowser
+
+
+PLIST
+
+EXPORT_OPTIONS="$OUT/ExportOptions.plist"
+cat > "$EXPORT_OPTIONS" <
+
+
+
+ method$EXPORT_METHOD
+ destination$([[ "${UPLOAD:-0}" == 1 ]] && echo upload || echo export)
+ signingStyleautomatic
+ teamID$TEAM_ID
+
+
+PLIST
+
+xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportPath "$EXPORT" \
+ -exportOptionsPlist "$EXPORT_OPTIONS" -allowProvisioningUpdates
+if [[ "${UPLOAD:-0}" == 1 ]]; then
+ echo "Uploaded build $BUILD_NUMBER to App Store Connect"
+elif [[ "$METHOD" == app-store ]]; then
+ pkgutil --check-signature "$EXPORT/$APP_NAME.pkg"
+ echo "Exported $EXPORT/$APP_NAME.pkg"
+else
+ codesign --verify --strict --verbose=2 "$EXPORT/$APP_NAME.app"
+ echo "Exported $EXPORT/$APP_NAME.app"
+fi
diff --git a/scripts/export-developer-id.sh b/scripts/export-developer-id.sh
index f680251..a7b97b9 100755
--- a/scripts/export-developer-id.sh
+++ b/scripts/export-developer-id.sh
@@ -1,105 +1,3 @@
#!/usr/bin/env bash
-# Signs "Bucket Browser.app" with your team's Developer ID through Xcode's cloud signing, for
-# when Xcode manages the Developer ID certificate and its private key isn't in your keychain
-# (so scripts/build-app.sh can't sign with SIGN_IDENTITY).
-#
-# Usage: DEV_PROFILE=path/to/development.provisionprofile scripts/export-developer-id.sh
-#
-# Run scripts/build-app.sh first; the ad-hoc build is the input. Xcode must be signed in to an
-# account on team TEAM_ID (default 4TK5PNR392) that can create Developer ID signatures.
-# DEV_PROFILE is a Mac development profile that covers com.bucketbrowser.app and the keychain
-# access group, such as the "Mac Team Provisioning Profile: *" Xcode keeps in
-# ~/Library/Developer/Xcode/UserData/Provisioning Profiles. The exporter replaces it with a
-# Developer ID profile. The result lands in build/export/Bucket Browser.app.
-set -euo pipefail
-
-ROOT="$(cd "$(dirname "$0")/.." && pwd)"
-APP_NAME="Bucket Browser"
-BUNDLE_ID="com.bucketbrowser.app"
-TEAM_ID="${TEAM_ID:-4TK5PNR392}"
-DEV_IDENTITY="${DEV_IDENTITY:-Apple Development}"
-OUT="$ROOT/build"
-SOURCE_APP="$OUT/$APP_NAME.app"
-ARCHIVE="$OUT/BucketBrowser.xcarchive"
-EXPORT="$OUT/export"
-
-if [[ ! -d "$SOURCE_APP" ]]; then
- echo "Run scripts/build-app.sh first" >&2
- exit 1
-fi
-if [[ -z "${DEV_PROFILE:-}" ]]; then
- echo "DEV_PROFILE must point to a Mac development profile for $BUNDLE_ID on team $TEAM_ID" >&2
- exit 1
-fi
-
-rm -rf "$ARCHIVE" "$EXPORT"
-mkdir -p "$ARCHIVE/Products/Applications"
-ARCHIVED_APP="$ARCHIVE/Products/Applications/$APP_NAME.app"
-cp -R "$SOURCE_APP" "$ARCHIVED_APP"
-cp "$DEV_PROFILE" "$ARCHIVED_APP/Contents/embedded.provisionprofile"
-
-# The exporter keeps the entitlements the archived app is signed with, so sign it with them here.
-ENTITLEMENTS="$OUT/BucketBrowser.entitlements"
-cat > "$ENTITLEMENTS" <
-
-
-
- com.apple.application-identifier$TEAM_ID.$BUNDLE_ID
- com.apple.developer.team-identifier$TEAM_ID
- keychain-access-groups
- $TEAM_ID.$BUNDLE_ID
-
-
-PLIST
-codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$DEV_IDENTITY" "$ARCHIVED_APP"
-SIGNED_BY="$(codesign -dvv "$ARCHIVED_APP" 2>&1 | sed -n 's/^Authority=//p' | head -1)"
-
-PLIST_INFO="$ARCHIVED_APP/Contents/Info.plist"
-VERSION="$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "$PLIST_INFO")"
-BUILD_NUMBER="$(/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' "$PLIST_INFO")"
-ARCHS=""
-for arch in $(lipo -archs "$ARCHIVED_APP/Contents/MacOS/BucketBrowser"); do
- ARCHS="$ARCHS$arch"
-done
-
-cat > "$ARCHIVE/Info.plist" <
-
-
-
- ApplicationProperties
-
- ApplicationPathApplications/$APP_NAME.app
- Architectures$ARCHS
- CFBundleIdentifier$BUNDLE_ID
- CFBundleShortVersionString$VERSION
- CFBundleVersion$BUILD_NUMBER
- SigningIdentity$SIGNED_BY
- Team$TEAM_ID
-
- ArchiveVersion2
- CreationDate$(date -u +%Y-%m-%dT%H:%M:%SZ)
- Name$APP_NAME
- SchemeNameBucketBrowser
-
-
-PLIST
-
-EXPORT_OPTIONS="$OUT/ExportOptions.plist"
-cat > "$EXPORT_OPTIONS" <
-
-
-
- methoddeveloper-id
- signingStyleautomatic
- teamID$TEAM_ID
-
-
-PLIST
-
-xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportPath "$EXPORT" \
- -exportOptionsPlist "$EXPORT_OPTIONS" -allowProvisioningUpdates
-codesign --verify --strict --verbose=2 "$EXPORT/$APP_NAME.app"
-echo "Exported $EXPORT/$APP_NAME.app"
+# Kept for older instructions: same as scripts/export-app.sh developer-id.
+exec "$(dirname "$0")/export-app.sh" developer-id "$@"
diff --git a/scripts/render-icon.py b/scripts/render-icon.py
index 4788d7e..48fa85c 100755
--- a/scripts/render-icon.py
+++ b/scripts/render-icon.py
@@ -1,9 +1,11 @@
#!/usr/bin/env python3
-"""Renders Resources/AppIcon.svg to Resources/AppIcon.png (1024x1024) with soft drop shadows.
+"""Renders Resources/AppIcon.svg to Resources/AppIcon.png (1024x1024) with soft drop shadows,
+and writes every size the Mac app icon set needs to Resources/Assets.xcassets/AppIcon.appiconset.
Needs cairosvg and Pillow: pip install cairosvg pillow
"""
import io
+import json
import re
import sys
from pathlib import Path
@@ -50,3 +52,18 @@ def shadow(image, offset, blur, opacity, color=(0, 0, 0)):
out = Path(sys.argv[1]) if len(sys.argv) > 1 else ROOT / "Resources" / "AppIcon.png"
icon.save(out)
print(f"Wrote {out}")
+
+# The icon set scripts/build-app.sh compiles with actool: 16 to 512 points, at 1x and 2x.
+ICONSET = ROOT / "Resources" / "Assets.xcassets" / "AppIcon.appiconset"
+ICONSET.mkdir(parents=True, exist_ok=True)
+images = []
+for points in (16, 32, 128, 256, 512):
+ for scale in (1, 2):
+ name = f"icon_{points}x{points}{'@2x' if scale == 2 else ''}.png"
+ pixels = points * scale
+ icon.resize((pixels, pixels), Image.LANCZOS).save(ICONSET / name)
+ images.append({"filename": name, "idiom": "mac", "scale": f"{scale}x", "size": f"{points}x{points}"})
+contents = {"images": images, "info": {"author": "xcode", "version": 1}}
+(ICONSET / "Contents.json").write_text(json.dumps(contents, indent=2) + "\n")
+(ICONSET.parent / "Contents.json").write_text(json.dumps({"info": {"author": "xcode", "version": 1}}, indent=2) + "\n")
+print(f"Wrote {ICONSET}")