diff options
4 files changed, 16 insertions, 11 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MD1/MD1DotNetProjectHandler.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MD1/MD1DotNetProjectHandler.cs index 989a06a787..56796eac0d 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MD1/MD1DotNetProjectHandler.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MD1/MD1DotNetProjectHandler.cs @@ -433,10 +433,15 @@ namespace MonoDevelop.Projects.MD1 public string EvaluateString (string value) { - string val = value.Replace ("$(Configuration)", config.Name).Replace ("$(Platform)", config.Platform); - return val; + string res; + if (ConfigPlatformCache.TryGetValue (value, out res)) + return res; + + ConfigPlatformCache[value] = res = value.Replace ("$(Configuration)", config.Name).Replace ("$(Platform)", config.Platform); + return res; } - public Dictionary<string, string> EvaluationCache { get; } = new Dictionary<string, string> (); + Dictionary<string, string> ConfigPlatformCache { get; } = new Dictionary<string, string> (); + public Dictionary<string, bool> ExistsEvaluationCache { get; } = new Dictionary<string, bool> (); } } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionAndExpression.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionAndExpression.cs index 6672f25e99..23d9666c90 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionAndExpression.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionAndExpression.cs @@ -96,6 +96,6 @@ namespace MonoDevelop.Projects.MSBuild.Conditions { { string FullFileName { get; } string EvaluateString (string value); - System.Collections.Generic.Dictionary<string, string> EvaluationCache { get; } + System.Collections.Generic.Dictionary<string, bool> ExistsEvaluationCache { get; } } } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionFunctionExpression.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionFunctionExpression.cs index e43d10c0d2..4ae8eea461 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionFunctionExpression.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild.Conditions/ConditionFunctionExpression.cs @@ -106,13 +106,13 @@ namespace MonoDevelop.Projects.MSBuild.Conditions { directory = Path.GetDirectoryName (context.FullFileName); file = MSBuildProjectService.FromMSBuildPath (directory, file); - string res; - if (context.EvaluationCache.TryGetValue (file, out res)) - return bool.Parse (res); + bool res; + if (context.ExistsEvaluationCache.TryGetValue (file, out res)) + return res; - var ret = File.Exists (file) || Directory.Exists (file); - context.EvaluationCache [file] = ret.ToString (); - return ret; + res = File.Exists (file) || Directory.Exists (file); + context.ExistsEvaluationCache [file] = res; + return res; } static bool HasTrailingSlash (string file, IExpressionContext context) diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEvaluationContext.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEvaluationContext.cs index 7edbfb2ff5..9792a3465f 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEvaluationContext.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEvaluationContext.cs @@ -48,7 +48,7 @@ namespace MonoDevelop.Projects.MSBuild static Dictionary<string, string> envVars = new Dictionary<string, string> (); HashSet<string> propertiesWithTransforms = new HashSet<string> (); List<string> propertiesWithTransformsSorted = new List<string> (); - public Dictionary<string, string> EvaluationCache { get; } = new Dictionary<string, string> (); + public Dictionary<string, bool> ExistsEvaluationCache { get; } = new Dictionary<string, bool> (); bool allResolved; MSBuildProject project; |