public override void ExecuteBuild() { FileReference InputFile = ParseRequiredFileReferenceParam("File"); string[] Lines = FileReference.ReadAllLines(InputFile); for (int LineIdx = 0; LineIdx < Lines.Length;) { string Line = Lines[LineIdx]; if (Line.StartsWith("Include Headers:", StringComparison.Ordinal)) { LineIdx = ParseIncludeHeaders(Lines, LineIdx + 1, InputFile.ChangeExtension(".json")); } else if (Line.StartsWith("Class Definitions:", StringComparison.Ordinal)) { LineIdx = ParseDefinitions(Lines, LineIdx + 1, InputFile.ChangeExtension(".classes.txt")); } else if (Line.StartsWith("Function Definitions:", StringComparison.Ordinal)) { LineIdx = ParseDefinitions(Lines, LineIdx + 1, InputFile.ChangeExtension(".functions.txt")); } else { LineIdx++; } } }
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(); if (ParseParam("WithLauncher")) { Build.AddUATLauncherFilesToBuildProducts(); } Build.AddUBTFilesToBuildProducts(); // Get a list of all the input files List <FileReference> SourceFiles = new List <FileReference>(); foreach (string BuildProductFile in Build.BuildProductFiles) { FileReference SourceFile = new FileReference(BuildProductFile); SourceFiles.Add(SourceFile); FileReference SourceSymbolFile = SourceFile.ChangeExtension(".pdb"); if (FileReference.Exists(SourceSymbolFile)) { SourceFiles.Add(SourceSymbolFile); } FileReference DocumentationFile = SourceFile.ChangeExtension(".xml"); if (FileReference.Exists(DocumentationFile)) { SourceFiles.Add(DocumentationFile); } } // Copy all the files over DirectoryReference TargetDir = new DirectoryReference(TargetDirParam); foreach (FileReference SourceFile in SourceFiles) { FileReference TargetFile = FileReference.Combine(TargetDir, SourceFile.MakeRelativeTo(CommandUtils.RootDirectory)); DirectoryReference.CreateDirectory(TargetFile.Directory); CommandUtils.CopyFile(SourceFile.FullName, TargetFile.FullName); } Log("Copied {0} files to {1}", SourceFiles.Count, TargetDir); }
/// <summary> /// Find all the build products created by compiling the given project file /// </summary> /// <param name="ProjectFile">Initial project file to read. All referenced projects will also be read.</param> /// <param name="InitialProperties">Mapping of property name to value</param> /// <param name="OutBuildProducts">Receives a set of build products on success</param> /// <returns>True if the build products were found, false otherwise.</returns> static bool FindBuildProducts(HashSet <FileReference> ProjectFiles, Dictionary <string, string> InitialProperties, out HashSet <FileReference> OutBuildProducts) { // Read all the project information into a dictionary Dictionary <FileReference, MsBuildProjectInfo> FileToProjectInfo = new Dictionary <FileReference, MsBuildProjectInfo>(); foreach (FileReference ProjectFile in ProjectFiles) { if (!ReadProjectsRecursively(ProjectFile, InitialProperties, FileToProjectInfo)) { OutBuildProducts = null; return(false); } } // Find all the build products HashSet <FileReference> BuildProducts = new HashSet <FileReference>(); foreach (KeyValuePair <FileReference, MsBuildProjectInfo> Pair in FileToProjectInfo) { MsBuildProjectInfo ProjectInfo = Pair.Value; // Add the standard build products DirectoryReference OutputDir = ProjectInfo.GetOutputDir(Pair.Key.Directory); ProjectInfo.AddBuildProducts(OutputDir, BuildProducts); // Add the referenced assemblies foreach (FileReference OtherAssembly in ProjectInfo.References.Where(x => x.Value).Select(x => x.Key)) { FileReference OutputFile = FileReference.Combine(OutputDir, OtherAssembly.GetFileName()); BuildProducts.Add(OutputFile); FileReference SymbolFile = OtherAssembly.ChangeExtension(".pdb"); if (SymbolFile.Exists()) { BuildProducts.Add(OutputFile.ChangeExtension(".pdb")); } } // Add build products from all the referenced projects. MSBuild only copy the directly referenced build products, not recursive references or other assemblies. foreach (MsBuildProjectInfo OtherProjectInfo in ProjectInfo.ProjectReferences.Where(x => x.Value).Select(x => FileToProjectInfo[x.Key])) { OtherProjectInfo.AddBuildProducts(OutputDir, BuildProducts); } } // Update the output set OutBuildProducts = BuildProducts; return(true); }
private void CopyLibsToFinalDestination(TargetPlatformData TargetData, List <string> TargetConfigurations, WindowsCompiler TargetWindowsCompiler = WindowsCompiler.VisualStudio2015_DEPRECATED) { foreach (string TargetConfiguration in TargetConfigurations) { DirectoryReference OutputLibPath = GetPlatformLibDirectory(TargetData, TargetWindowsCompiler); string OutputLibName = ""; if (TargetData.Platform == UnrealTargetPlatform.Linux || TargetData.Platform == UnrealTargetPlatform.Mac) { OutputLibName = "lib"; } OutputLibName += "hlslcc"; if (TargetConfiguration == "Debug") { OutputLibName += "d"; } if (TargetData.Platform == UnrealTargetPlatform.Win64) { OutputLibName += "_64"; } OutputLibName += "." + GetPlatformLibExtension(TargetData); DirectoryReference ProjectDirectory = GetProjectDirectory(TargetData, TargetWindowsCompiler); string SourceFileName = ""; if (TargetData.Platform == UnrealTargetPlatform.Win64) { SourceFileName = "hlslcc.lib"; } else if (TargetData.Platform == UnrealTargetPlatform.Linux || TargetData.Platform == UnrealTargetPlatform.Mac) { SourceFileName = "libhlslcc.a"; } FileReference SourceFile = FileReference.Combine(ProjectDirectory, TargetConfiguration, SourceFileName); FileReference DestFile = FileReference.Combine(OutputLibPath, OutputLibName); FileReference.Copy(SourceFile, DestFile); if (TargetData.Platform == UnrealTargetPlatform.Win64) { FileReference PdbSourceFile = SourceFile.ChangeExtension("pdb"); FileReference PdbDestFile = DestFile.ChangeExtension("pdb"); FileReference.Copy(PdbSourceFile, PdbDestFile); } } }
/// <summary> /// Adds a build product and its associated debug file to a receipt. /// </summary> /// <param name="OutputFile">Build product to add</param> /// <param name="DebugExtension">Extension for the matching debug file (may be null).</param> /// <param name="Receipt">Receipt to add to</param> static void AddBuildProductAndDebugFile(FileReference OutputFile, BuildProductType OutputType, string DebugExtension, Dictionary<FileReference, BuildProductType> BuildProducts, UEToolChain ToolChain) { BuildProducts.Add(OutputFile, OutputType); if (!String.IsNullOrEmpty(DebugExtension) && ToolChain.ShouldAddDebugFileToReceipt(OutputFile, OutputType)) { BuildProducts.Add(OutputFile.ChangeExtension(DebugExtension), BuildProductType.SymbolFile); } }