예제 #1
0
        /// <summary>
        /// Performs the completion work for Async workers, and is called
        /// after the runAsync method returns.  Returns the ultimate
        /// disposition of the activity.
        /// </summary>
        /// <remarks>
        /// This method runs synchronously on the main thread.
        /// It can tidy up the state after async work, and store results
        /// in the Repository.
        /// Thou shalt not return Stale.
        /// </remarks>
        /// <returns>The disposition of this verb's worker's work.</returns>
        public Disposition Complete()
        {
            this.verb.RecordProcessInvokeCpuTime(this.pinv.CpuTime);

            string stdout = null;

            if (this.returnStandardOut)
            {
                stdout = this.pinv.GetStdout();
            }

            string stderr = null;

            if (this.returnStandardError)
            {
                stderr = this.pinv.GetStderr();
            }

            Disposition disposition;

            if (this.exitCodeHandling == ProcessExitCodeHandling.NonzeroIsOkay || this.pinv.ExitCode == 0)
            {
                disposition = new Fresh();
            }
            else
            {
                // Sheesh. Some tools emit error messages to stdout.
                // REVIEW: Provide full command line here rather than just executable (like old version did)?
                Failed f = new Failed(this.pinv.GetStdout() + this.pinv.GetStderr());
                f.AddError("Executable: " + this.executable + "\n");
                disposition = f;
            }

            return(this.verb.Complete(this.workingDirectory, this.pinv.CpuTime, stdout, stderr, disposition));
        }
예제 #2
0
        public override IVerbWorker getWorker(WorkingDirectory workingDirectory)
        {
            Disposition disposition = new Fresh();

            if (this.verifyVerb != null)
            {
                VerificationResult verificationResult = VerificationResult.fromXmlFile(this.verifyVerb.getOutputs().Single());
                if (!verificationResult.pass)
                {
                    disposition = new Failed();
                }
            }

            if (!(disposition is Failed))
            {
                foreach (var o in this.buildVerb.getOutputs())
                {
                    if (o.getExtension() == ".exe")
                    {
                        File.Copy(workingDirectory.PathTo(o), workingDirectory.PathTo(this.exeOutput), overwrite: true);
                    }
                    else
                    {
                        var dest = this.RelocateBuildObjectToExeDirectory(o);
                        File.Copy(
                            workingDirectory.PathTo(o),
                            workingDirectory.PathTo(dest),
                            overwrite: true);
                    }
                }
            }

            return(new VerbSyncWorker(workingDirectory, disposition));
        }
        /// <summary>
        /// Performs the completion work for Async workers, and is called
        /// after the runAsync method returns.  Returns the ultimate
        /// disposition of the activity.
        /// </summary>
        /// <remarks>
        /// This method runs synchronously on the main thread.
        /// It can tidy up the state after async work, and store results
        /// in the Repository.
        /// Thou shalt not return Stale.
        /// </remarks>
        /// <returns>The disposition of this verb's worker's work.</returns>
        public Disposition Complete()
        {
            this.verb.RecordProcessInvokeCpuTime(this.pinv.CpuTime);

            string stdout = null;
            if (this.returnStandardOut)
            {
                stdout = this.pinv.GetStdout();
            }

            string stderr = null;
            if (this.returnStandardError)
            {
                stderr = this.pinv.GetStderr();
            }

            Disposition disposition;
            if (this.exitCodeHandling == ProcessExitCodeHandling.NonzeroIsOkay || this.pinv.ExitCode == 0)
            {
                disposition = new Fresh();
            }
            else
            {
                // Sheesh. Some tools emit error messages to stdout.
                // REVIEW: Provide full command line here rather than just executable (like old version did)?
                Failed f = new Failed(this.pinv.GetStdout() + this.pinv.GetStderr());
                f.AddError("Executable: " + this.executable + "\n");
                disposition = f;
            }

            return this.verb.Complete(this.workingDirectory, this.pinv.CpuTime, stdout, stderr, disposition);
        }
예제 #4
0
        public override IVerbWorker getWorker(WorkingDirectory workingDirectory)
        {
            Disposition disposition = new Fresh();

            if (this.verifyVerb != null)
            {
                VerificationResult verificationResult = VerificationResult.fromXmlFile(this.verifyVerb.getOutputs().Single());
                if (!verificationResult.pass)
                {
                    disposition = new Failed();
                }
            }

            if (!(disposition is Failed))
            {
                foreach (var o in this.buildVerb.getOutputs())
                {
                    if (o.getExtension() == ".exe")
                    {
                        File.Copy(workingDirectory.PathTo(o), workingDirectory.PathTo(this.exeOutput), overwrite: true);
                    }
                    else
                    {
                        var dest = this.RelocateBuildObjectToExeDirectory(o);
                        File.Copy(
                            workingDirectory.PathTo(o),
                            workingDirectory.PathTo(dest),
                            overwrite: true);
                    }
                }
            }

            return new VerbSyncWorker(workingDirectory, disposition);
        }