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.");
     }
 }
        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);
            }
        }
        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());
        }
        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;
            }
        }
Exemple #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);
Exemple #6
0
 public static void UnityEditor(this ICakeContext context,
                                FilePath unityEditorPath, UnityEditorArguments arguments) =>
 UnityEditor(context, unityEditorPath, arguments, new UnityEditorSettings());
Exemple #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(
Exemple #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());
 private UnityEditorToolSettings ToolSettings(FilePath unityEditorPath, UnityEditorArguments arguments) =>
 new UnityEditorToolSettings(arguments, environment)
 {
     ToolPath = unityEditorPath
 };
 public void Run(UnityEditorDescriptor unityEditor, UnityEditorArguments arguments, UnityEditorSettings settings) =>
 Run(unityEditor.Path, arguments, settings);
 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.");
     }
 }
Exemple #12
0
 public UnityEditorToolSettings(UnityEditorArguments arguments, ICakeEnvironment environment) =>