コード例 #1
0
ファイル: UEDeployIOS.cs プロジェクト: emperor-katax/unreal
        public override bool PrepTargetForDeployment(UEBuildTarget InTarget)
        {
            string GameName         = InTarget.TargetName;
            string BuildPath        = (GameName == "UE4Game" ? "../../Engine" : InTarget.ProjectDirectory) + "/Binaries/IOS";
            string ProjectDirectory = InTarget.ProjectDirectory;
            bool   bIsUE4Game       = GameName.Contains("UE4Game");

            string DecoratedGameName;

            if (InTarget.Configuration == UnrealTargetConfiguration.Development)
            {
                DecoratedGameName = GameName;
            }
            else
            {
                DecoratedGameName = String.Format("{0}-{1}-{2}", GameName, InTarget.Platform.ToString(), InTarget.Configuration.ToString());
            }

            if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac && Environment.GetEnvironmentVariable("UBT_NO_POST_DEPLOY") != "true")
            {
                return(PrepForUATPackageOrDeploy(GameName, ProjectDirectory, BuildPath + "/" + DecoratedGameName, "../../Engine", false, "", false));
            }
            else
            {
                // If it is requested, send the app bundle back to the platform executing these commands.
                if (BuildConfiguration.bCopyAppBundleBackToDevice)
                {
                    Log.TraceInformation("Copying binaries back to this device...");

                    IOSToolChain Toolchain = UEToolChain.GetPlatformToolChain(CPPTargetPlatform.IOS) as IOSToolChain;

                    try
                    {
                        string BinaryDir = Path.GetDirectoryName(InTarget.OutputPath) + "\\";
                        if (BinaryDir.EndsWith(InTarget.AppName + "\\Binaries\\IOS\\") && InTarget.TargetType != TargetRules.TargetType.Game)
                        {
                            BinaryDir = BinaryDir.Replace(InTarget.TargetType.ToString(), "Game");
                        }

                        // Get the app bundle's name
                        string AppFullName = InTarget.AppName;
                        if (InTarget.Configuration != UnrealTargetConfiguration.Development)
                        {
                            AppFullName += "-" + InTarget.Platform.ToString();
                            AppFullName += "-" + InTarget.Configuration.ToString();
                        }

                        foreach (string BinaryPath in Toolchain.BuiltBinaries)
                        {
                            if (!BinaryPath.Contains("Dummy"))
                            {
                                RPCUtilHelper.CopyFile(Toolchain.ConvertPath(BinaryPath), BinaryPath, false);
                            }
                        }
                        Log.TraceInformation("Copied binaries successfully.");
                    }
                    catch (Exception)
                    {
                        Log.TraceInformation("Copying binaries back to this device failed.");
                    }
                }

                GeneratePList(ProjectDirectory, bIsUE4Game, GameName, Path.GetFileNameWithoutExtension(UnrealBuildTool.GetUProjectFile()), "../../Engine", "");
            }
            return(true);
        }