Example #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        protected override void LogEventsFromTextOutput(string singleLine, MessageImportance messageImportance)
        {
            if (!ToolExe.StartsWith("clang", StringComparison.OrdinalIgnoreCase))
            {
                singleLine = GccUtilities.ConvertGccOutputToVS(singleLine);
            }

            base.LogEventsFromTextOutput(singleLine, MessageImportance.High);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        protected override void AddTaskSpecificDependencies(ref TrackedFileManager trackedFileManager, ITaskItem [] sources)
        {
            //
            // Register additional 'forced include' usage for each of the sources.
            //

            foreach (ITaskItem source in sources)
            {
                try
                {
                    if (!string.IsNullOrWhiteSpace(source.GetMetadata("ForcedIncludeFiles")))
                    {
                        string [] forcedIncludeFiles = source.GetMetadata("ForcedIncludeFiles").Split(new char [] { ';' }, StringSplitOptions.RemoveEmptyEntries);

                        List <ITaskItem> forcedIncludeItems = new List <ITaskItem> ();

                        foreach (string file in forcedIncludeFiles)
                        {
                            //
                            // Supports including pre-compiled headers via '-include' when they need to be referenced without '.pch'/'.gch'. Fix this.
                            //

                            string fileFullPath = Path.GetFullPath(file);

                            if ((ToolExe.StartsWith("clang")) && (File.Exists(fileFullPath + ".pch")))
                            {
                                fileFullPath = fileFullPath + ".pch";
                            }
                            else if (File.Exists(fileFullPath + ".gch"))
                            {
                                fileFullPath = fileFullPath + ".gch";
                            }

                            //
                            // Also validate that we don't try adding dependencies to missing files, as this breaks tracking.
                            //

                            if (!File.Exists(fileFullPath))
                            {
                                throw new FileNotFoundException("Could not find 'forced include' dependency: " + fileFullPath);
                            }

                            forcedIncludeItems.Add(new TaskItem(fileFullPath));
                        }

                        trackedFileManager.AddDependencyForSources(forcedIncludeItems.ToArray(), new ITaskItem [] { source });
                    }
                }
                catch (Exception e)
                {
                    Log.LogWarningFromException(e, false);
                }
            }
        }
Example #3
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        protected override void TrackedExecuteToolOutput(KeyValuePair <string, List <ITaskItem> > commandAndSourceFiles, string singleLine)
        {
            if (ToolExe.StartsWith("clang"))
            {
                LogEventsFromTextOutput(singleLine, MessageImportance.High);
            }
            else
            {
                //
                // GCC output differs from a Visual Studio's "jump to line" format, we transform that output here.
                //

                LogEventsFromTextOutput(GccUtilities.ConvertGccOutputToVS(singleLine), MessageImportance.High);
            }
        }