Exemplo n.º 1
0
        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
            }
        }
Exemplo n.º 2
0
 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));
     }
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }