You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb none #lockdown Nick.Penwarden #ROBOMERGE-OWNER: ryan.gerleve #ROBOMERGE-AUTHOR: ben.marsh #ROBOMERGE-SOURCE: CL 4662404 in //UE4/Main/... #ROBOMERGE-BOT: ENGINE (Main -> Dev-Networking) [CL 4662413 by ben marsh in Dev-Networking branch]
97 lines
2.5 KiB
C#
97 lines
2.5 KiB
C#
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Tools.DotNETCommon;
|
|
|
|
namespace UnrealBuildTool
|
|
{
|
|
/// <summary>
|
|
/// Stores information about a compiled binary or module, including the build products and intermediate folders.
|
|
/// </summary>
|
|
class PrecompiledManifest
|
|
{
|
|
/// <summary>
|
|
/// List of files produced by compiling the module. These are within the module output directory.
|
|
/// </summary>
|
|
public List<FileReference> OutputFiles = new List<FileReference>();
|
|
|
|
/// <summary>
|
|
/// Default constructor
|
|
/// </summary>
|
|
public PrecompiledManifest()
|
|
{
|
|
}
|
|
|
|
/// <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>
|
|
/// Write the receipt to disk.
|
|
/// </summary>
|
|
/// <param name="Location">Output filename</param>
|
|
public void Write(FileReference Location)
|
|
{
|
|
DirectoryReference BaseDir = Location.Directory;
|
|
using (JsonWriter Writer = new JsonWriter(Location.FullName))
|
|
{
|
|
Writer.WriteObjectStart();
|
|
|
|
string[] OutputFileStrings = new string[OutputFiles.Count];
|
|
for(int Idx = 0; Idx < OutputFiles.Count; Idx++)
|
|
{
|
|
OutputFileStrings[Idx] = OutputFiles[Idx].MakeRelativeTo(BaseDir);
|
|
}
|
|
Writer.WriteStringArrayField("OutputFiles", OutputFileStrings);
|
|
|
|
Writer.WriteObjectEnd();
|
|
}
|
|
}
|
|
}
|
|
}
|