Browse Source

Solution configuration management: preserve Deploy.0 flag.

pull/32/merge
Daniel Grunwald 12 years ago
parent
commit
d4ccfd282d
  1. 27
      src/Main/Base/Project/Project/Configuration/ConfigurationMapping.cs
  2. 3
      src/Main/SharpDevelop/Project/Configuration/SolutionConfigurationOrPlatformNameCollection.cs
  3. 19
      src/Main/SharpDevelop/Project/SolutionLoader.cs
  4. 2
      src/Main/SharpDevelop/Project/SolutionWriter.cs

27
src/Main/Base/Project/Project/Configuration/ConfigurationMapping.cs

@ -19,6 +19,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -19,6 +19,7 @@ namespace ICSharpCode.SharpDevelop.Project
{
public ConfigurationAndPlatform Config;
public bool Build = true;
public bool Deploy = false;
public Entry(ConfigurationAndPlatform config)
{
@ -103,6 +104,32 @@ namespace ICSharpCode.SharpDevelop.Project @@ -103,6 +104,32 @@ namespace ICSharpCode.SharpDevelop.Project
Changed(this, EventArgs.Empty);
}
/// <summary>
/// Gets whether deploying the project is enabled in the given solution configuration.
/// </summary>
public bool IsDeployEnabled(ConfigurationAndPlatform solutionConfiguration)
{
lock (dict) {
Entry entry;
if (dict.TryGetValue(solutionConfiguration, out entry)) {
return entry.Build;
} else {
return false;
}
}
}
/// <summary>
/// Sets whether deploying the project is enabled in the given solution configuration.
/// </summary>
public void SetDeployEnabled(ConfigurationAndPlatform solutionConfiguration, bool value)
{
lock (dict) {
GetOrCreateEntry(solutionConfiguration).Deploy = value;
}
Changed(this, EventArgs.Empty);
}
/// <summary>
/// Removes all data stored about the specified solution configuration.
/// </summary>

3
src/Main/SharpDevelop/Project/Configuration/SolutionConfigurationOrPlatformNameCollection.cs

@ -98,6 +98,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -98,6 +98,7 @@ namespace ICSharpCode.SharpDevelop.Project
var newSolutionConfig = isPlatform ? new ConfigurationAndPlatform(otherName, newName) : new ConfigurationAndPlatform(newName, otherName);
mapping.SetProjectConfiguration(newSolutionConfig, mapping.GetProjectConfiguration(sourceSolutionConfig));
mapping.SetBuildEnabled(newSolutionConfig, mapping.IsBuildEnabled(sourceSolutionConfig));
mapping.SetDeployEnabled(newSolutionConfig, mapping.IsDeployEnabled(sourceSolutionConfig));
}
}
}
@ -151,9 +152,11 @@ namespace ICSharpCode.SharpDevelop.Project @@ -151,9 +152,11 @@ namespace ICSharpCode.SharpDevelop.Project
var newSolutionConfig = isPlatform ? new ConfigurationAndPlatform(otherName, newName) : new ConfigurationAndPlatform(newName, otherName);
var projectConfig = mapping.GetProjectConfiguration(oldSolutionConfig);
var buildEnabled = mapping.IsBuildEnabled(oldSolutionConfig);
var deployEnabled = mapping.IsDeployEnabled(oldSolutionConfig);
mapping.Remove(oldSolutionConfig);
mapping.SetProjectConfiguration(newSolutionConfig, projectConfig);
mapping.SetBuildEnabled(newSolutionConfig, buildEnabled);
mapping.SetDeployEnabled(newSolutionConfig, deployEnabled);
}
}
}

19
src/Main/SharpDevelop/Project/SolutionLoader.cs

@ -281,18 +281,19 @@ namespace ICSharpCode.SharpDevelop.Project @@ -281,18 +281,19 @@ namespace ICSharpCode.SharpDevelop.Project
projectInfo.ConfigurationMapping.SetBuildEnabled(solutionConfig, false);
}
}
// Re-enable build if we see a '.Build.0' entry:
// Enable build/deploy if we see the corresponding entries:
foreach (var pair in section) {
// pair is an entry like this: '{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.Build.0 = Debug|Any CPU'
Guid guid;
ConfigurationAndPlatform solutionConfig;
if (!TryParseProjectConfigurationKey(pair.Key, out guid, out solutionConfig))
continue;
ProjectLoadInformation projectInfo;
if (!projectInfoDict.TryGetValue(guid, out projectInfo))
continue;
if (pair.Key.EndsWith(".Build.0", StringComparison.OrdinalIgnoreCase)) {
Guid guid;
ConfigurationAndPlatform solutionConfig;
if (!TryParseProjectConfigurationKey(pair.Key, out guid, out solutionConfig))
continue;
ProjectLoadInformation projectInfo;
if (!projectInfoDict.TryGetValue(guid, out projectInfo))
continue;
projectInfo.ConfigurationMapping.SetBuildEnabled(solutionConfig, true);
} else if (pair.Key.EndsWith(".Deploy.0", StringComparison.OrdinalIgnoreCase)) {
projectInfo.ConfigurationMapping.SetDeployEnabled(solutionConfig, true);
}
}
}

2
src/Main/SharpDevelop/Project/SolutionWriter.cs

@ -174,6 +174,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -174,6 +174,8 @@ namespace ICSharpCode.SharpDevelop.Project
section.Add(key + ".ActiveCfg", value);
if (project.ConfigurationMapping.IsBuildEnabled(solutionConfig))
section.Add(key + ".Build.0", value);
if (project.ConfigurationMapping.IsDeployEnabled(solutionConfig))
section.Add(key + ".Deploy.0", value);
}
}
}

Loading…
Cancel
Save