Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Scripts/CopyUAT.Automation.cs
aurel cordonnier 34f55d3a4a Merge from Release-Engine-Test @ 17946149 to UE5/Main
This represents UE4/Main @17911760, Release-5.0 @17915875 and Dev-PerfTest @17914035

[CL 17949667 by aurel cordonnier in ue5-main branch]
2021-10-27 15:14:40 -04:00

61 lines
1.9 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using AutomationTool;
using UnrealBuildTool;
using EpicGames.Core;
using UnrealBuildBase;
/// <summary>
/// Copies all UAT and UBT build products to a directory
/// </summary>
public class CopyUAT : BuildCommand
{
public override void ExecuteBuild()
{
// Get the output directory
string TargetDirParam = ParseParamValue("TargetDir");
if(TargetDirParam == null)
{
throw new AutomationException("Missing -TargetDir=... argument to CopyUAT");
}
// Construct a dummy UnrealBuild object to get a list of the UAT and UBT build products
UnrealBuild Build = new UnrealBuild(this);
Build.AddUATFilesToBuildProducts();
Build.AddUBTFilesToBuildProducts();
// Get a list of all the input files
HashSet<FileReference> SourceFilesSet = new HashSet<FileReference>();
foreach(string BuildProductFile in Build.BuildProductFiles)
{
FileReference SourceFile = new FileReference(BuildProductFile);
SourceFilesSet.Add(SourceFile);
FileReference SourceSymbolFile = SourceFile.ChangeExtension(".pdb");
if(FileReference.Exists(SourceSymbolFile))
{
SourceFilesSet.Add(SourceSymbolFile);
}
FileReference DocumentationFile = SourceFile.ChangeExtension(".xml");
if(FileReference.Exists(DocumentationFile))
{
SourceFilesSet.Add(DocumentationFile);
}
}
// Copy all the files over
DirectoryReference TargetDir = new DirectoryReference(TargetDirParam);
List<FileReference> SourceFiles = SourceFilesSet.OrderBy(x => x.FullName).ToList();
CommandUtils.ThreadedCopyFiles(SourceFiles, Unreal.RootDirectory, TargetDir);
LogInformation("Copied {0} files to {1}", SourceFiles.Count, TargetDir);
File.WriteAllLines(Path.Combine(TargetDirParam, "CopiedFiles.txt"), SourceFiles.Select(F => F.FullName));
}
}