Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Scripts/CopyUAT.Automation.cs
ben marsh 770d9738b6 UAT: Use ThreadedCopyFiles to get UAT onto network share.
#ROBOMERGE-SOURCE: CL 16964963 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v838-16927207)

[CL 16964976 by ben marsh in ue5-release-engine-test branch]
2021-07-26 22:27:07 -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 UE4Build object to get a list of the UAT and UBT build products
UE4Build Build = new UE4Build(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));
}
}