GetCsharpGeneratedFiles(IVsProject project, EnvDTE.Project dteproject, string projectDir, string item)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var fileset = new GeneratedFileSet
            {
                filename = item,
                sources  = new Dictionary <string, List <string> >(),
                headers  = new Dictionary <string, List <string> >()
            };
            var propertyStorage = project as IVsBuildPropertyStorage;
            var outputDir       = project.GetItemMetadata(item, "OutputDir");

            foreach (EnvDTE.Configuration configuration in dteproject.ConfigurationManager)
            {
                var configName         = string.Format("{0}|{1}", configuration.ConfigurationName, configuration.PlatformName);
                var evaluatedOutputDir = Evaluate(propertyStorage, configName, outputDir);

                var csFilename = string.Format("{0}.cs", Path.GetFileNameWithoutExtension(item));
                csFilename = Path.GetFullPath(Path.Combine(projectDir, evaluatedOutputDir, csFilename));

                if (fileset.sources.ContainsKey(csFilename))
                {
                    fileset.sources[csFilename].Add(
                        string.Format("{0}|{1}", configuration.ConfigurationName, configuration.PlatformName));
                }
                else
                {
                    var configurations = new List <string>();
                    configurations.Add(
                        string.Format("{0}|{1}", configuration.ConfigurationName, configuration.PlatformName));
                    fileset.sources[csFilename] = configurations;
                }
            }
            return(fileset);
        }
        GetCppGeneratedFiles(IVsProject project, EnvDTE.Project dteproject, VCUtil vcutil, string projectDir, string item)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var fileset = new GeneratedFileSet
            {
                filename = item,
                sources  = new Dictionary <string, List <string> >(),
                headers  = new Dictionary <string, List <string> >()
            };

            var outputDir       = project.GetItemMetadata(item, "OutputDir");
            var headerOutputDir = project.GetItemMetadata(item, "HeaderOutputDir");
            var headerExt       = project.GetItemMetadata(item, "HeaderExt");
            var sourceExt       = project.GetItemMetadata(item, "SourceExt");

            foreach (EnvDTE.Configuration configuration in dteproject.ConfigurationManager)
            {
                var evaluatedOutputDir       = vcutil.Evaluate(configuration, outputDir);
                var evaluatedHeaderOutputDir = string.IsNullOrEmpty(headerOutputDir) ?
                                               evaluatedOutputDir : vcutil.Evaluate(configuration, headerOutputDir);
                var cppFilename = string.Format("{0}.{1}", Path.GetFileNameWithoutExtension(item), sourceExt);
                var hFilename   = string.Format("{0}.{1}", Path.GetFileNameWithoutExtension(item), headerExt);

                cppFilename = Path.GetFullPath(Path.Combine(projectDir, evaluatedOutputDir, cppFilename));
                hFilename   = Path.GetFullPath(Path.Combine(projectDir, evaluatedHeaderOutputDir, hFilename));

                if (fileset.sources.ContainsKey(cppFilename))
                {
                    fileset.sources[cppFilename].Add(ConfigurationString(configuration));
                }
                else
                {
                    var configurations = new List <string>();
                    configurations.Add(ConfigurationString(configuration));
                    fileset.sources[cppFilename] = configurations;
                }

                if (fileset.headers.ContainsKey(hFilename))
                {
                    fileset.headers[hFilename].Add(ConfigurationString(configuration));
                }
                else
                {
                    var configurations = new List <string>();
                    configurations.Add(ConfigurationString(configuration));
                    fileset.headers[hFilename] = configurations;
                }
            }
            return(fileset);
        }
Beispiel #3
0
        GetCsharpGeneratedFiles(IVsProject project)
        {
            var generated       = new List <GeneratedFileSet>();
            var msproject       = project.GetMSBuildProject();
            var dteproject      = project.GetDTEProject();
            var items           = GetIceBuilderItems(project);
            var propertyStorage = project as IVsBuildPropertyStorage;
            var projectDir      = GetProjectBaseDirectory(project);

            foreach (var item in items)
            {
                var fileset = new GeneratedFileSet
                {
                    filename = item,
                    sources  = new Dictionary <string, List <EnvDTE.Configuration> >(),
                    headers  = new Dictionary <string, List <EnvDTE.Configuration> >()
                };

                var outputDir = msproject.GetItemMetadata(item, "OutputDir");
                foreach (EnvDTE.Configuration configuration in dteproject.ConfigurationManager)
                {
                    var configName         = string.Format("{0}|{1}", configuration.ConfigurationName, configuration.PlatformName);
                    var evaluatedOutputDir = Evaluate(propertyStorage, configName, outputDir);

                    var csFilename = string.Format("{0}.cs", Path.GetFileNameWithoutExtension(item));
                    csFilename = Path.GetFullPath(Path.Combine(projectDir, evaluatedOutputDir, csFilename));

                    if (fileset.sources.ContainsKey(csFilename))
                    {
                        fileset.sources[csFilename].Add(configuration);
                    }
                    else
                    {
                        var configurations = new List <EnvDTE.Configuration>();
                        configurations.Add(configuration);
                        fileset.sources[csFilename] = configurations;
                    }
                }
                generated.Add(fileset);
            }
            return(generated);
        }
Beispiel #4
0
        GetCppGeneratedFiles(IVsProject project)
        {
            var generated       = new List <GeneratedFileSet>();
            var msproject       = project.GetMSBuildProject();
            var dteproject      = project.GetDTEProject();
            var items           = GetIceBuilderItems(project);
            var propertyStorage = project as IVsBuildPropertyStorage;
            var projectDir      = GetProjectBaseDirectory(project);

            var vcutil = Package.Instance.VCUtil;

            foreach (var item in items)
            {
                var fileset = new GeneratedFileSet
                {
                    filename = item,
                    sources  = new Dictionary <string, List <EnvDTE.Configuration> >(),
                    headers  = new Dictionary <string, List <EnvDTE.Configuration> >()
                };

                var outputDir       = msproject.GetItemMetadata(item, "OutputDir");
                var headerOutputDir = msproject.GetItemMetadata(item, "HeaderOutputDir");
                var headerExt       = msproject.GetItemMetadata(item, "HeaderExt");
                var sourceExt       = msproject.GetItemMetadata(item, "SourceExt");
                foreach (EnvDTE.Configuration configuration in dteproject.ConfigurationManager)
                {
                    var evaluatedOutputDir       = vcutil.Evaluate(configuration, outputDir);
                    var evaluatedHeaderOutputDir = string.IsNullOrEmpty(headerOutputDir) ?
                                                   evaluatedOutputDir : vcutil.Evaluate(configuration, headerOutputDir);
                    var cppFilename = string.Format("{0}.{1}", Path.GetFileNameWithoutExtension(item), sourceExt);
                    var hFilename   = string.Format("{0}.{1}", Path.GetFileNameWithoutExtension(item), headerExt);

                    cppFilename = Path.GetFullPath(Path.Combine(projectDir, evaluatedOutputDir, cppFilename));
                    hFilename   = Path.GetFullPath(Path.Combine(projectDir, evaluatedHeaderOutputDir, hFilename));

                    if (fileset.sources.ContainsKey(cppFilename))
                    {
                        fileset.sources[cppFilename].Add(configuration);
                    }
                    else
                    {
                        var configurations = new List <EnvDTE.Configuration>();
                        configurations.Add(configuration);
                        fileset.sources[cppFilename] = configurations;
                    }

                    if (fileset.headers.ContainsKey(hFilename))
                    {
                        fileset.headers[hFilename].Add(configuration);
                    }
                    else
                    {
                        var configurations = new List <EnvDTE.Configuration>();
                        configurations.Add(configuration);
                        fileset.headers[hFilename] = configurations;
                    }
                }
                generated.Add(fileset);
            }
            return(generated);
        }