/// <summary>
        /// Gets the latest write time of any of the UnrealHeaderTool binaries (including DLLs and Plugins) or DateTime.MaxValue if UnrealHeaderTool does not exist
        /// </summary>
        /// <returns>
        /// Latest timestamp of UHT binaries or DateTime.MaxValue if UnrealHeaderTool is out of date and needs to be rebuilt.
        /// </returns>
        static bool GetHeaderToolTimestamp(out DateTime Timestamp)
        {
            using (var TimestampTimer = new ScopedTimer("GetHeaderToolTimestamp"))
            {
                // Try to read the receipt for UHT.
                string ReceiptPath = TargetReceipt.GetDefaultPath(BuildConfiguration.RelativeEnginePath, "UnrealHeaderTool", BuildHostPlatform.Current.Platform, UnrealTargetConfiguration.Development, null);
                if (!File.Exists(ReceiptPath))
                {
                    Timestamp = DateTime.MaxValue;
                    return(false);
                }

                TargetReceipt Receipt;
                if (!TargetReceipt.TryRead(ReceiptPath, out Receipt))
                {
                    Timestamp = DateTime.MaxValue;
                    return(false);
                }
                Receipt.ExpandPathVariables(UnrealBuildTool.EngineDirectory, UnrealBuildTool.EngineDirectory);

                // Check all the binaries exist, and that all the DLLs are built against the right version
                if (!CheckBinariesExist(Receipt) || !CheckDynamicLibaryVersionsMatch(Receipt))
                {
                    Timestamp = DateTime.MaxValue;
                    return(false);
                }

                // Return the timestamp for all the binaries
                Timestamp = GetTimestampFromBinaries(Receipt);
                return(true);
            }
        }
        public void InitUPL(string ProjectName, DirectoryReference ProjectDirectory, UnrealTargetConfiguration Configuration)
        {
            string UE4BuildPath        = Path.Combine(ProjectDirectory.FullName, "Intermediate/Lumin/Mabu");
            string RelativeEnginePath  = UnrealBuildTool.EngineDirectory.MakeRelativeTo(DirectoryReference.GetCurrentDirectory());
            string RelativeProjectPath = ProjectDirectory.MakeRelativeTo(DirectoryReference.GetCurrentDirectory());            //.MakeRelativeTo(ProjectDirectory);

            UnrealTargetPlatform Platform = UnrealTargetPlatform.Lumin;
            string ConfigurationString    = Configuration.ToString();

            string        Architecture = "arm64-v8a";
            List <string> MLSDKArches  = new List <string>();

            MLSDKArches.Add(Architecture);

            // get the receipt
            FileReference ReceiptFilename = TargetReceipt.GetDefaultPath(ProjectDirectory, ProjectName, Platform, Configuration, "");

            if (!File.Exists(ReceiptFilename.ToString()))
            {
                ReceiptFilename = TargetReceipt.GetDefaultPath(UnrealBuildTool.EngineDirectory, "UE4Game", Platform, Configuration, "");
            }
            Log.TraceInformation("Receipt Filename: {0}", ReceiptFilename);
            SetLuminPluginData(MLSDKArches, CollectPluginDataPaths(TargetReceipt.Read(ReceiptFilename, UnrealBuildTool.EngineDirectory, ProjectDirectory)));

            //gather all of the xml
            UPL.Init(MLSDKArches, true, RelativeEnginePath, UE4BuildPath, RelativeProjectPath, ConfigurationString);
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        public static bool SupportsIconCatalog(UnrealTargetConfiguration Config, DirectoryReference ProjectDirectory, bool bIsUE4Game, string ProjectName)
        {
            // get the receipt
            FileReference ReceiptFilename;

            if (bIsUE4Game)
            {
                ReceiptFilename = TargetReceipt.GetDefaultPath(UnrealBuildTool.EngineDirectory, "UE4Game", UnrealTargetPlatform.IOS, Config, "");
            }
            else
            {
                ReceiptFilename = TargetReceipt.GetDefaultPath(ProjectDirectory, ProjectName, UnrealTargetPlatform.IOS, Config, "");
            }

            string RelativeEnginePath = UnrealBuildTool.EngineDirectory.MakeRelativeTo(DirectoryReference.GetCurrentDirectory());

            if (System.IO.File.Exists(ReceiptFilename.FullName))
            {
                TargetReceipt Receipt = TargetReceipt.Read(ReceiptFilename, UnrealBuildTool.EngineDirectory, ProjectDirectory);
                var           Results = Receipt.AdditionalProperties.Where(x => x.Name == "SDK");

                if (Results.Count() > 0)
                {
                    if (Single.Parse(Results.ElementAt(0).Value) >= 11.0f)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(false);
        }
        public override bool PrepTargetForDeployment(UEBuildTarget InTarget)
        {
            string SubDir = GetTargetPlatformName();

            string GameName         = InTarget.TargetName;
            string BuildPath        = (GameName == "UE4Game" ? "../../Engine" : InTarget.ProjectDirectory.FullName) + "/Binaries/" + SubDir;
            string ProjectDirectory = InTarget.ProjectDirectory.FullName;
            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());
            }

            // Run through iOS APL file
            IOSPlatformContext PlatformContext = new IOSPlatformContext(InTarget.ProjectFile);

            PlatformContext.SetUpProjectEnvironment(InTarget.Configuration);

            string BaseSoName = InTarget.OutputPaths[0].FullName;

            // get the receipt
            UnrealTargetPlatform      Platform      = InTarget.Platform;
            UnrealTargetConfiguration Configuration = InTarget.Configuration;
            string ProjectBaseName = Path.GetFileName(BaseSoName).Replace("-" + Platform, "").Replace("-" + Configuration, "").Replace(".so", "");
            string ReceiptFilename = TargetReceipt.GetDefaultPath(InTarget.ProjectDirectory.FullName, ProjectBaseName, Platform, Configuration, "");

            Log.TraceInformation("Receipt Filename: {0}", ReceiptFilename);
            SetIOSPluginData(PlatformContext.ProjectArches, CollectPluginDataPaths(TargetReceipt.Read(ReceiptFilename)));

            string BundlePath = Path.Combine(ProjectDirectory, "Binaries", "IOS", "Payload", ProjectBaseName + ".app");

            // Passing in true for distribution is not ideal here but given the way that ios packaging happens and this call chain it seems unavoidable for now, maybe there is a way to correctly pass it in that I can't find?
            UPL.Init(PlatformContext.ProjectArches, true, BuildConfiguration.RelativeEnginePath, BundlePath, ProjectDirectory);

            if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac && Environment.GetEnvironmentVariable("UBT_NO_POST_DEPLOY") != "true")
            {
                return(PrepForUATPackageOrDeploy(InTarget.ProjectFile, GameName, ProjectDirectory, BuildPath + "/" + DecoratedGameName, "../../Engine", false, "", false));
            }
            else
            {
                // @todo tvos merge: This used to copy the bundle back - where did that code go? It needs to be fixed up for TVOS directories
                GeneratePList(ProjectDirectory, bIsUE4Game, GameName, (InTarget.ProjectFile == null) ? "" : Path.GetFileNameWithoutExtension(InTarget.ProjectFile.FullName), "../../Engine", "");
            }
            return(true);
        }
Beispiel #5
0
        public override bool PrepTargetForDeployment(TargetReceipt Receipt)
        {
            // Use the project name if possible - InTarget.AppName changes for 'Client'/'Server' builds
            string ProjectName = Receipt.ProjectFile != null?Receipt.ProjectFile.GetFileNameWithoutAnyExtensions() : Receipt.Launch.GetFileNameWithoutExtension();

            Log.TraceInformation("Prepping {0} for deployment to {1}", ProjectName, Receipt.Platform.ToString());
            System.DateTime PrepDeployStartTime = DateTime.UtcNow;

            // Note: TargetReceipt.Read now expands path variables internally.
            TargetReceipt NewReceipt      = null;
            FileReference ReceiptFileName = TargetReceipt.GetDefaultPath(Receipt.ProjectDir != null ? Receipt.ProjectDir : UnrealBuildTool.EngineDirectory, Receipt.TargetName, Receipt.Platform, Receipt.Configuration, "Multi");

            if (!TargetReceipt.TryRead(ReceiptFileName, UnrealBuildTool.EngineDirectory, out NewReceipt))
            {
                NewReceipt = new TargetReceipt(Receipt.ProjectFile, Receipt.TargetName, Receipt.TargetType, Receipt.Platform, Receipt.Configuration, Receipt.Version, "Multi");
            }

            AddWinMDReferencesFromReceipt(Receipt, Receipt.ProjectDir != null ? Receipt.ProjectDir : UnrealBuildTool.EngineDirectory, UnrealBuildTool.EngineDirectory.ParentDirectory.FullName);

            //PrepForUATPackageOrDeploy(InTarget.ProjectFile, InAppName, InTarget.ProjectDirectory.FullName, InTarget.OutputPath.FullName, TargetBuildEnvironment.RelativeEnginePath, false, "", false);
            List <UnrealTargetConfiguration> TargetConfigs = new List <UnrealTargetConfiguration> {
                Receipt.Configuration
            };
            List <string> ExePaths = new List <string> {
                Receipt.Launch.FullName
            };
            string RelativeEnginePath = UnrealBuildTool.EngineDirectory.MakeRelativeTo(DirectoryReference.GetCurrentDirectory());

            WindowsArchitecture Arch = WindowsArchitecture.ARM64;

            if (Receipt.Architecture.ToLower() == "x64")
            {
                Arch = WindowsArchitecture.x64;
            }

            string SDK     = "";
            var    Results = Receipt.AdditionalProperties.Where(x => x.Name == "SDK");

            if (Results.Any())
            {
                SDK = Results.First().Value;
            }
            HoloLensExports.InitWindowsSdkToolPath(SDK);

            string AbsoluteExeDirectory         = Path.GetDirectoryName(ExePaths[0]);
            UnrealTargetPlatform Platform       = UnrealTargetPlatform.HoloLens;
            string        IntermediateDirectory = Path.Combine(Receipt.ProjectDir != null ? Receipt.ProjectDir.FullName : UnrealBuildTool.EngineDirectory.FullName, "Intermediate", "Deploy", WindowsExports.GetArchitectureSubpath(Arch));
            List <string> UpdatedFiles          = new HoloLensManifestGenerator().CreateManifest(Platform, Arch, AbsoluteExeDirectory, IntermediateDirectory, Receipt.ProjectFile, Receipt.ProjectDir != null ? Receipt.ProjectDir.FullName : UnrealBuildTool.EngineDirectory.FullName, TargetConfigs, ExePaths, WinMDReferences);

            PrepForUATPackageOrDeploy(Receipt.ProjectFile, ProjectName, Receipt.ProjectDir != null ? Receipt.ProjectDir.FullName : UnrealBuildTool.EngineDirectory.FullName, Arch, TargetConfigs, ExePaths, RelativeEnginePath, false, "", false);
            MakePackage(Receipt, NewReceipt, Arch, UpdatedFiles);
            CopyDataAndSymbolsBetweenReceipts(Receipt, NewReceipt, Arch);

            NewReceipt.Write(ReceiptFileName, UnrealBuildTool.EngineDirectory);

            // Log out the time taken to deploy...
            double PrepDeployDuration = (DateTime.UtcNow - PrepDeployStartTime).TotalSeconds;

            Log.TraceInformation("HoloLens deployment preparation took {0:0.00} seconds", PrepDeployDuration);

            return(true);
        }