Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Apple/ApplePlatform.Automation.cs
Josh Adams e6e825cc8d - Made ApplePlatform.Automation to share code betwen Mac and IOS
#rb adam.kinge
#jira none
#preflight 6346edec8d665d55d04a5478
#preflight 635174bfe6096564af0b8a57

[CL 22659145 by Josh Adams in ue5-main branch]
2022-10-20 12:22:07 -04:00

67 lines
2.2 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Linq;
using System.Text;
using System.IO;
using AutomationTool;
using UnrealBuildTool;
using EpicGames.Core;
using UnrealBuildBase;
using System.Diagnostics;
public abstract class ApplePlatform : Platform
{
public ApplePlatform(UnrealTargetPlatform TargetPlatform)
: base(TargetPlatform)
{
}
public override bool GetSDKInstallCommand(out string Command, out string Params, ref bool bRequiresPrivilegeElevation, ref bool bCreateWindow, ITurnkeyContext TurnkeyContext)
{
Command = "";
Params = "";
if (UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac)
{
TurnkeyContext.Log("Moving your original Xcode application from /Applications to the Trash, and unzipping the new version into /Applications");
// put current Xcode in the trash, and unzip a new one. Xcode in the dock will have to be fixed up tho!
Command = "osascript";
Params =
" -e \"try\"" +
" -e \"tell application \\\"Finder\\\" to delete POSIX file \\\"/Applications/Xcode.app\\\"\"" +
" -e \"end try\"" +
" -e \"do shell script \\\"cd /Applications; xip --expand $(CopyOutputPath);\\\"\"" +
" -e \"try\"" +
" -e \"do shell script \\\"xcode-select -s /Applications/Xcode.app; xcode-select --install; xcodebuild -license accept; xcodebuild -runFirstLaunch\\\" with administrator privileges\"" +
" -e \"end try\"";
}
else if (UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64)
{
TurnkeyContext.Log("Uninstalling old iTunes and preparing the new one to be installed.");
Command = "$(EngineDir)/Extras/iTunes/Install_iTunes.bat";
Params = "$(CopyOutputPath)";
}
return true;
}
public override bool OnSDKInstallComplete(int ExitCode, ITurnkeyContext TurnkeyContext, DeviceInfo Device)
{
if (Device == null)
{
if (ExitCode == 0)
{
if (UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac)
{
TurnkeyContext.PauseForUser("If you had Xcode in your Dock, you will need to remove it and add the new one (even though it was in the same location). macOS follows the move to the Trash for the Dock icon");
}
}
}
return ExitCode == 0;
}
}