private void RegenerateProjectFiles(FileSystemPath uprojectFilePath) { if (uprojectFilePath == null || uprojectFilePath.IsEmpty) { return; } // {UnrealEngineRoot}/Engine/Binaries/DotNET/UnrealBuildTool.exe -projectfiles {uprojectFilePath} -game -engine var engineRoot = UnrealEngineFolderFinder.FindUnrealEngineRoot(uprojectFilePath); var pathToUnrealBuildToolBin = UnrealEngineFolderFinder.GetAbsolutePathToUnrealBuildToolBin(engineRoot); var commandLine = new CommandLineBuilderJet() .AppendSwitch("-ProjectFiles") .AppendFileName(uprojectFilePath) .AppendSwitch("-game") .AppendSwitch("-engine"); try { ErrorLevelException.ThrowIfNonZero(InvokeChildProcess.InvokeChildProcessIntoLogger( pathToUnrealBuildToolBin, commandLine, LoggingLevel.INFO, TimeSpan.FromMinutes(10), InvokeChildProcess.TreatStderr.AsOutput, pathToUnrealBuildToolBin.Directory )); } catch (ErrorLevelException) { // TODO: handle properly } }
private Task <uint> StartUBTBuildPluginAsync(Lifetime lifetime, FileSystemPath command, CommandLineBuilderJet commandLine, InvokeChildProcess.PipeStreams pipeStreams) { InvokeChildProcess.StartInfo startinfo = new InvokeChildProcess.StartInfo(command) { Arguments = commandLine, Pipe = pipeStreams }; lock (HACK_getMutexForUBT()) { return(InvokeChildProcess.InvokeCore(lifetime, startinfo, InvokeChildProcess.SyncAsync.Async, myLogger)); } }
private CommandLineBuilderJet GetPlatformCommandLine(FileSystemPath command, params string[] args) { var commandLine = new CommandLineBuilderJet(); if (PlatformUtil.RuntimePlatform == PlatformUtil.Platform.Windows) { commandLine.AppendFileName(command); } foreach (var arg in args) { commandLine.AppendSwitch(arg); } if (PlatformUtil.RuntimePlatform == PlatformUtil.Platform.Windows) { return(new CommandLineBuilderJet().AppendSwitch("/C") .AppendSwitch($"\"{commandLine}\"")); } return(commandLine); }
private bool RegenerateProjectUsingUBT(FileSystemPath uprojectFilePath, FileSystemPath pathToUnrealBuildToolBin, FileSystemPath engineRoot) { bool isInstalledBuild = IsInstalledBuild(engineRoot); var commandLine = new CommandLineBuilderJet() .AppendSwitch("-ProjectFiles") .AppendSwitch($"-project=\"{uprojectFilePath.FullPath}\"") .AppendSwitch("-game"); commandLine.AppendSwitch(isInstalledBuild ? "-rocket" : "-engine"); try { lock (HACK_getMutexForUBT()) { myLogger.Info($"[UnrealLink]: Regenerating project files: {commandLine}"); ErrorLevelException.ThrowIfNonZero(InvokeChildProcess.InvokeChildProcessIntoLogger( pathToUnrealBuildToolBin, commandLine, LoggingLevel.INFO, TimeSpan.FromMinutes(1), InvokeChildProcess.TreatStderr.AsOutput, pathToUnrealBuildToolBin.Directory )); } } catch (Exception errorLevelException) { myLogger.Error(errorLevelException, $"[UnrealLink]: Failed refresh project files: calling {commandLine}"); return(false); } return(true); }