fix(actions): add bundle ID verification and nested app bundle handling in macOS build workflow
Some checks failed
Test macOS Build Action / test-macos-build (push) Has been cancelled

This commit is contained in:
Ozgur 2025-04-15 01:22:42 +02:00
parent 2b40fb0394
commit c57938c995
No known key found for this signature in database
GPG Key ID: 66CDF27505A35546
4 changed files with 69 additions and 3 deletions

View File

@ -66,6 +66,30 @@ jobs:
else else
echo "⚠️ DefaultGame.ini not found!" echo "⚠️ DefaultGame.ini not found!"
fi fi
# Verify Build.cs and Target.cs files
BUILD_CS="Source/LuckyWorld/LuckyWorld.Build.cs"
TARGET_CS="Source/LuckyWorld.Target.cs"
if [ -f "$BUILD_CS" ]; then
if grep -q "APP_BUNDLE_IDENTIFIER=com.luckyrobots.luckyworld" "$BUILD_CS"; then
echo "✅ Bundle ID correctly set in LuckyWorld.Build.cs"
else
echo "⚠️ Warning: Bundle ID may not be correctly set in LuckyWorld.Build.cs"
fi
else
echo "⚠️ LuckyWorld.Build.cs not found!"
fi
if [ -f "$TARGET_CS" ]; then
if grep -q "APP_BUNDLE_IDENTIFIER=com.luckyrobots.luckyworld" "$TARGET_CS"; then
echo "✅ Bundle ID correctly set in LuckyWorld.Target.cs"
else
echo "⚠️ Warning: Bundle ID may not be correctly set in LuckyWorld.Target.cs"
fi
else
echo "⚠️ LuckyWorld.Target.cs not found!"
fi
shell: bash shell: bash
# Check Unreal Engine Project settings # Check Unreal Engine Project settings

View File

@ -18,5 +18,12 @@ public class LuckyWorldTarget : TargetRules
{ {
this.bUseLoggingInShipping = true; this.bUseLoggingInShipping = true;
} }
// macOS specific settings
if (Target.Platform == UnrealTargetPlatform.Mac)
{
// Force use the bundle ID from DefaultGame.ini
GlobalDefinitions.Add("APP_BUNDLE_IDENTIFIER=com.luckyrobots.luckyworld");
}
} }
} }

View File

@ -19,5 +19,11 @@ public class LuckyWorld : ModuleRules
// PrivateDependencyModuleNames.Add("OnlineSubsystem"); // PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
// Set the bundle identifier for macOS builds
if (Target.Platform == UnrealTargetPlatform.Mac)
{
PublicDefinitions.Add("APP_BUNDLE_IDENTIFIER=com.luckyrobots.luckyworld");
}
} }
} }

View File

@ -116,9 +116,38 @@ echo "🔧 Performing post-build fix for bundle ID..."
if [ -n "$APP_PATH" ]; then if [ -n "$APP_PATH" ]; then
INFO_PLIST="$APP_PATH/Contents/Info.plist" INFO_PLIST="$APP_PATH/Contents/Info.plist"
if [ -f "$INFO_PLIST" ]; then if [ -f "$INFO_PLIST" ]; then
CURRENT_BUNDLE_ID=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$INFO_PLIST")
echo "Current bundle ID: $CURRENT_BUNDLE_ID"
if [ "$CURRENT_BUNDLE_ID" != "com.luckyrobots.luckyworld" ]; then
echo "Bundle ID mismatch - fixing it!"
echo "Setting bundle identifier to com.luckyrobots.luckyworld" echo "Setting bundle identifier to com.luckyrobots.luckyworld"
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier com.luckyrobots.luckyworld" "$INFO_PLIST" /usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier com.luckyrobots.luckyworld" "$INFO_PLIST"
echo "Updated bundle ID: $(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$INFO_PLIST")" echo "Updated bundle ID: $(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$INFO_PLIST")"
else
echo "Bundle ID is already correct: com.luckyrobots.luckyworld"
fi
# Find and repair nested app bundles as well (like CrashReportClient.app)
echo "Checking for nested app bundles..."
NESTED_APPS=$(find "$APP_PATH" -name "*.app" -type d)
if [ -n "$NESTED_APPS" ]; then
echo "Found nested app bundles, fixing their bundle IDs:"
echo "$NESTED_APPS" | while read -r NESTED_APP; do
if [ -f "$NESTED_APP/Contents/Info.plist" ]; then
NESTED_NAME=$(basename "$NESTED_APP" .app)
NESTED_BUNDLE_ID="com.luckyrobots.luckyworld.$NESTED_NAME"
echo "Setting nested bundle ID to $NESTED_BUNDLE_ID for $NESTED_APP"
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $NESTED_BUNDLE_ID" "$NESTED_APP/Contents/Info.plist"
# Verify the change
UPDATED_ID=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$NESTED_APP/Contents/Info.plist")
echo "Updated nested app bundle ID: $UPDATED_ID"
fi
done
else
echo "No nested app bundles found."
fi
else else
echo "⚠️ Info.plist not found at $INFO_PLIST" echo "⚠️ Info.plist not found at $INFO_PLIST"
fi fi