[xbuild] Fix warnings.
[mono.git] / mcs / tools / xbuild / SolutionParser.cs
index d17a67f8f34bbcafea13041284d908806cd3bc62..b9f5090e2a4e8162ab250abdd8c861d88b932751 100644 (file)
@@ -93,7 +93,7 @@ namespace Mono.XBuild.CommandLine {
                static string guidExpression = "{[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}";
 
                static Regex slnVersionRegex = new Regex (@"Microsoft Visual Studio Solution File, Format Version (\d?\d.\d\d)");
-               static Regex projectRegex = new Regex ("Project\\(\"(" + guidExpression + ")\"\\) = \"(.*?)\", \"(.*?)\", \"(" + guidExpression + ")\"(\\s*?)((\\s*?)ProjectSection\\((.*?)\\) = (.*?)EndProjectSection(\\s*?))*(\\s*?)EndProject?", RegexOptions.Singleline);
+               static Regex projectRegex = new Regex ("Project\\(\"(" + guidExpression + ")\"\\) = \"(.*?)\", \"(.*?)\", \"(" + guidExpression + ")\"(\\s*?)((\\s*?)ProjectSection\\((.*?)\\) = (.*?)EndProjectSection(\\s*?))*(\\s*?)(EndProject)?", RegexOptions.Singleline);
                static Regex projectDependenciesRegex = new Regex ("ProjectSection\\((.*?)\\) = \\w*(.*?)EndProjectSection", RegexOptions.Singleline);
                static Regex projectDependencyRegex = new Regex ("\\s*(" + guidExpression + ") = (" + guidExpression + ")");
                static Regex projectSectionPropertiesRegex = new Regex ("\\s*(?<name>.*) = \"(?<value>.*)\"");
@@ -246,7 +246,7 @@ namespace Mono.XBuild.CommandLine {
                                                        else
                                                                RaiseWarning (0, String.Format (
                                                                                "{0}: ProjectReference '{1}' not found, neither by guid '{2}' nor by project file name '{3}'.",
-                                                                               filename, bi.Include, projectReferenceGuid, fullpath));
+                                                                               filename, bi.Include, projectReferenceGuid.Replace ("{", "").Replace ("}", ""), fullpath));
                                                }
 
                                        }
@@ -313,7 +313,6 @@ namespace Mono.XBuild.CommandLine {
 
                 string GetSlnFileVersion (StreamReader reader)
                 {
-                        string strVersion = null;
                         string strInput = null;
                         Match match;
 
@@ -751,20 +750,10 @@ namespace Mono.XBuild.CommandLine {
                                        string target_name = GetTargetNameForProject (project.Name, buildTarget);
                                        Target target = p.Targets.AddNewTarget (target_name);
                                        target.Condition = "'$(CurrentSolutionConfigurationContents)' != ''"; 
-
-                                       if (project.Dependencies.Count > 0) {
-                                               StringBuilder dependencies = new StringBuilder ();
-                                               foreach (ProjectInfo dependentInfo in project.Dependencies.Values) {
-                                                       if (dependencies.Length > 0)
-                                                               dependencies.Append (";");
-                                                       if (IsBuildTargetName (dependentInfo.Name))
-                                                               dependencies.Append ("Solution:");
-                                                       dependencies.Append (dependentInfo.Name);
-                                                       if (buildTarget != "Build")
-                                                               dependencies.Append (":" + buildTarget);
-                                               }
-                                               target.DependsOnTargets = dependencies.ToString ();
-                                       }
+                                       if (project.Dependencies.Count > 0)
+                                               target.DependsOnTargets = String.Join (";",
+                                                               project.Dependencies.Values.Select (
+                                                                       di => GetTargetNameForProject (di.Name, buildTarget)).ToArray ());
 
                                        foreach (TargetInfo targetInfo in solutionTargets) {
                                                BuildTask task = null;