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
4 changes: 3 additions & 1 deletion Configs/Config.xcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// FreeMount Base Configuration
// Conditionally includes local secrets if present.
// Default bundle identifier prefix (overridden per-team in Secrets.xcconfig for source builds).
FREEMOUNT_BUNDLE_IDENTIFIER = com.freemount.app

// Conditionally includes local secrets if present.
#include? "Secrets.xcconfig"
5 changes: 5 additions & 0 deletions Configs/Secrets.xcconfig.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ FREEMOUNT_GOOGLE_CLIENT_ID = 319728381325-v71u1mjithqc6ovqvbb4mnc0hhbf0r65.apps.
FREEMOUNT_GOOGLE_CLIENT_SECRET = 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

DEVELOPMENT_TEAM =

// Optional: override the app bundle identifier (recommended for Personal Team
// builds so Apple's Developer Portal does not reject shared IDs;
// scripts/install-from-source.sh sets this to com.freemount.app.<DEVELOPMENT_TEAM>).
// FREEMOUNT_BUNDLE_IDENTIFIER = com.freemount.app
8 changes: 4 additions & 4 deletions FreeMount.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.freemount.app.fileprovider;
PRODUCT_BUNDLE_IDENTIFIER = "$(FREEMOUNT_BUNDLE_IDENTIFIER).fileprovider";
PRODUCT_NAME = FreeMountFileProvider;
SDKROOT = macosx;
SKIP_INSTALL = NO;
Expand Down Expand Up @@ -1026,7 +1026,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.freemount.app;
PRODUCT_BUNDLE_IDENTIFIER = "$(FREEMOUNT_BUNDLE_IDENTIFIER)";
PRODUCT_NAME = FM;
SDKROOT = macosx;
};
Expand Down Expand Up @@ -1102,7 +1102,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.freemount.app;
PRODUCT_BUNDLE_IDENTIFIER = "$(FREEMOUNT_BUNDLE_IDENTIFIER)";
PRODUCT_NAME = FM;
SDKROOT = macosx;
};
Expand All @@ -1125,7 +1125,7 @@
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.freemount.app.fileprovider;
PRODUCT_BUNDLE_IDENTIFIER = "$(FREEMOUNT_BUNDLE_IDENTIFIER).fileprovider";
PRODUCT_NAME = FreeMountFileProvider;
SDKROOT = macosx;
SKIP_INSTALL = NO;
Expand Down
1 change: 1 addition & 0 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Edit `Configs/Secrets.xcconfig` (git-ignored):
| Key | Where to get it |
|---|---|
| `DEVELOPMENT_TEAM` | Your Team ID: Xcode → Settings → Accounts → select your team |
| `FREEMOUNT_BUNDLE_IDENTIFIER` | Optional (defaults to `com.freemount.app`); set to `com.freemount.app.<DEVELOPMENT_TEAM>` for Personal Team builds (`scripts/install-from-source.sh` configures this automatically) |
| `FREEMOUNT_GOOGLE_CLIENT_ID` / `FREEMOUNT_GOOGLE_CLIENT_SECRET` | Defaults are bundled; optionally your own Google Cloud Console **Desktop app** OAuth client |

The repository bundles a default Google Desktop OAuth client (public by
Expand Down
4 changes: 2 additions & 2 deletions project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ targets:
buildPhase: resources
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: com.freemount.app
PRODUCT_BUNDLE_IDENTIFIER: $(FREEMOUNT_BUNDLE_IDENTIFIER)
PRODUCT_NAME: FM
ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
INFOPLIST_FILE: App/Resources/Info.plist
Expand Down Expand Up @@ -57,7 +57,7 @@ targets:
buildPhase: resources
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: com.freemount.app.fileprovider
PRODUCT_BUNDLE_IDENTIFIER: $(FREEMOUNT_BUNDLE_IDENTIFIER).fileprovider
PRODUCT_NAME: FreeMountFileProvider
INFOPLIST_FILE: App/FileProviderExtension/Info.plist
CODE_SIGN_ENTITLEMENTS: App/FileProviderExtension/FreeMountFileProvider.entitlements
Expand Down
24 changes: 22 additions & 2 deletions scripts/install-from-source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
#
# What it does: checks prerequisites, prepares Configs/Secrets.xcconfig
# (Google OAuth client defaults ship in the repo), detects or takes your
# personal team ID, builds Release, signs with your Apple Development
# identity and installs. Re-run the same command to update after `git pull`.
# personal team ID, sets a team-scoped bundle identifier, builds Release,
# signs with your Apple Development identity and installs. Re-run the same
# command to update after `git pull`.

set -euo pipefail
cd "${0:A:h:h}"
Expand Down Expand Up @@ -73,11 +74,27 @@ print(" ".join(seen))
print "Auto-detected team $team and saved it to Configs/Secrets.xcconfig."
fi

# Resolve team-scoped bundle identifier so personal-team builds do not collide
# with globally registered App IDs in Apple's Developer Portal.
bundle_id="$(awk -F'=' '/^FREEMOUNT_BUNDLE_IDENTIFIER[ \t]*=/ {gsub(/[ \t]/,"",$2); print $2}' Configs/Secrets.xcconfig)"
if [[ -z "$bundle_id" ]]; then
bundle_id="com.freemount.app.$team"
if grep -q '^FREEMOUNT_BUNDLE_IDENTIFIER[ \t]*=' Configs/Secrets.xcconfig; then
sed -i '' "s/^FREEMOUNT_BUNDLE_IDENTIFIER[ \t]*=.*/FREEMOUNT_BUNDLE_IDENTIFIER = $bundle_id/" Configs/Secrets.xcconfig
else
printf '\nFREEMOUNT_BUNDLE_IDENTIFIER = %s\n' "$bundle_id" >> Configs/Secrets.xcconfig
fi
print "Configured team-scoped bundle ID $bundle_id in Configs/Secrets.xcconfig."
elif [[ -n "$team_override" && "$bundle_id" == com.freemount.app.* ]]; then
bundle_id="com.freemount.app.$team"
fi

print "Building Release (first run may take a few minutes; Xcode provisions your personal team automatically)…"
xcodebuild -project FreeMount.xcodeproj -scheme FreeMount \
-configuration Release -destination 'platform=macOS' \
-derivedDataPath build/install-dd \
DEVELOPMENT_TEAM="$team" \
FREEMOUNT_BUNDLE_IDENTIFIER="$bundle_id" \
-allowProvisioningUpdates \
build >/tmp/freemount-install-build.log 2>&1 || {
tail -20 /tmp/freemount-install-build.log
Expand All @@ -90,6 +107,9 @@ codesign --verify --deep --strict "$APP" || { print -u2 "Built bundle failed sig

# Record repository directory in user defaults so the app knows where to pull updates from
defaults write com.freemount.app FreeMountSourceRepositoryPath "$PWD"
if [[ "$bundle_id" != "com.freemount.app" ]]; then
defaults write "$bundle_id" FreeMountSourceRepositoryPath "$PWD"
fi

pkill -x FM 2>/dev/null || true
if [[ -d /Applications/FreeMount.app ]]; then rm -rf /Applications/FreeMount.app; fi
Expand Down
Loading