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 } }
public static uint RunCommandWithLock(Lifetime lifetime, [NotNull] InvokeChildProcess.StartInfo startinfo, [CanBeNull] ILogger logger) { lock (HACK_getMutexForUBT()) { return(InvokeChildProcess.InvokeCore(lifetime, startinfo, InvokeChildProcess.SyncAsync.Sync, logger).Result); } }
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 bool GenerateProjectFilesCmd(FileSystemPath engineRoot) { var isProjectUnderEngine = mySolution.SolutionFilePath.Directory == engineRoot; if (!isProjectUnderEngine) { myLogger.Info($"[UnrealLink]: {mySolution.SolutionFilePath} is not in {engineRoot} "); return(false); } var generateProjectFilesCmd = engineRoot / $"GenerateProjectFiles.{GetPlatformCmdExtension()}"; if (!generateProjectFilesCmd.ExistsFile) { myLogger.Info($"[UnrealLink]: {generateProjectFilesCmd} is not available"); return(false); } try { var command = GetPlatformCommand(generateProjectFilesCmd); var commandLine = GetPlatformCommandLine(generateProjectFilesCmd); lock (HACK_getMutexForUBT()) { myLogger.Info($"[UnrealLink]: Regenerating project files: {commandLine}"); ErrorLevelException.ThrowIfNonZero(InvokeChildProcess.InvokeChildProcessIntoLogger(command, commandLine, LoggingLevel.INFO, TimeSpan.FromMinutes(1), InvokeChildProcess.TreatStderr.AsOutput, generateProjectFilesCmd.Directory )); } } catch (ErrorLevelException errorLevelException) { myLogger.Error(errorLevelException, $"[UnrealLink]: Failed refresh project files, calling {generateProjectFilesCmd} went wrong"); return(false); } return(true); }
private bool RegenerateProjectUsingUVS(FileSystemPath uprojectFilePath, FileSystemPath engineRoot) { if (PlatformUtil.RuntimePlatform != PlatformUtil.Platform.Windows) { return(false); } var pathToUnrealVersionSelector = engineRoot / "Engine" / "Binaries" / "Win64" / "UnrealVersionSelector.exe"; if (!pathToUnrealVersionSelector.ExistsFile) { myLogger.Info($"[UnrealLink]: {pathToUnrealVersionSelector} is not available"); return(false); } var commandLine = GetPlatformCommandLine(pathToUnrealVersionSelector, "/projectFiles", $"\"{uprojectFilePath}\""); try { lock (HACK_getMutexForUBT()) { myLogger.Info($"[UnrealLink]: Regenerating project files: {commandLine}"); ErrorLevelException.ThrowIfNonZero(InvokeChildProcess.InvokeChildProcessIntoLogger( BatchUtils.GetPathToCmd(), commandLine, LoggingLevel.INFO, TimeSpan.FromMinutes(1), InvokeChildProcess.TreatStderr.AsOutput, pathToUnrealVersionSelector.Directory )); } } catch (ErrorLevelException errorLevelException) { myLogger.Error(errorLevelException, $"[UnrealLink]: Failed refresh project files: calling {pathToUnrealVersionSelector} {commandLine}"); return(false); } return(true); }
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); }