/// <summary> /// Read a receipt from disk. /// </summary> /// <param name="Location">Filename to read from</param> public static PrecompiledManifest Read(FileReference Location) { DirectoryReference BaseDir = Location.Directory; PrecompiledManifest Manifest = new PrecompiledManifest(); JsonObject RawObject = JsonObject.Read(Location); string[] OutputFiles = RawObject.GetStringArrayField("OutputFiles"); foreach (string OutputFile in OutputFiles) { Manifest.OutputFiles.Add(FileReference.Combine(BaseDir, OutputFile)); } return(Manifest); }
/// <summary> /// Try to read a manifest from disk, failing gracefully if it can't be read. /// </summary> /// <param name="Location">Filename to read from</param> /// <param name="Manifest">If successful, the manifest that was read</param> /// <returns>True if successful</returns> public static bool TryRead(FileReference Location, out PrecompiledManifest Manifest) { if (!FileReference.Exists(Location)) { Manifest = null; return(false); } try { Manifest = Read(Location); return(true); } catch (Exception) { Manifest = null; return(false); } }
/// <summary> /// Gets all build products produced by this binary /// </summary> /// <param name="Target">The target being built</param> /// <param name="ToolChain">The platform toolchain</param> /// <param name="BuildProducts">Mapping of produced build product to type</param> /// <param name="bCreateDebugInfo">Whether debug info is enabled for this binary</param> public void GetBuildProducts(ReadOnlyTargetRules Target, UEToolChain ToolChain, Dictionary <FileReference, BuildProductType> BuildProducts, bool bCreateDebugInfo) { // Add all the precompiled outputs foreach (UEBuildModuleCPP Module in Modules.OfType <UEBuildModuleCPP>()) { if (Module.Rules.bPrecompile) { if (Module.GeneratedCodeDirectory != null && DirectoryReference.Exists(Module.GeneratedCodeDirectory)) { foreach (FileReference GeneratedCodeFile in DirectoryReference.EnumerateFiles(Module.GeneratedCodeDirectory)) { // Exclude timestamp files, since they're always updated and cause collisions between builds if (!GeneratedCodeFile.GetFileName().Equals("Timestamp", StringComparison.OrdinalIgnoreCase) && !GeneratedCodeFile.HasExtension(".cpp")) { BuildProducts.Add(GeneratedCodeFile, BuildProductType.BuildResource); } } } if (Target.LinkType == TargetLinkType.Monolithic) { FileReference PrecompiledManifestLocation = Module.PrecompiledManifestLocation; BuildProducts.Add(PrecompiledManifestLocation, BuildProductType.BuildResource); PrecompiledManifest ModuleManifest = PrecompiledManifest.Read(PrecompiledManifestLocation); foreach (FileReference OutputFile in ModuleManifest.OutputFiles) { if (!BuildProducts.ContainsKey(OutputFile)) { BuildProducts.Add(OutputFile, BuildProductType.BuildResource); } } } } } // Add all the binary outputs if (!Target.bDisableLinking) { // Get the type of build products we're creating BuildProductType OutputType = BuildProductType.RequiredResource; switch (Type) { case UEBuildBinaryType.Executable: OutputType = BuildProductType.Executable; break; case UEBuildBinaryType.DynamicLinkLibrary: OutputType = BuildProductType.DynamicLibrary; break; case UEBuildBinaryType.StaticLibrary: OutputType = BuildProductType.BuildResource; break; } // Add the primary build products string[] DebugExtensions = UEBuildPlatform.GetBuildPlatform(Target.Platform).GetDebugInfoExtensions(Target, Type); foreach (FileReference OutputFilePath in OutputFilePaths) { AddBuildProductAndDebugFiles(OutputFilePath, OutputType, DebugExtensions, BuildProducts, ToolChain, bCreateDebugInfo); } // Add the console app, if there is one if (Type == UEBuildBinaryType.Executable && bBuildAdditionalConsoleApp) { foreach (FileReference OutputFilePath in OutputFilePaths) { AddBuildProductAndDebugFiles(GetAdditionalConsoleAppPath(OutputFilePath), OutputType, DebugExtensions, BuildProducts, ToolChain, bCreateDebugInfo); } } // Add any additional build products from the modules in this binary, including additional bundle resources/dylibs on Mac. List <string> Libraries = new List <string>(); List <UEBuildBundleResource> BundleResources = new List <UEBuildBundleResource>(); GatherAdditionalResources(Libraries, BundleResources); // Add any extra files from the toolchain ToolChain.ModifyBuildProducts(Target, this, Libraries, BundleResources, BuildProducts); } }