Ejemplo n.º 1
0
 private void WarnIfLogFileNotSet(UnityEditorArguments arguments)
 {
     if (arguments.LogFile == null)
     {
         log.Warning("LogFile is not specified by Unity Editor arguments.");
         log.Warning("Please specify it for ability to forward Unity log to console.");
     }
 }
Ejemplo n.º 2
0
        public void Run(FilePath unityEditorPath, UnityEditorArguments arguments, UnityEditorSettings settings)
        {
            ErrorIfRealTimeLogSetButLogFileNotSet(settings, arguments);
            WarnIfLogFileNotSet(arguments);

            if (settings.RealTimeLog && arguments.LogFile != null)
            {
                RunWithRealTimeLog(unityEditorPath, arguments);
            }
            else
            {
                RunWithLogForwardOnError(unityEditorPath, arguments);
            }
        }
Ejemplo n.º 3
0
        private void RunWithRealTimeLog(FilePath unityEditorPath, UnityEditorArguments arguments)
        {
            var logForwardCancellation = new CancellationTokenSource();

            var process = RunProcess(ToolSettings(unityEditorPath, arguments));

            Task.Run(() =>
            {
                process.WaitForExit();
                logForwardCancellation.Cancel();
            });

            ForwardLogFileToOutputUntilCancel(arguments.LogFile, logForwardCancellation.Token);

            ProcessExitCode(process.GetExitCode());
        }
Ejemplo n.º 4
0
        private void RunWithLogForwardOnError(FilePath unityEditorPath, UnityEditorArguments arguments)
        {
            try
            {
                Run(ToolSettings(unityEditorPath, arguments));
            }
            catch
            {
                if (arguments.LogFile == null)
                {
                    log.Error("Execution of Unity Editor failed.");
                    log.Warning("Cannot forward log file to output because LogFile argument is missing.");
                }
                else
                {
                    log.Error("Execution of Unity Editor failed.");
                    log.Error("Please analyze log below for the reasons of failure.");
                    ForwardLogFileToOutputInOnePass(arguments.LogFile);
                }

                throw;
            }
        }
Ejemplo n.º 5
0
 public static void UnityEditor(this ICakeContext context,
                                FilePath unityEditorPath, UnityEditorArguments arguments, UnityEditorSettings settings) =>
 new UnityEditor(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools, context.Log)
 .Run(unityEditorPath, arguments, settings);
Ejemplo n.º 6
0
 public static void UnityEditor(this ICakeContext context,
                                FilePath unityEditorPath, UnityEditorArguments arguments) =>
 UnityEditor(context, unityEditorPath, arguments, new UnityEditorSettings());
Ejemplo n.º 7
0
 public static void UnityEditor(this ICakeContext context,
                                int versionYear, int versionStream, int versionUpdate, char versionSuffixCharacter, int versionSuffixNumber, UnityEditorArguments arguments, UnityEditorSettings settings = null) =>
 new UnityEditor(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools, context.Log)
 .Run(
Ejemplo n.º 8
0
 public static void UnityEditor(this ICakeContext context,
                                UnityEditorDescriptor unityEditor, UnityEditorArguments arguments, UnityEditorSettings settings = null) =>
 new UnityEditor(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools, context.Log)
 .Run(unityEditor, arguments, settings ?? new UnityEditorSettings());
Ejemplo n.º 9
0
 private UnityEditorToolSettings ToolSettings(FilePath unityEditorPath, UnityEditorArguments arguments) =>
 new UnityEditorToolSettings(arguments, environment)
 {
     ToolPath = unityEditorPath
 };
Ejemplo n.º 10
0
 public void Run(UnityEditorDescriptor unityEditor, UnityEditorArguments arguments, UnityEditorSettings settings) =>
 Run(unityEditor.Path, arguments, settings);
Ejemplo n.º 11
0
 private void ErrorIfRealTimeLogSetButLogFileNotSet(UnityEditorSettings settings, UnityEditorArguments arguments)
 {
     if (settings.RealTimeLog && arguments.LogFile == null)
     {
         log.Error("Cannot forward log in real time because LogFile is not specified.");
     }
 }
Ejemplo n.º 12
0
 public UnityEditorToolSettings(UnityEditorArguments arguments, ICakeEnvironment environment) =>