/// <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);
            }
        }
Beispiel #2
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);
        }