From 8ba14e64d52728b7c6c653d44597f13ea56e0916 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Fri, 4 Aug 2017 17:16:35 +0200 Subject: [PATCH] parse solution folder files, if `FULL_SLN_PARSER` define --- .../Solution/ProjectInSolution.cs | 28 +++++++++++++++++++ .../Construction/Solution/SolutionFile.cs | 23 +++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/vendor/msbuild/src/Build/Construction/Solution/ProjectInSolution.cs b/vendor/msbuild/src/Build/Construction/Solution/ProjectInSolution.cs index 4cdfa59..b5d384e 100644 --- a/vendor/msbuild/src/Build/Construction/Solution/ProjectInSolution.cs +++ b/vendor/msbuild/src/Build/Construction/Solution/ProjectInSolution.cs @@ -103,6 +103,10 @@ public sealed class ProjectInSolution private string _targetFrameworkMoniker; // used for website projects, since they don't have a project file in which the // target framework is stored. Defaults to .NETFX 3.5 +#if FULL_SLN_PARSER + private List _folderFiles; // A list of name and path of files inside a solution folder +#endif + /// /// The project configuration in given solution configuration /// K: full solution configuration name (cfg + platform) @@ -133,6 +137,10 @@ internal ProjectInSolution(SolutionFile solution) _aspNetConfigurations = new Hashtable(StringComparer.OrdinalIgnoreCase); _projectConfigurations = new Dictionary(StringComparer.OrdinalIgnoreCase); + +#if FULL_SLN_PARSER + _folderFiles = new List(); +#endif } #endregion @@ -252,6 +260,16 @@ internal string TargetFrameworkMoniker set { _targetFrameworkMoniker = value; } } +#if FULL_SLN_PARSER + /// + /// Only apply to solution folder + /// + public IReadOnlyList FolderFiles + { + get { return _folderFiles.AsReadOnly(); } + } +#endif + #endregion #region Methods @@ -411,6 +429,16 @@ internal void UpdateUniqueProjectName(string newUniqueName) _uniqueProjectName = newUniqueName; } +#if FULL_SLN_PARSER + /// + /// Add the folder file. + /// + internal void AddFolderFile(string relativeFilePath) + { + _folderFiles.Add(relativeFilePath); + } +#endif + /// /// Cleanse the project name, by replacing characters like '@', '$' with '_' /// diff --git a/vendor/msbuild/src/Build/Construction/Solution/SolutionFile.cs b/vendor/msbuild/src/Build/Construction/Solution/SolutionFile.cs index 6748649..89a621e 100644 --- a/vendor/msbuild/src/Build/Construction/Solution/SolutionFile.cs +++ b/vendor/msbuild/src/Build/Construction/Solution/SolutionFile.cs @@ -799,6 +799,29 @@ private void ParseProject(string firstLine) line = ReadLine(); } } +#if FULL_SLN_PARSER + else if (line.StartsWith("ProjectSection(SolutionItems)", StringComparison.Ordinal)) + { + // We have a SolutionItems section. Each subsequent line should identify + // a solution item. + line = ReadLine(); + while ((line != null) && (!line.StartsWith("EndProjectSection", StringComparison.Ordinal))) + { + proj.ProjectType = SolutionProjectType.SolutionFolder; + + // This should be a dependency. The GUID identifying the parent project should + // be both the property name and the property value. + Match match = s_crackPropertyLine.Value.Match(line); + if (match.Success) + { + string relativeFilePath = match.Groups["PROPERTYNAME"].Value.Trim(); + proj.AddFolderFile(relativeFilePath); + } + + line = ReadLine(); + } + } +#endif else if (line.StartsWith("ProjectSection(WebsiteProperties)", StringComparison.Ordinal)) { // We have a WebsiteProperties section. This section is present only in Venus