diff --git a/Source/LuckyWorld.Target.cs b/Source/LuckyWorld.Target.cs index 99cc338a..02465f3b 100644 --- a/Source/LuckyWorld.Target.cs +++ b/Source/LuckyWorld.Target.cs @@ -9,8 +9,15 @@ public class LuckyWorldTarget : TargetRules { Type = TargetType.Game; DefaultBuildSettings = BuildSettingsVersion.V5; + + // Fix for "Targets with a unique build environment cannot be built with an installed engine" bOverrideBuildEnvironment = true; - + BuildEnvironment = TargetBuildEnvironment.Shared; + + // Ensure proper build configuration + bUseLoggingInShipping = true; + bShouldCompileAsDLL = false; + ExtraModuleNames.AddRange( new string[] { "LuckyWorld" } ); IncludeOrderVersion = EngineIncludeOrderVersion.Latest; @@ -28,8 +35,8 @@ public class LuckyWorldTarget : TargetRules GlobalDefinitions.Add("APP_BUNDLE_NAME=LuckyWorld"); GlobalDefinitions.Add("APP_BUNDLE_DISPLAY_NAME=LuckyWorld"); - // Disable automatic code signing - bDisableAutomaticCodeSigning = true; + // Don't use local automatic code signing for builds + // bDisableAutomaticCodeSigning property is not available in UE 5.5 } } } diff --git a/Source/LuckyWorldEditor.Target.cs b/Source/LuckyWorldEditor.Target.cs index db543322..e2aa741f 100644 --- a/Source/LuckyWorldEditor.Target.cs +++ b/Source/LuckyWorldEditor.Target.cs @@ -9,7 +9,13 @@ public class LuckyWorldEditorTarget : TargetRules { Type = TargetType.Editor; DefaultBuildSettings = BuildSettingsVersion.V5; + + // Fix for "Targets with a unique build environment cannot be built with an installed engine" bOverrideBuildEnvironment = true; + BuildEnvironment = TargetBuildEnvironment.Shared; + + // Ensure proper build configuration + bShouldCompileAsDLL = false; ExtraModuleNames.AddRange( new string[] { "LuckyWorld" } ); diff --git a/scripts/mac_build.sh b/scripts/mac_build.sh index 9162c8c4..429f26c9 100755 --- a/scripts/mac_build.sh +++ b/scripts/mac_build.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e # Exit on any error # Get the user's home directory USER_HOME="$HOME" @@ -27,44 +28,43 @@ echo "Project root: $PROJECT_ROOT" echo "Project file: $PROJECT_FILE" echo "Archive directory: $ARCHIVE_DIR" -# Clean up previous build artifacts -rm -rf DerivedDataCache Intermediate Binaries Saved +# More selective cleanup - don't remove DerivedDataCache +echo "๐Ÿงน Cleaning build artifacts..." +rm -rf Intermediate/Build/Mac Saved/Cooked +mkdir -p "$ARCHIVE_DIR" # Generate project files echo "๐Ÿ“ Generating project files..." "$UE_ROOT/Engine/Build/BatchFiles/Mac/GenerateProjectFiles.sh" -project="$PROJECT_FILE" -game -engine -# Run the build command +# Run the build command with simplified parameters and more diagnostics echo "๐Ÿ”จ Starting build process..." -"$UE_UAT" -ScriptsForProject="$PROJECT_FILE" Turnkey \ - -command=VerifySdk \ +"$UE_UAT" -ScriptsForProject="$PROJECT_FILE" BuildCookRun \ + -project="$PROJECT_FILE" \ -platform=Mac \ - -UpdateIfNeeded \ - -EditorIO \ - -EditorIOPort=59484 \ - -project="$PROJECT_FILE" \ - BuildCookRun \ - -nop4 \ - -utf8output \ - -cook \ - -project="$PROJECT_FILE" \ + -clientconfig=Shipping \ -target=LuckyWorld \ - -unrealexe="$UE_EDITOR" \ - -platform=Mac \ - -installed \ + -build \ + -cook -iterate -CookOnTheFly -CookMapsOnly \ -stage \ -skipStage=SignExecutables \ - -archive \ - -package \ - -build \ - -iterativecooking \ -pak \ - -iostore \ -compressed \ -prereqs \ + -iostore \ + -package \ + -archive \ -archivedirectory="$ARCHIVE_DIR" \ - -CrashReporter \ - -clientconfig=Shipping + -verbose \ + -ddc=DerivedDataBackendGraph \ + -CrashReporter + +# Check for errors in the build process +BUILD_STATUS=$? +if [ $BUILD_STATUS -ne 0 ]; then + echo "โŒ ERROR: Build command failed with exit code $BUILD_STATUS" + exit $BUILD_STATUS +fi echo "" echo "๐Ÿ” Looking for built application..." @@ -74,9 +74,11 @@ APP_PATH=$(find "$ARCHIVE_DIR" -name "*.app" -type d | head -n 1) if [ -z "$APP_PATH" ] || [ ! -d "$APP_PATH" ]; then echo "โŒ ERROR: Build failed or did not produce an app bundle!" echo "Check the logs above for build errors." - echo "Common issues:" - echo " - 'Targets with a unique build environment cannot be built with an installed engine'" - echo " Fix: Use bOverrideBuildEnvironment = true instead of BuildEnvironment = TargetBuildEnvironment.Unique" + + # List all files in the archive directory to help debug + echo "Contents of archive directory:" + find "$ARCHIVE_DIR" -type f -o -type d | sort + exit 1 fi