コード例 #1
0
            public TaskHandler(AsyncContextOperation operation, TaskOptions options)
            {
                _operation = operation;
                _options   = options;
                _endStep   = (int)States.RunningMain;
                if (options.HasFlag(TaskOptions.Cancel))
                {
                    _endStep |= (int)(States.Cancelling | States.RunningExtent);
                }
                else if (options.HasFlag(TaskOptions.Extent))
                {
                    _endStep |= (int)States.RunningExtent;
                }

                if (_operation._state > _endStep)
                {
                    var(isError, isCancel) = GetResult(_operation._state, _endStep, _options);
                    _syncResult            = isError ? Task.FromException(operation._error)
                                                : isCancel?Task.FromCanceled(_operation._ct.Token)
                                                 : Task.CompletedTask;

                    _asyncResult = default;
                    _ended       = true;
                }
                else
                {
                    _syncResult  = default;
                    _asyncResult = new TaskCompletionSource <object>();
                    _ended       = false;
                }
            }
コード例 #2
0
        protected override bool PerformPrequisites()
        {
            // build editor
            BuildTarget Command = new BuildTarget();

            Command.ProjectName = ProjectFile != null?ProjectFile.GetFileNameWithoutAnyExtensions() : null;

            Command.Platforms = BuildHostPlatform.Current.Platform.ToString();
            Command.Targets   = "Editor";
            Command.NoTools   = false;

            if (Command.Execute() != ExitCode.Success)
            {
                return(false);
            }

            // if they want a hot DDC then do the test one time with no timing
            if (TaskOptions.HasFlag(DDCTaskOptions.HotDDC))
            {
                RunEditorAndWaitForMapLoad(true);
            }

            base.PerformPrequisites();

            return(true);
        }
コード例 #3
0
        protected bool RunEditorAndWaitForMapLoad(bool bIsWarming)
        {
            string ProjectArg = ProjectFile != null?ProjectFile.ToString() : "";

            string EditorPath = HostPlatform.Current.GetUE4ExePath("UE4Editor.exe");
            string LogArg     = string.Format("-log={0}.log", MakeValidFileName(GetFullTaskName()).Replace(" ", "_"));
            string Arguments  = string.Format("{0} {1} -execcmds=\"automation runtest System.Maps.PIE;Quit\" -stdout -FullStdOutLogOutput -unattended {2}", ProjectArg, EditorArgs, LogArg);

            if (TaskOptions.HasFlag(DDCTaskOptions.NoSharedDDC))
            {
                Arguments += (" -ddc=noshared");
            }

            if (!bIsWarming && TaskOptions.HasFlag(DDCTaskOptions.NoShaderDDC))
            {
                Arguments += (" -noshaderddc");
            }

            if (TaskOptions.HasFlag(DDCTaskOptions.NoXGE))
            {
                Arguments += (" -noxgeshadercompile");
            }

            var RunOptions = CommandUtils.ERunOptions.AllowSpew | CommandUtils.ERunOptions.NoWaitForExit;

            var SpewDelegate = new ProcessResult.SpewFilterCallbackType(EndOnMapCheckFilter);

            //TestCompleted = false;
            LastStdOutTime = DateTime.Now;
            CurrentProcess = CommandUtils.Run(EditorPath, Arguments, Options: RunOptions, SpewFilterCallback: SpewDelegate);

            DateTime StartTime = DateTime.Now;

            int MaxWaitMins = 90;

            while (!CurrentProcess.HasExited)
            {
                Thread.Sleep(5 * 1000);

                lock (CurrentProcess)
                {
                    if ((LastStdOutTime - StartTime).TotalMinutes >= MaxWaitMins)
                    {
                        Log.TraceError("Gave up waiting for task after {0} minutes of no output", MaxWaitMins);
                        CurrentProcess.ProcessObject.Kill();
                    }
                }
            }

            int ExitCode = CurrentProcess.ExitCode;

            CurrentProcess = null;

            return(ExitCode == 0);
        }
コード例 #4
0
        /// <summary>
        /// Gets the decrypted configuration data.
        /// </summary>
        /// <returns>A string containing the configuration data. If the data was encrypted, the configuration returned is decrypted.</returns>
        public string GetClearConfiguration()
        {
            TaskOptions options = (TaskOptions)this.Options;

            if (options.HasFlag(TaskOptions.ProtectedConfiguration) && (!string.IsNullOrEmpty(this.EncryptionKeyId)) && (this.GetMediaContext() != null))
            {
                return(ConfigurationEncryptionHelper.DecryptConfigurationString(this.GetMediaContext(), this.EncryptionKeyId, this.InitializationVector, this.Configuration));
            }

            return(this.Configuration);
        }
コード例 #5
0
        protected override bool PerformTask()
        {
            List <string> ExtraArgsList = new List <string>();

            if (CookAsClient)
            {
                ExtraArgsList.Add("client");
            }

            if (TaskOptions.HasFlag(DDCTaskOptions.NoShaderDDC))
            {
                ExtraArgsList.Add("noshaderddc");
            }

            if (TaskOptions.HasFlag(DDCTaskOptions.NoSharedDDC))
            {
                ExtraArgsList.Add("ddc=noshared");
            }

            if (TaskOptions.HasFlag(DDCTaskOptions.NoXGE))
            {
                ExtraArgsList.Add("noxgeshadercompile");
            }

            string ExtraArgs = "";

            if (ExtraArgsList.Any())
            {
                ExtraArgs = "-" + string.Join(" -", ExtraArgsList);
            }

            if (CookArgs.Length > 0)
            {
                ExtraArgs += " " + CookArgs;
            }

            // will throw an exception if it fails
            CommandUtils.RunCommandlet(ProjectFile, "UE4Editor-Cmd.exe", "Cook", String.Format("-TargetPlatform={0} {1}", CookPlatformName, ExtraArgs));

            return(true);
        }
コード例 #6
0
        protected override bool PerformPrequisites()
        {
            // build editor
            BuildTarget Command = new BuildTarget();

            Command.ProjectName = ProjectName;
            Command.Platforms   = BuildHostPlatform.Current.Platform.ToString();
            Command.Targets     = "Editor";

            if (Command.Execute() != ExitCode.Success)
            {
                return(false);
            }

            // Do a cook to make sure the remote ddc is warm?
            if (TaskOptions.HasFlag(DDCTaskOptions.HotDDC))
            {
                // will throw an exception if it fails
                CommandUtils.RunCommandlet(ProjectFile, "UE4Editor-Cmd.exe", "Cook", String.Format("-TargetPlatform={0} ", CookPlatformName));
            }

            base.PerformPrequisites();
            return(true);
        }