Exemplo n.º 1
0
        protected internal string GenerateCommandLine(VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog, VCToolTask.EscapeFormat escapeFormat = VCToolTask.EscapeFormat.Default)
        {
            string str1 = this.GenerateCommandLineCommands(format, escapeFormat);
            string str2 = this.GenerateResponseFileCommands(format, escapeFormat);

            if (!string.IsNullOrEmpty(str1))
            {
                return(str1 + " " + str2);
            }
            return(str2);
        }
Exemplo n.º 2
0
        protected override string GenerateResponseFileCommandsExceptSwitches(
            string[] switchesToRemove,
            VCToolTask.CommandLineFormat format  = VCToolTask.CommandLineFormat.ForBuildLog,
            VCToolTask.EscapeFormat escapeFormat = VCToolTask.EscapeFormat.EscapeTrailingSlash
            )
        {
            string str = base.GenerateResponseFileCommandsExceptSwitches(switchesToRemove, format, escapeFormat | VCToolTask.EscapeFormat.EscapeTrailingSlash);

            if (format == VCToolTask.CommandLineFormat.ForBuildLog)
            {
                str = str.Replace(@"\", @"\\").Replace(@"\\\\ ", @"\\ ");
            }
            return(str);
        }
Exemplo n.º 3
0
        protected override string GenerateCommandLineCommands(VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog)
        {
            string cmd = base.GenerateCommandLineCommands(format);
#endif
            // must be outside of response file
            if (opts.LowMem)
            {
                if (string.IsNullOrEmpty(cmd))
                {
                    cmd = " -lowmem";
                }
                else
                {
                    cmd += " -lowmem"; // must be outside of response file
                }
            }
            return(cmd);
        }
Exemplo n.º 4
0
        protected override string GenerateCommandLineCommands(VCToolTask.CommandLineFormat format
#if TOOLS_V14
                                                              , VCToolTask.EscapeFormat escapeFormat
#endif
                                                              )
        {
            string str = base.GenerateResponseFileCommands(format
#if TOOLS_V14
                                                           , escapeFormat
#endif
                                                           );

            if (!this.TrackFileAccess)
            {
                str = str.Replace("\\\"", "\"").Replace("\\\\\"", "\\\"");
            }
            str += " " + CommandLine;

            string src = "";

            foreach (var item in Sources)
            {
                src += " " + item.ToString();
            }
            if (!String.IsNullOrEmpty(src))
            {
                if (format == VCToolTask.CommandLineFormat.ForTracking)
                {
                    str += " " + src.ToUpper();
                }
                else
                {
                    str += " " + src;
                }
            }
            return(str);
        }
Exemplo n.º 5
0
 protected override string GenerateResponseFileCommands(VCToolTask.CommandLineFormat format)
 {
     return(string.Empty);
 }
Exemplo n.º 6
0
 private static void EmitStringArraySwitch(CommandLineBuilder builder, ToolSwitch toolSwitch, VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog, VCToolTask.EscapeFormat escapeFormat = VCToolTask.EscapeFormat.Default)
 {
     string[] parameters = new string[toolSwitch.StringList.Length];
     for (int index = 0; index < toolSwitch.StringList.Length; ++index)
     {
         string str = !toolSwitch.StringList[index].StartsWith("\"", StringComparison.Ordinal) || !toolSwitch.StringList[index].EndsWith("\"", StringComparison.Ordinal) ? Environment.ExpandEnvironmentVariables(toolSwitch.StringList[index]) : Environment.ExpandEnvironmentVariables(toolSwitch.StringList[index].Substring(1, toolSwitch.StringList[index].Length - 2));
         if (!string.IsNullOrEmpty(str))
         {
             if (format == VCToolTask.CommandLineFormat.ForTracking)
             {
                 str = str.ToUpperInvariant();
             }
             if (escapeFormat.HasFlag((Enum)VCToolTask.EscapeFormat.EscapeTrailingSlash) && !str.Contains(" ") && (str.EndsWith("\\", StringComparison.Ordinal) && !str.EndsWith("\\\\", StringComparison.Ordinal)))
             {
                 str += "\\";
             }
             parameters[index] = str;
         }
     }
     if (string.IsNullOrEmpty(toolSwitch.Separator))
     {
         foreach (string parameter in parameters)
         {
             builder.AppendSwitchIfNotNull(toolSwitch.SwitchValue, parameter);
         }
     }
     else
     {
         builder.AppendSwitchIfNotNull(toolSwitch.SwitchValue, parameters, toolSwitch.Separator);
     }
 }
Exemplo n.º 7
0
        private static void EmitFileSwitch(CommandLineBuilder builder, ToolSwitch toolSwitch, VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog)
        {
            if (string.IsNullOrEmpty(toolSwitch.Value))
            {
                return;
            }
            string parameter = Environment.ExpandEnvironmentVariables(toolSwitch.Value).Trim();

            if (format == VCToolTask.CommandLineFormat.ForTracking)
            {
                parameter = parameter.ToUpperInvariant();
            }
            if (!parameter.StartsWith("\"", StringComparison.Ordinal))
            {
                string str = "\"" + parameter;
                parameter = !str.EndsWith("\\", StringComparison.Ordinal) || str.EndsWith("\\\\", StringComparison.Ordinal) ? str + "\"" : str + "\\\"";
            }
            builder.AppendSwitchUnquotedIfNotNull(toolSwitch.SwitchValue + toolSwitch.Separator, parameter);
        }
Exemplo n.º 8
0
 private static void EmitDirectorySwitch(CommandLineBuilder builder, ToolSwitch toolSwitch, VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog)
 {
     if (string.IsNullOrEmpty(toolSwitch.SwitchValue))
     {
         return;
     }
     if (format == VCToolTask.CommandLineFormat.ForBuildLog)
     {
         builder.AppendSwitch(toolSwitch.SwitchValue + toolSwitch.Separator);
     }
     else
     {
         builder.AppendSwitch(toolSwitch.SwitchValue.ToUpperInvariant() + toolSwitch.Separator);
     }
 }
Exemplo n.º 9
0
 private static void EmitTaskItemArraySwitch(CommandLineBuilder builder, ToolSwitch toolSwitch, VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog)
 {
     if (string.IsNullOrEmpty(toolSwitch.Separator))
     {
         foreach (ITaskItem taskItem in toolSwitch.TaskItemArray)
         {
             builder.AppendSwitchIfNotNull(toolSwitch.SwitchValue, Environment.ExpandEnvironmentVariables(taskItem.ItemSpec));
         }
     }
     else
     {
         ITaskItem[] parameters = new ITaskItem[toolSwitch.TaskItemArray.Length];
         for (int index = 0; index < toolSwitch.TaskItemArray.Length; ++index)
         {
             parameters[index] = (ITaskItem) new TaskItem(Environment.ExpandEnvironmentVariables(toolSwitch.TaskItemArray[index].ItemSpec));
             if (format == VCToolTask.CommandLineFormat.ForTracking)
             {
                 parameters[index].ItemSpec = parameters[index].ItemSpec.ToUpperInvariant();
             }
         }
         builder.AppendSwitchIfNotNull(toolSwitch.SwitchValue, parameters, toolSwitch.Separator);
     }
 }
Exemplo n.º 10
0
        protected void GenerateCommandsAccordingToType(CommandLineBuilder builder, ToolSwitch toolSwitch, bool recursive, VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog, VCToolTask.EscapeFormat escapeFormat = VCToolTask.EscapeFormat.Default)
        {
            if (toolSwitch.Parents.Count > 0 && !recursive)
            {
                return;
            }
            switch (toolSwitch.Type)
            {
            case ToolSwitchType.Boolean:
                this.EmitBooleanSwitch(builder, toolSwitch);
                break;

            case ToolSwitchType.Integer:
                this.EmitIntegerSwitch(builder, toolSwitch);
                break;

            case ToolSwitchType.String:
                this.EmitStringSwitch(builder, toolSwitch);
                break;

            case ToolSwitchType.StringArray:
                VCToolTask.EmitStringArraySwitch(builder, toolSwitch, VCToolTask.CommandLineFormat.ForBuildLog, VCToolTask.EscapeFormat.Default);
                break;

            case ToolSwitchType.File:
                VCToolTask.EmitFileSwitch(builder, toolSwitch, format);
                break;

            case ToolSwitchType.Directory:
                VCToolTask.EmitDirectorySwitch(builder, toolSwitch, format);
                break;

            case ToolSwitchType.ITaskItem:
                VCToolTask.EmitTaskItemSwitch(builder, toolSwitch);
                break;

            case ToolSwitchType.ITaskItemArray:
                VCToolTask.EmitTaskItemArraySwitch(builder, toolSwitch, format);
                break;

            case ToolSwitchType.AlwaysAppend:
                VCToolTask.EmitAlwaysAppendSwitch(builder, toolSwitch);
                break;

            case ToolSwitchType.StringPathArray:
                VCToolTask.EmitStringArraySwitch(builder, toolSwitch, format, escapeFormat);
                break;

            default:
                ErrorUtilities.VerifyThrow(false, "InternalError");
                break;
            }
        }
Exemplo n.º 11
0
        protected virtual string GenerateResponseFileCommandsExceptSwitches(string[] switchesToRemove, VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog, VCToolTask.EscapeFormat escapeFormat = VCToolTask.EscapeFormat.Default)
        {
            bool flag1 = false;

            this.AddDefaultsToActiveSwitchList();
            this.AddFallbacksToActiveSwitchList();
            this.PostProcessSwitchList();
            CommandLineBuilder commandLineBuilder = new CommandLineBuilder(true);

            foreach (string index in this.SwitchOrderList)
            {
                if (this.IsPropertySet(index))
                {
                    ToolSwitch toolSwitch = this.activeToolSwitches[index];
                    if (this.VerifyDependenciesArePresent(toolSwitch) && this.VerifyRequiredArgumentsArePresent(toolSwitch, false))
                    {
                        bool flag2 = true;
                        if (switchesToRemove != null)
                        {
                            foreach (string str in switchesToRemove)
                            {
                                if (index.Equals(str, StringComparison.OrdinalIgnoreCase))
                                {
                                    flag2 = false;
                                    break;
                                }
                            }
                        }
                        if (flag2)
                        {
                            this.GenerateCommandsAccordingToType(commandLineBuilder, toolSwitch, false, format, escapeFormat);
                        }
                    }
                }
                else if (string.Equals(index, "additionaloptions", StringComparison.OrdinalIgnoreCase))
                {
                    this.BuildAdditionalArgs(commandLineBuilder);
                    flag1 = true;
                }
                else if (string.Equals(index, "AlwaysAppend", StringComparison.OrdinalIgnoreCase))
                {
                    commandLineBuilder.AppendSwitch(this.AlwaysAppend);
                }
            }
            if (!flag1)
            {
                this.BuildAdditionalArgs(commandLineBuilder);
            }
            return(commandLineBuilder.ToString());
        }
Exemplo n.º 12
0
 protected virtual string GenerateCommandLineCommands(VCToolTask.CommandLineFormat format, VCToolTask.EscapeFormat escapeFormat)
 {
     return(this.GenerateCommandLineCommandsExceptSwitches(new string[0], format, escapeFormat));
 }
Exemplo n.º 13
0
 protected virtual string GenerateCommandLineCommandsExceptSwitches(string[] switchesToRemove, VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog, VCToolTask.EscapeFormat escapeFormat = VCToolTask.EscapeFormat.Default)
 {
     return(string.Empty);
 }
Exemplo n.º 14
0
        protected string GenerateCommandLineExceptSwitches(string[] switchesToRemove, VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog, VCToolTask.EscapeFormat escapeFormat = VCToolTask.EscapeFormat.Default)
        {
            string str1 = this.GenerateCommandLineCommandsExceptSwitches(switchesToRemove, format, escapeFormat);
            string str2 = this.GenerateResponseFileCommandsExceptSwitches(switchesToRemove, format, escapeFormat);

            if (!string.IsNullOrEmpty(str1))
            {
                return(str1 + " " + str2);
            }
            return(str2);
        }
Exemplo n.º 15
0
 protected override string GenerateCommandLineCommandsExceptSwitches(string[] switchesToRemove, VCToolTask.CommandLineFormat format = VCToolTask.CommandLineFormat.ForBuildLog, VCToolTask.EscapeFormat escapeFormat = VCToolTask.EscapeFormat.Default)
 {
     string cmd = base.GenerateCommandLineCommandsExceptSwitches(switchesToRemove, format, escapeFormat);