示例#1
0
        static public List <string> GetForcedIncludeFiles(IVCProjectWrapper project, IVCConfigurationWrapper vcProjectConfiguration, IPathResolver pathResolver)
        {
            Logging.Logging.LogInfo("Attempting to retrieve Forced Include Files for project '" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(project.GetName()) + "'");

            List <string> forcedIncludeFiles = new List <string>();

            if (vcProjectConfiguration != null && vcProjectConfiguration.isValid())
            {
                if (vcProjectConfiguration.GetCLCompilerTool() != null && vcProjectConfiguration.GetCLCompilerTool().isValid())
                {
                    forcedIncludeFiles = vcProjectConfiguration.GetCLCompilerTool().GetForcedIncludeFiles()
                                         .Select(x => x.Replace("\\", "/"))        // backslashes would cause some string-escaping hassles...
                                         .Where(x => !string.IsNullOrWhiteSpace(x))
                                         .Distinct()
                                         .ToList();
                }
                else if (vcProjectConfiguration.GetNMakeTool() != null && vcProjectConfiguration.GetNMakeTool().isValid())
                {
                    forcedIncludeFiles = vcProjectConfiguration.GetNMakeTool().GetForcedIncludes()
                                         .Select(x => x.Replace("\\", "/"))        // backslashes would cause some string-escaping hassles...
                                         .Where(x => !string.IsNullOrWhiteSpace(x))
                                         .Distinct()
                                         .ToList();
                }
            }

            Logging.Logging.LogInfo("Found " + forcedIncludeFiles.Count.ToString() + " distinct forced include files.");

            return(forcedIncludeFiles);
        }
示例#2
0
        static public List <string> GetPreprocessorDefinitions(IVCProjectWrapper project, IVCConfigurationWrapper vcProjectConfiguration)
        {
            Logging.Logging.LogInfo("Attempting to retrieve Preprocessor Definitions for project '" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(project.GetName()) + "'");

            List <string> preprocessorDefinitions = new List <string>();

            if (vcProjectConfiguration != null && vcProjectConfiguration.isValid())
            {
                if (vcProjectConfiguration.GetCLCompilerTool() != null && vcProjectConfiguration.GetCLCompilerTool().isValid())
                {
                    preprocessorDefinitions = GetPreprocessorDefinitions(vcProjectConfiguration.GetCLCompilerTool());
                }
                else if (vcProjectConfiguration.GetNMakeTool() != null && vcProjectConfiguration.GetNMakeTool().isValid())
                {
                    preprocessorDefinitions = GetPreprocessorDefinitions(vcProjectConfiguration.GetNMakeTool());
                }
            }
            else
            {
                Logging.Logging.LogWarning("Could not retrieve project configuration.");
            }

            Logging.Logging.LogInfo("Found " + preprocessorDefinitions.Count.ToString() + " distinct preprocessor definitions.");

            return(preprocessorDefinitions);
        }
示例#3
0
        static public List <string> GetProjectIncludeDirectories(IVCProjectWrapper project, IVCConfigurationWrapper vcProjectConfig, IPathResolver pathResolver)
        {
            // get additional include directories
            // source: http://www.mztools.com/articles/2014/MZ2014005.aspx

            Logging.Logging.LogInfo("Attempting to retrieve project Include Directories for project '" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(project.GetName()) + "'");

            List <string> includeDirectories = new List <string>();

            if (vcProjectConfig != null && vcProjectConfig.isValid())
            {
                if (vcProjectConfig.GetCLCompilerTool() != null && vcProjectConfig.GetCLCompilerTool().isValid())
                {
                    includeDirectories.AddRange(GetIncludeDirectories(vcProjectConfig.GetCLCompilerTool()));
                }
                else if (vcProjectConfig.GetNMakeTool() != null && vcProjectConfig.GetNMakeTool().isValid())
                {
                    includeDirectories.AddRange(GetIncludeDirectories(vcProjectConfig.GetNMakeTool()));
                }
            }
            else
            {
                Logging.Logging.LogWarning("Could not retrieve Project Configuration. No include directories could be retrieved.");
                return(new List <string>());
            }

            Logging.Logging.LogInfo("Attempting to clean up.");
            includeDirectories = CleanIncludeDirectories(project, pathResolver, includeDirectories);

            Logging.Logging.LogInfo("Found " + includeDirectories.Count.ToString() + " distinct project include directories.");
            return(includeDirectories);
        }
示例#4
0
        static public List <string> GetSystemIncludeDirectories(IVCProjectWrapper project, IVCConfigurationWrapper vcProjectConfig, IPathResolver pathResolver)
        {
            Logging.Logging.LogInfo("Attempting to retrieve system Include Directories for project '" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(project.GetName()) + "'");

            List <string> includeDirectories = new List <string>();

            try
            {
                IVCPlatformWrapper platform = vcProjectConfig.GetPlatform();
                if (platform != null && platform.isValid())
                {
                    foreach (string directory in platform.GetIncludeDirectories())
                    {
                        includeDirectories.AddRange(pathResolver.ResolveVsMacroInPath(directory, vcProjectConfig));
                    }
                }
            }
            catch (Exception e)
            {
                Logging.Logging.LogError("Failed to retrieve platform include directories: " + e.Message);
                return(new List <string>());
            }

            Logging.Logging.LogInfo("Attempting to clean up.");
            includeDirectories = CleanIncludeDirectories(project, pathResolver, includeDirectories);

            Logging.Logging.LogInfo("Found " + includeDirectories.Count.ToString() + " distinct system include directories.");
            return(includeDirectories);
        }
示例#5
0
        static public List <string> GetIncludeDirectories(IVCProjectWrapper project, IVCConfigurationWrapper vcProjectConfig, IPathResolver pathResolver)
        {
            // get additional include directories
            // source: http://www.mztools.com/articles/2014/MZ2014005.aspx

            Logging.Logging.LogInfo("Attempting to retrieve Include Directories for project '" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(project.GetName()) + "'");

            List <string> includeDirectories = new List <string>();

            if (vcProjectConfig != null && vcProjectConfig.isValid())
            {
                {
                    if (vcProjectConfig.GetCLCompilerTool() != null && vcProjectConfig.GetCLCompilerTool().isValid())
                    {
                        includeDirectories.AddRange(GetIncludeDirectories(vcProjectConfig.GetCLCompilerTool()));
                    }
                    else if (vcProjectConfig.GetNMakeTool() != null && vcProjectConfig.GetNMakeTool().isValid())
                    {
                        includeDirectories.AddRange(GetIncludeDirectories(vcProjectConfig.GetNMakeTool()));
                    }
                }

                try
                {
                    IVCPlatformWrapper platform = vcProjectConfig.GetPlatform();
                    if (platform != null && platform.isValid())
                    {
                        foreach (string directory in platform.GetIncludeDirectories())
                        {
                            includeDirectories.AddRange(pathResolver.ResolveVsMacroInPath(directory, vcProjectConfig));
                        }
                    }
                }
                catch (Exception e)
                {
                    Logging.Logging.LogError("Failed to retrieve platform include directories: " + e.Message);
                    return(new List <string>());
                }
            }
            else
            {
                Logging.Logging.LogWarning("Could not retrieve Project Configuration. No include directories could be retreived.");
                return(new List <string>());
            }

            Logging.Logging.LogInfo("Attempting to clean up.");

            includeDirectories = includeDirectories
                                 .Select(x => x.Replace("\\\"", ""))
                                 .Select(x => pathResolver.GetAsAbsoluteCanonicalPath(x, project))
                                 .Select(x => x.Replace("\\", "/")) // backslashes would cause some string-escaping hassles...
                                 .Where(x => !string.IsNullOrWhiteSpace(x))
                                 .Distinct()
                                 .ToList();

            Logging.Logging.LogInfo("Found " + includeDirectories.Count.ToString() + " distinct include directories.");

            return(includeDirectories);
        }