Пример #1
0
        protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands)
        {
            Log.LogMessage(MessageImportance.Normal, "Using shared compiler process to build.");

            BuildRequest req = TaskUtilities.CreateRequest(
                BuildProtocolConstants.RequestId_CSharpCompile,
                this.GetWorkingDirectory(),
                this.EnvironmentVariables,
                this.GenerateCommandLineCommands(),
                this.GenerateResponseFileCommands());

            if (req == null)
            {
                this.exitCode = -1;
                LogMessages("Fatal Error: more than " + ushort.MaxValue + " command line arguments.",
                            this.StandardErrorImportanceToUse);
            }
            else
            {
                bool   unused;
                string output;
                string errorOutput;
                this.exitCode = TaskUtilities.ExecuteTool(req, cancellationTokenSource.Token, out unused, out output, out errorOutput);
                if (output != null)
                {
                    LogMessages(output, this.StandardOutputImportanceToUse);
                }
                if (errorOutput != null)
                {
                    LogMessages(errorOutput, this.StandardErrorImportanceToUse);
                }
            }

            return(this.exitCode);
        }
Пример #2
0
        protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands)
        {
            Log.LogMessage(MessageImportance.Normal, "Using shared compiler process to build.");

            BuildRequest req = TaskUtilities.CreateRequest(
                BuildProtocolConstants.RequestId_VisualBasicCompile,
                this.GetWorkingDirectory(),
                this.EnvironmentVariables,
                this.GenerateCommandLineCommands(),
                this.GenerateResponseFileCommands());

            if (req == null)
            {
                this.exitCode = -1;
                LogMessages("Fatal Error: more than " + ushort.MaxValue + " command line arguments.",
                            this.StandardErrorImportanceToUse);
            }
            else
            {
                bool   canceled;
                string output;
                string errorOutput;
                this.exitCode = TaskUtilities.ExecuteTool(req, cancellationTokenSource.Token, out canceled, out output, out errorOutput);
                if (!canceled && exitCode < 0)
                {
                    Debug.Assert(output == null);
                    Debug.Assert(errorOutput == null);

                    // For some reason, this error message is not logged through logMessages.
                    Log.LogError("Fatal Error: Please see the event log for more details.");
                }
                else
                {
                    if (output != null)
                    {
                        LogMessages(output, this.StandardOutputImportanceToUse);
                    }

                    if (errorOutput != null)
                    {
                        if (LogStandardErrorAsError)
                        {
                            LogErrorOutput(errorOutput);
                        }
                        else
                        {
                            LogMessages(errorOutput, this.StandardErrorImportanceToUse);
                        }
                    }
                }
            }

            return(this.exitCode);
        }