/// <summary> /// Creates an action which copies a file from one location to another /// </summary> /// <param name="SourceFile">The source file location</param> /// <param name="TargetFile">The target file location</param> /// <param name="ActionGraph">The action graph</param> /// <returns>File item for the output file</returns> static FileItem CreateCopyAction(FileReference SourceFile, FileReference TargetFile, ActionGraph ActionGraph) { FileItem SourceFileItem = FileItem.GetItemByFileReference(SourceFile); FileItem TargetFileItem = FileItem.GetItemByFileReference(TargetFile); Action CopyAction = ActionGraph.Add(ActionType.BuildProject); CopyAction.CommandDescription = "Copy"; if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64) { CopyAction.CommandPath = "cmd.exe"; CopyAction.CommandArguments = String.Format("/C \"copy /Y \"{0}\" \"{1}\" 1>nul\"", SourceFile, TargetFile); } else { CopyAction.CommandPath = "/bin/sh"; CopyAction.CommandArguments = String.Format("cp -f {0} {1}", Utils.EscapeShellArgument(SourceFile.FullName), Utils.EscapeShellArgument(TargetFile.FullName)); } CopyAction.WorkingDirectory = Environment.CurrentDirectory; CopyAction.PrerequisiteItems.Add(SourceFileItem); CopyAction.ProducedItems.Add(TargetFileItem); CopyAction.DeleteItems.Add(TargetFileItem); CopyAction.StatusDescription = TargetFileItem.Location.GetFileName(); CopyAction.bCanExecuteRemotely = false; return(TargetFileItem); }
public override void FinalizeOutput(ReadOnlyTargetRules Target, List <FileItem> OutputItems, ActionGraph ActionGraph) { FileReference OutputFile; if (Target.ProjectFile == null) { OutputFile = FileReference.Combine(UnrealBuildTool.EngineDirectory, "Saved", "PVS-Studio", String.Format("{0}.pvslog", Target.Name)); } else { OutputFile = FileReference.Combine(Target.ProjectFile.Directory, "Saved", "PVS-Studio", String.Format("{0}.pvslog", Target.Name)); } List <FileReference> InputFiles = OutputItems.Select(x => x.Location).ToList(); Action AnalyzeAction = ActionGraph.Add(ActionType.Compile); AnalyzeAction.CommandPath = "Dummy.exe"; AnalyzeAction.CommandArguments = ""; AnalyzeAction.CommandDescription = "Combining output from PVS-Studio"; AnalyzeAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName; AnalyzeAction.PrerequisiteItems.AddRange(OutputItems); AnalyzeAction.ProducedItems.Add(FileItem.GetItemByFileReference(OutputFile)); AnalyzeAction.ActionHandler = (Action Action, out int ExitCode, out string Output) => WriteResults(OutputFile, InputFiles, out ExitCode, out Output); AnalyzeAction.bShouldDeleteProducedItems = true; OutputItems.AddRange(AnalyzeAction.ProducedItems); }
private List <FileItem> CreateOutputFilesForUCA(LinkEnvironment BinaryLinkEnvironment, ActionGraph ActionGraph) { List <FileItem> OutputFiles = new List <FileItem>(); string ModuleName = Modules.Select(Module => Module.Name).First(Name => Name.CompareTo(BuildConfiguration.UCAModuleToAnalyze) == 0); UEBuildModuleCPP ModuleCPP = (UEBuildModuleCPP)Target.GetModuleByName(ModuleName); FileItem ModulePrivatePCH = ModuleCPP.ProcessedDependencies.UniquePCHHeaderFile; string IntermediatePath = Path.Combine(Target.ProjectIntermediateDirectory.FullName, ModuleName); FileReference OutputFileName = Target.OutputPath; FileItem OutputFile = FileItem.GetItemByFileReference(OutputFileName); Action LinkAction = ActionGraph.Add(ActionType.Compile); LinkAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName; LinkAction.CommandPath = System.IO.Path.Combine(LinkAction.WorkingDirectory, @"..", @"Binaries", @"Win32", @"UnrealCodeAnalyzer.exe"); LinkAction.ProducedItems.Add(OutputFile); LinkAction.PrerequisiteItems.AddRange(BinaryLinkEnvironment.InputFiles); LinkAction.CommandArguments = @"-AnalyzePCHFile -PCHFile=""" + ModulePrivatePCH.AbsolutePath + @""" -OutputFile=""" + OutputFileName + @""" -HeaderDataPath=""" + IntermediatePath + @""" -UsageThreshold " + BuildConfiguration.UCAUsageThreshold.ToString(CultureInfo.InvariantCulture); foreach (string IncludeSearchPath in ModuleCPP.IncludeSearchPaths) { LinkAction.CommandArguments += @" /I""" + LinkAction.WorkingDirectory + @"\" + IncludeSearchPath + @""""; } OutputFiles.Add(OutputFile); return(OutputFiles); }
public override CPPOutput CompileCPPFiles(CppCompileEnvironment CompileEnvironment, List <FileItem> InputFiles, DirectoryReference OutputDir, string ModuleName, ActionGraph ActionGraph) { VCEnvironment EnvVars = VCEnvironment.SetEnvironment(CppPlatform, Compiler); // Get the MSVC arguments required to compile all files in this batch List <string> SharedArguments = new List <string>(); SharedArguments.Add("/nologo"); SharedArguments.Add("/P"); // Preprocess SharedArguments.Add("/C"); // Preserve comments when preprocessing SharedArguments.Add("/D PVS_STUDIO"); SharedArguments.Add("/wd4005"); foreach (DirectoryReference IncludePath in CompileEnvironment.IncludePaths.UserIncludePaths) { SharedArguments.Add(String.Format("/I \"{0}\"", IncludePath)); } foreach (DirectoryReference IncludePath in CompileEnvironment.IncludePaths.SystemIncludePaths) { SharedArguments.Add(String.Format("/I \"{0}\"", IncludePath)); } foreach (string Definition in CompileEnvironment.Definitions) { SharedArguments.Add(String.Format("/D \"{0}\"", Definition)); } // Get the path to PVS studio FileReference AnalyzerFile = new FileReference(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "PVS-Studio", "x64", "PVS-Studio.exe")); if (!FileReference.Exists(AnalyzerFile)) { throw new BuildException("Unable to find PVS-Studio at {0}", AnalyzerFile); } CPPOutput Result = new CPPOutput(); foreach (FileItem SourceFile in InputFiles) { // Get the file names for everything we need string BaseFileName = SourceFile.Location.GetFileName(); // Write the response file FileReference PreprocessedFileLocation = FileReference.Combine(OutputDir, BaseFileName + ".i"); List <string> Arguments = new List <string>(SharedArguments); Arguments.Add(String.Format("/Fi\"{0}\"", PreprocessedFileLocation)); // Preprocess to a file Arguments.Add(String.Format("\"{0}\"", SourceFile.AbsolutePath)); FileReference ResponseFileLocation = FileReference.Combine(OutputDir, BaseFileName + ".i.response"); FileItem ResponseFileItem = FileItem.CreateIntermediateTextFile(ResponseFileLocation, String.Join("\n", Arguments)); // Preprocess the source file FileItem PreprocessedFileItem = FileItem.GetItemByFileReference(PreprocessedFileLocation); Action PreprocessAction = ActionGraph.Add(ActionType.Compile); PreprocessAction.CommandPath = EnvVars.CompilerPath.FullName; PreprocessAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName; PreprocessAction.CommandArguments = " @\"" + ResponseFileItem.AbsolutePath + "\""; PreprocessAction.PrerequisiteItems.Add(SourceFile); PreprocessAction.PrerequisiteItems.Add(ResponseFileItem); PreprocessAction.ProducedItems.Add(PreprocessedFileItem); PreprocessAction.bShouldOutputStatusDescription = false; // Write the PVS studio config file StringBuilder ConfigFileContents = new StringBuilder(); ConfigFileContents.AppendFormat("exclude-path={0}\n", EnvVars.VCInstallDir.FullName); if (CppPlatform == CppPlatform.Win64) { ConfigFileContents.Append("platform=x64\n"); } else if (CppPlatform == CppPlatform.Win32) { ConfigFileContents.Append("platform=Win32\n"); } else { throw new BuildException("PVS studio does not support this platform"); } ConfigFileContents.Append("preprocessor=visualcpp\n"); ConfigFileContents.Append("language=C++\n"); ConfigFileContents.Append("skip-cl-exe=yes\n"); ConfigFileContents.AppendFormat("i-file={0}\n", PreprocessedFileItem.Location.FullName); FileReference ConfigFileLocation = FileReference.Combine(OutputDir, BaseFileName + ".cfg"); FileItem ConfigFileItem = FileItem.CreateIntermediateTextFile(ConfigFileLocation, ConfigFileContents.ToString()); // Run the analzyer on the preprocessed source file FileReference OutputFileLocation = FileReference.Combine(OutputDir, BaseFileName + ".pvslog"); FileItem OutputFileItem = FileItem.GetItemByFileReference(OutputFileLocation); Action AnalyzeAction = ActionGraph.Add(ActionType.Compile); AnalyzeAction.CommandDescription = "Analyzing"; AnalyzeAction.StatusDescription = BaseFileName; AnalyzeAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName; AnalyzeAction.CommandPath = AnalyzerFile.FullName; AnalyzeAction.CommandArguments = String.Format("--cl-params \"{0}\" --source-file \"{1}\" --output-file \"{2}\" --cfg \"{3}\" --analysis-mode 4", PreprocessAction.CommandArguments, SourceFile.AbsolutePath, OutputFileLocation, ConfigFileItem.AbsolutePath); AnalyzeAction.PrerequisiteItems.Add(ConfigFileItem); AnalyzeAction.PrerequisiteItems.Add(PreprocessedFileItem); AnalyzeAction.ProducedItems.Add(OutputFileItem); AnalyzeAction.bShouldDeleteProducedItems = true; // PVS Studio will append by default, so need to delete produced items Result.ObjectFiles.AddRange(AnalyzeAction.ProducedItems); } return(Result); }
public override CPPOutput CompileCPPFiles(CppCompileEnvironment CompileEnvironment, List <FileItem> InputFiles, DirectoryReference OutputDir, string ModuleName, ActionGraph ActionGraph) { // Get the MSVC arguments required to compile all files in this batch List <string> SharedArguments = new List <string>(); SharedArguments.Add("/nologo"); SharedArguments.Add("/P"); // Preprocess SharedArguments.Add("/C"); // Preserve comments when preprocessing SharedArguments.Add("/D PVS_STUDIO"); SharedArguments.Add("/wd4005"); if (EnvVars.Compiler >= WindowsCompiler.VisualStudio2015) { SharedArguments.Add("/D _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS=1"); } foreach (DirectoryReference IncludePath in CompileEnvironment.IncludePaths.UserIncludePaths) { SharedArguments.Add(String.Format("/I \"{0}\"", IncludePath)); } foreach (DirectoryReference IncludePath in CompileEnvironment.IncludePaths.SystemIncludePaths) { SharedArguments.Add(String.Format("/I \"{0}\"", IncludePath)); } foreach (DirectoryReference IncludePath in EnvVars.IncludePaths) { SharedArguments.Add(String.Format("/I \"{0}\"", IncludePath)); } foreach (string Definition in CompileEnvironment.Definitions) { SharedArguments.Add(String.Format("/D \"{0}\"", Definition)); } foreach (FileItem ForceIncludeFile in CompileEnvironment.ForceIncludeFiles) { SharedArguments.Add(String.Format("/FI\"{0}\"", ForceIncludeFile.Location)); } CPPOutput Result = new CPPOutput(); foreach (FileItem SourceFile in InputFiles) { // Get the file names for everything we need string BaseFileName = SourceFile.Location.GetFileName(); // Write the response file FileReference PreprocessedFileLocation = FileReference.Combine(OutputDir, BaseFileName + ".i"); List <string> Arguments = new List <string>(SharedArguments); Arguments.Add(String.Format("/Fi\"{0}\"", PreprocessedFileLocation)); // Preprocess to a file Arguments.Add(String.Format("\"{0}\"", SourceFile.AbsolutePath)); FileReference ResponseFileLocation = FileReference.Combine(OutputDir, BaseFileName + ".i.response"); FileItem ResponseFileItem = FileItem.CreateIntermediateTextFile(ResponseFileLocation, String.Join("\n", Arguments)); // Preprocess the source file FileItem PreprocessedFileItem = FileItem.GetItemByFileReference(PreprocessedFileLocation); Action PreprocessAction = ActionGraph.Add(ActionType.Compile); PreprocessAction.CommandPath = EnvVars.CompilerPath.FullName; PreprocessAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName; PreprocessAction.CommandArguments = " @\"" + ResponseFileItem.AbsolutePath + "\""; PreprocessAction.PrerequisiteItems.AddRange(CompileEnvironment.ForceIncludeFiles); PreprocessAction.PrerequisiteItems.Add(SourceFile); PreprocessAction.PrerequisiteItems.Add(ResponseFileItem); PreprocessAction.ProducedItems.Add(PreprocessedFileItem); PreprocessAction.bShouldOutputStatusDescription = false; // Write the PVS studio config file StringBuilder ConfigFileContents = new StringBuilder(); foreach (DirectoryReference IncludePath in EnvVars.IncludePaths) { ConfigFileContents.AppendFormat("exclude-path={0}\n", IncludePath.FullName); } foreach (string PathMask in ApplicationSettings.PathMasks) { if (PathMask.Contains(":") || PathMask.Contains("\\") || PathMask.Contains("/")) { if (Path.IsPathRooted(PathMask) && !PathMask.Contains(":")) { ConfigFileContents.AppendFormat("exclude-path=*{0}*\n", PathMask); } else { ConfigFileContents.AppendFormat("exclude-path={0}\n", PathMask); } } } if (CppPlatform == CppPlatform.Win64) { ConfigFileContents.Append("platform=x64\n"); } else if (CppPlatform == CppPlatform.Win32) { ConfigFileContents.Append("platform=Win32\n"); } else { throw new BuildException("PVS-Studio does not support this platform"); } ConfigFileContents.Append("preprocessor=visualcpp\n"); ConfigFileContents.Append("language=C++\n"); ConfigFileContents.Append("skip-cl-exe=yes\n"); ConfigFileContents.AppendFormat("i-file={0}\n", PreprocessedFileItem.Location.FullName); FileReference ConfigFileLocation = FileReference.Combine(OutputDir, BaseFileName + ".cfg"); FileItem ConfigFileItem = FileItem.CreateIntermediateTextFile(ConfigFileLocation, ConfigFileContents.ToString()); // Run the analzyer on the preprocessed source file FileReference OutputFileLocation = FileReference.Combine(OutputDir, BaseFileName + ".pvslog"); FileItem OutputFileItem = FileItem.GetItemByFileReference(OutputFileLocation); Action AnalyzeAction = ActionGraph.Add(ActionType.Compile); AnalyzeAction.CommandDescription = "Analyzing"; AnalyzeAction.StatusDescription = BaseFileName; AnalyzeAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName; AnalyzeAction.CommandPath = AnalyzerFile.FullName; AnalyzeAction.CommandArguments = String.Format("--cl-params \"{0}\" --source-file \"{1}\" --output-file \"{2}\" --cfg \"{3}\" --analysis-mode 4", PreprocessAction.CommandArguments, SourceFile.AbsolutePath, OutputFileLocation, ConfigFileItem.AbsolutePath); if (LicenseFile != null) { AnalyzeAction.CommandArguments += String.Format(" --lic-file \"{0}\"", LicenseFile); AnalyzeAction.PrerequisiteItems.Add(FileItem.GetItemByFileReference(LicenseFile)); } AnalyzeAction.PrerequisiteItems.Add(ConfigFileItem); AnalyzeAction.PrerequisiteItems.Add(PreprocessedFileItem); AnalyzeAction.ProducedItems.Add(OutputFileItem); AnalyzeAction.bShouldDeleteProducedItems = true; // PVS Studio will append by default, so need to delete produced items Result.ObjectFiles.AddRange(AnalyzeAction.ProducedItems); } return(Result); }
public override FileItem LinkFiles(LinkEnvironment LinkEnvironment, bool bBuildImportLibraryOnly, ActionGraph ActionGraph) { FileItem OutputFile; // Make the final javascript file Action LinkAction = ActionGraph.Add(ActionType.Link); LinkAction.CommandDescription = "Link"; // LinkAction.bPrintDebugInfo = true; // ResponseFile lines. List <string> ReponseLines = new List <string>(); LinkAction.bCanExecuteRemotely = false; LinkAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName; LinkAction.CommandPath = HTML5SDKInfo.Python(); LinkAction.CommandArguments = HTML5SDKInfo.EmscriptenCompiler(); // bool bIsBuildingLibrary = LinkEnvironment.bIsBuildingLibrary || bBuildImportLibraryOnly; // ReponseLines.Add( // bIsBuildingLibrary ? // GetLibArguments(LinkEnvironment) : // GetLinkArguments(LinkEnvironment) // ); ReponseLines.Add(GetLinkArguments(LinkEnvironment)); // Add the input files to a response file, and pass the response file on the command-line. foreach (FileItem InputFile in LinkEnvironment.InputFiles) { //System.Console.WriteLine("File {0} ", InputFile.AbsolutePath); ReponseLines.Add(string.Format(" \"{0}\"", InputFile.AbsolutePath)); LinkAction.PrerequisiteItems.Add(InputFile); } if (!LinkEnvironment.bIsBuildingLibrary) { // Make sure ThirdParty libs are at the end. List <string> ThirdParty = (from Lib in LinkEnvironment.AdditionalLibraries where Lib.Contains("ThirdParty") select Lib).ToList(); LinkEnvironment.AdditionalLibraries.RemoveAll(Element => Element.Contains("ThirdParty")); LinkEnvironment.AdditionalLibraries.AddRange(ThirdParty); foreach (string InputFile in LinkEnvironment.AdditionalLibraries) { FileItem Item = FileItem.GetItemByPath(InputFile); if (Item.AbsolutePath.Contains(".lib")) { continue; } if (Item.ToString().EndsWith(".js")) { ReponseLines.Add(string.Format(" --js-library \"{0}\"", Item.AbsolutePath)); } // WARNING: With --pre-js and --post-js, the order in which these directives are passed to // the compiler is very critical, because that dictates the order in which they are appended. // // Set environment variable [ EMCC_DEBUG=1 ] to see the linker order used in packaging. // See GetSharedArguments_Global() above to set this environment variable else if (Item.ToString().EndsWith(".jspre")) { ReponseLines.Add(string.Format(" --pre-js \"{0}\"", Item.AbsolutePath)); } else if (Item.ToString().EndsWith(".jspost")) { ReponseLines.Add(string.Format(" --post-js \"{0}\"", Item.AbsolutePath)); } else { ReponseLines.Add(string.Format(" \"{0}\"", Item.AbsolutePath)); } LinkAction.PrerequisiteItems.Add(Item); } } // make the file we will create OutputFile = FileItem.GetItemByFileReference(LinkEnvironment.OutputFilePath); LinkAction.ProducedItems.Add(OutputFile); ReponseLines.Add(string.Format(" -o \"{0}\"", OutputFile.AbsolutePath)); FileItem OutputBC = FileItem.GetItemByPath(LinkEnvironment.OutputFilePath.FullName.Replace(".js", ".bc").Replace(".html", ".bc")); LinkAction.ProducedItems.Add(OutputBC); ReponseLines.Add(string.Format(" --save-bc \"{0}\"", OutputBC.AbsolutePath)); LinkAction.StatusDescription = Path.GetFileName(OutputFile.AbsolutePath); FileReference ResponseFileName = GetResponseFileName(LinkEnvironment, OutputFile); FileItem ResponseFileItem = FileItem.CreateIntermediateTextFile(ResponseFileName, ReponseLines); LinkAction.CommandArguments += string.Format(" @\"{0}\"", ResponseFileName); LinkAction.PrerequisiteItems.Add(ResponseFileItem); return(OutputFile); }
public override CPPOutput CompileCPPFiles(CppCompileEnvironment CompileEnvironment, List <FileItem> InputFiles, DirectoryReference OutputDir, string ModuleName, ActionGraph ActionGraph) { string Arguments = GetCLArguments_Global(CompileEnvironment); CPPOutput Result = new CPPOutput(); // Add include paths to the argument list. foreach (DirectoryReference IncludePath in CompileEnvironment.IncludePaths.UserIncludePaths) { AddIncludePath(ref Arguments, IncludePath); } foreach (DirectoryReference IncludePath in CompileEnvironment.IncludePaths.SystemIncludePaths) { AddIncludePath(ref Arguments, IncludePath); } // Add preprocessor definitions to the argument list. foreach (string Definition in CompileEnvironment.Definitions) { Arguments += string.Format(" -D{0}", Definition); } if (bEnableTracing) { Arguments += string.Format(" -D__EMSCRIPTEN_TRACING__"); } // Force include all the requested headers foreach (FileItem ForceIncludeFile in CompileEnvironment.ForceIncludeFiles) { Arguments += String.Format(" -include \"{0}\"", ForceIncludeFile.Location); } foreach (FileItem SourceFile in InputFiles) { Action CompileAction = ActionGraph.Add(ActionType.Compile); CompileAction.CommandDescription = "Compile"; CompileAction.PrerequisiteItems.AddRange(CompileEnvironment.ForceIncludeFiles); // CompileAction.bPrintDebugInfo = true; bool bIsPlainCFile = Path.GetExtension(SourceFile.AbsolutePath).ToUpperInvariant() == ".C"; // Add the C++ source file and its included files to the prerequisite item list. AddPrerequisiteSourceFile(CompileEnvironment, SourceFile, CompileAction.PrerequisiteItems); // Add the source file path to the command-line. string FileArguments = string.Format(" \"{0}\"", SourceFile.AbsolutePath); string ObjectFileExtension = UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.HTML5).GetBinaryExtension(UEBuildBinaryType.Object); // Add the object file to the produced item list. FileItem ObjectFile = FileItem.GetItemByFileReference( FileReference.Combine( OutputDir, Path.GetFileName(SourceFile.AbsolutePath) + ObjectFileExtension ) ); CompileAction.ProducedItems.Add(ObjectFile); FileArguments += string.Format(" -o \"{0}\"", ObjectFile.AbsolutePath); // Add C or C++ specific compiler arguments. if (bIsPlainCFile) { FileArguments += GetCLArguments_C(CompileEnvironment.Architecture); } else { FileArguments += GetCLArguments_CPP(CompileEnvironment); } CompileAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName; CompileAction.CommandPath = HTML5SDKInfo.Python(); CompileAction.CommandArguments = HTML5SDKInfo.EmscriptenCompiler() + " " + Arguments + FileArguments + CompileEnvironment.AdditionalArguments; //System.Console.WriteLine(CompileAction.CommandArguments); CompileAction.StatusDescription = Path.GetFileName(SourceFile.AbsolutePath); // Don't farm out creation of precomputed headers as it is the critical path task. CompileAction.bCanExecuteRemotely = CompileEnvironment.PrecompiledHeaderAction != PrecompiledHeaderAction.Create; // this is the final output of the compile step (a .abc file) Result.ObjectFiles.Add(ObjectFile); // VC++ always outputs the source file name being compiled, so we don't need to emit this ourselves CompileAction.bShouldOutputStatusDescription = true; // Don't farm out creation of precompiled headers as it is the critical path task. CompileAction.bCanExecuteRemotely = CompileEnvironment.PrecompiledHeaderAction != PrecompiledHeaderAction.Create || CompileEnvironment.bAllowRemotelyCompiledPCHs; } return(Result); }
public override FileItem LinkFiles(LinkEnvironment LinkEnvironment, bool bBuildImportLibraryOnly, ActionGraph ActionGraph) { if (LinkEnvironment.Config.Architecture == "-win32") // simulator { return(base.LinkFiles(LinkEnvironment, bBuildImportLibraryOnly, ActionGraph)); } FileItem OutputFile; // Make the final javascript file Action LinkAction = ActionGraph.Add(ActionType.Link); // ResponseFile lines. List <string> ReponseLines = new List <string>(); LinkAction.bCanExecuteRemotely = false; LinkAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName; LinkAction.CommandPath = HTML5SDKInfo.Python(); LinkAction.CommandArguments = HTML5SDKInfo.EmscriptenCompiler(); ReponseLines.Add(GetLinkArguments(LinkEnvironment)); // Add the input files to a response file, and pass the response file on the command-line. foreach (FileItem InputFile in LinkEnvironment.InputFiles) { //System.Console.WriteLine("File {0} ", InputFile.AbsolutePath); ReponseLines.Add(string.Format(" \"{0}\"", InputFile.AbsolutePath)); LinkAction.PrerequisiteItems.Add(InputFile); } if (!LinkEnvironment.Config.bIsBuildingLibrary) { // Make sure ThirdParty libs are at the end. List <string> ThirdParty = (from Lib in LinkEnvironment.Config.AdditionalLibraries where Lib.Contains("ThirdParty") select Lib).ToList(); LinkEnvironment.Config.AdditionalLibraries.RemoveAll(Element => Element.Contains("ThirdParty")); LinkEnvironment.Config.AdditionalLibraries.AddRange(ThirdParty); foreach (string InputFile in LinkEnvironment.Config.AdditionalLibraries) { FileItem Item = FileItem.GetItemByPath(InputFile); if (Item.AbsolutePath.Contains(".lib")) { continue; } if (Item != null) { if (Item.ToString().Contains(".js")) { ReponseLines.Add(string.Format(" --js-library \"{0}\"", Item.AbsolutePath)); } else { ReponseLines.Add(string.Format(" \"{0}\"", Item.AbsolutePath)); } LinkAction.PrerequisiteItems.Add(Item); } } } // make the file we will create OutputFile = FileItem.GetItemByFileReference(LinkEnvironment.Config.OutputFilePath); LinkAction.ProducedItems.Add(OutputFile); ReponseLines.Add(string.Format(" -o \"{0}\"", OutputFile.AbsolutePath)); FileItem OutputBC = FileItem.GetItemByPath(LinkEnvironment.Config.OutputFilePath.FullName.Replace(".js", ".bc").Replace(".html", ".bc")); LinkAction.ProducedItems.Add(OutputBC); ReponseLines.Add(" --emit-symbol-map " + string.Format(" --save-bc \"{0}\"", OutputBC.AbsolutePath)); LinkAction.StatusDescription = Path.GetFileName(OutputFile.AbsolutePath); FileReference ResponseFileName = GetResponseFileName(LinkEnvironment, OutputFile); LinkAction.CommandArguments += string.Format(" @\"{0}\"", ResponseFile.Create(ResponseFileName, ReponseLines)); LinkAction.OutputEventHandler = new DataReceivedEventHandler(RemoteOutputReceivedEventHandler); return(OutputFile); }