private void setPropertyTaskItem(string propertyName, ITaskItem value, string switchName)
                {
                    ActiveToolSwitches.Remove(propertyName);

                    var s = new ToolSwitch(ToolSwitchType.ITaskItem)
                    {
                        DisplayName          = propertyName,
                        Description          = propertyName,
                        ArgumentRelationList = new ArrayList(),
                        TaskItem             = value,
                        Required             = true,
                        SwitchValue          = switchName,
                        Separator            = " "
                    };

                    ActiveToolSwitches.Add(propertyName, s);
                    AddActiveSwitchToolValue(s);
                }
                protected void setPropertyString(string propertyName, string value, string switchName)
                {
                    ActiveToolSwitches.Remove(propertyName);

                    var s = new ToolSwitch(ToolSwitchType.String)
                    {
                        DisplayName          = propertyName,
                        Description          = propertyName,
                        ArgumentRelationList = new ArrayList(),
                        Value       = value,
                        Required    = true,
                        SwitchValue = switchName,
                        Separator   = " "
                    };

                    ActiveToolSwitches.Add(propertyName, s);
                    AddActiveSwitchToolValue(s);
                }
Exemple #3
0
        /// <summary>
        /// Validate the overrides.
        /// </summary>
        internal void ValidateOverrides()
        {
            List <string> overriddenSwitches = new List <string>();

            //Collect the overrided switches
            foreach (KeyValuePair <string, CommandLineToolSwitch> overriddenSwitch in ActiveToolSwitches)
            {
                foreach (KeyValuePair <string, string> overridePair in overriddenSwitch.Value.Overrides)
                {
                    if (String.Equals(overridePair.Key, (overriddenSwitch.Value.Type == CommandLineToolSwitchType.Boolean && overriddenSwitch.Value.BooleanValue == false) ? overriddenSwitch.Value.ReverseSwitchValue.TrimStart('/') : overriddenSwitch.Value.SwitchValue.TrimStart('/'), StringComparison.OrdinalIgnoreCase))
                    {
                        foreach (KeyValuePair <string, CommandLineToolSwitch> overrideTarget in ActiveToolSwitches)
                        {
                            if (!String.Equals(overrideTarget.Key, overriddenSwitch.Key, StringComparison.OrdinalIgnoreCase))
                            {
                                if (String.Equals(overrideTarget.Value.SwitchValue.TrimStart('/'), overridePair.Value, StringComparison.OrdinalIgnoreCase))
                                {
                                    overriddenSwitches.Add(overrideTarget.Key);
                                    break;
                                }
                                else if ((overrideTarget.Value.Type == CommandLineToolSwitchType.Boolean) && (overrideTarget.Value.BooleanValue == false) && String.Equals(overrideTarget.Value.ReverseSwitchValue.TrimStart('/'), overridePair.Value, StringComparison.OrdinalIgnoreCase))
                                {
                                    overriddenSwitches.Add(overrideTarget.Key);
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            //Remove the overrided switches
            foreach (string overridenSwitch in overriddenSwitches)
            {
                ActiveToolSwitches.Remove(overridenSwitch);
            }
        }
Exemple #4
0
        protected override void PostProcessSwitchList()
        {
            var firstFile = InputFiles.First();

            ToolExe = firstFile.GetMetadata("CompilerPath");

            ToolSwitch argument;

            argument = new ToolSwitch(ToolSwitchType.String)
            {
                MultipleValues = true
            };
            if (firstFile.GetMetadata("PointerSize") == "32")
            {
                argument.SwitchValue = "-32bits";
            }
            else if (firstFile.GetMetadata("PointerSize") == "64")
            {
                argument.SwitchValue = "-64bits";
            }
            ActiveToolSwitches["PointerSize"] = argument;

            ActiveToolSwitches["Definitions"] = new ToolSwitch(ToolSwitchType.StringArray)
            {
                StringList = firstFile.GetMetadata("Definitions").Split(';'), SwitchValue = "-D "
            };
            ActiveToolSwitches["IncludeFolders"] = new ToolSwitch(ToolSwitchType.StringPathArray)
            {
                StringList = firstFile.GetMetadata("IncludeFolders").Split(';'), SwitchValue = "-I "
            };

            argument = new ToolSwitch(ToolSwitchType.String)
            {
                MultipleValues = true
            };
            if (firstFile.GetMetadata("CallTrace") == "SingleThreaded")
            {
                argument.SwitchValue = "-call_trace 1";
            }
            else if (firstFile.GetMetadata("CallTrace") == "MSVC")
            {
                argument.SwitchValue = "-call_trace 2";
            }
            ActiveToolSwitches["CallTrace"] = argument;

            if (firstFile.GetMetadata("ShowMemoryUsage") != "true")
            {
                ActiveToolSwitches.Remove("ShowMemoryUsage");
            }
            else
            {
                ActiveToolSwitches["ShowMemoryUsage"] = new ToolSwitch(ToolSwitchType.String)
                {
                    MultipleValues = true, SwitchValue = "-debug_memory"
                }
            };

            ActiveToolSwitches["AdditionalDependencies"] = new ToolSwitch(ToolSwitchType.StringArray)
            {
                StringList = firstFile.GetMetadata("AdditionalDependencies").Split(';'), SwitchValue = "-linker_option /DEFAULTLIB:"
            };

            if (firstFile.GetMetadata("DisableDebugInfo") != "true")
            {
                ActiveToolSwitches.Remove("DisableDebugInfo");
            }
            else
            {
                ActiveToolSwitches["DisableDebugInfo"] = new ToolSwitch(ToolSwitchType.String)
                {
                    MultipleValues = true, SwitchValue = "-ndebug"
                }
            };

            ActiveToolSwitches["OutputFile"] = new ToolSwitch(ToolSwitchType.File)
            {
                SwitchValue = "-o ", Value = firstFile.GetMetadata("OutputFile")
            };

            if (firstFile.GetMetadata("PartialCompilation") != "true")
            {
                ActiveToolSwitches.Remove("PartialCompilation");
            }
            else
            {
                ActiveToolSwitches["PartialCompilation"] = new ToolSwitch(ToolSwitchType.String)
                {
                    MultipleValues = true, SwitchValue = "-part"
                }
            };

            if (firstFile.GetMetadata("RecursionDepthLimit") == "")
            {
                ActiveToolSwitches.Remove("RecursionDepthLimit");
            }
            else
            {
                ActiveToolSwitches["RecursionDepthLimit"] = new ToolSwitch(ToolSwitchType.Integer)
                {
                    IsValid = true, Number = int.Parse(firstFile.GetMetadata("RecursionDepthLimit")), SwitchValue = "-recursion_depth_limit "
                }
            };

            if (firstFile.GetMetadata("StaticLoopLimit") == "")
            {
                ActiveToolSwitches.Remove("StaticLoopLimit");
            }
            else
            {
                ActiveToolSwitches["StaticLoopLimit"] = new ToolSwitch(ToolSwitchType.Integer)
                {
                    IsValid = true, Number = int.Parse(firstFile.GetMetadata("StaticLoopLimit")), SwitchValue = "-static_loop_length_limit "
                }
            };

            AdditionalOptions = firstFile.GetMetadata("AdditionalOptions");
        }
    }
}