Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Microsoft.VisualStudio.SolutionPersistence.Model;
/// <summary>
/// Helper to process configuration rules.
/// </summary>
internal readonly struct ConfigurationRuleFollower(IReadOnlyList<ConfigurationRule>? configurationRules)
internal readonly ref struct ConfigurationRuleFollower(IReadOnlyList<ConfigurationRule>? configurationRules)
{
private readonly IReadOnlyList<ConfigurationRule>? configurationRules = configurationRules;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal sealed partial class SolutionConfigurationMap
/// </summary>
/// <param name="projectMappings">The mappings to update.</param>
/// <param name="scopedRules">The rules to run, scoped to their effect.</param>
private void ApplyRules(in SolutionToProjectMappings projectMappings, in ScopedRules scopedRules)
private void ApplyRules(in SolutionToProjectMappings projectMappings, scoped in ScopedRules scopedRules)
{
int iBuildTypeBegin = scopedRules.BuildTypeIndex == ScopedRules.All ? 0 : scopedRules.BuildTypeIndex;
int iBuildTypeEnd = scopedRules.BuildTypeIndex == ScopedRules.All ? this.BuildTypesCount : scopedRules.BuildTypeIndex + 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace Microsoft.VisualStudio.SolutionPersistence.Model;
internal sealed partial class SolutionConfigurationMap
{
private readonly SolutionModel solutionModel;
private readonly Dictionary<string, int> buildTypesIndex = [];
private readonly Dictionary<string, int> platformsIndex = [];
private readonly Dictionary<string, int> buildTypesIndex;
private readonly Dictionary<string, int> platformsIndex;

private readonly Dictionary<SolutionProjectModel, SolutionToProjectMappings> perProjectCurrent = [];

Expand All @@ -19,11 +19,13 @@ internal sealed partial class SolutionConfigurationMap
internal SolutionConfigurationMap(SolutionModel solutionModel)
{
this.solutionModel = solutionModel;
this.buildTypesIndex = new Dictionary<string, int>(solutionModel.BuildTypes.Count);
for (int i = 0; i < solutionModel.BuildTypes.Count; i++)
{
this.buildTypesIndex.Add(solutionModel.BuildTypes[i], i);
}

this.platformsIndex = new Dictionary<string, int>(solutionModel.Platforms.Count);
for (int i = 0; i < solutionModel.Platforms.Count; i++)
{
this.platformsIndex.Add(PlatformNames.Canonical(solutionModel.Platforms[i]), i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@ static void SetProjectConfigurationPlatforms(SolutionModel solution, SolutionPro
{
ParseProjectConfigLine(solution, projectKey, projectValue);
}

solution.DistillProjectConfigurations();
}

// Applies a .SLN configuration line to the current project configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ internal static async Task SaveAsync(
model.RemoveObsoleteProperties();
}

model.DistillProjectConfigurations();

// If this started as an XML document, merge the changes back into the original document.
SlnxFile root = modelExtension?.Root ?? CreateNewSlnFile(fullPath, xmlSerializerSettings, model.StringTable);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static void CreateModifiedModel(SolutionModel solution)

SolutionProjectModel? project = solution.FindProject(Path.Join("other", "Project4.nativeproj"));
Assert.NotNull(project);
project.AddProjectConfigurationRule(new ConfigurationRule(BuildDimension.Platform, "*", "Z80", "Z80"));
project.AddProjectConfigurationRule(new ConfigurationRule(BuildDimension.Platform, "*", "Arm64", "Z80"));

SolutionProjectModel? project3 = solution.FindProject("Project3.csproj");
Assert.NotNull(project3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<BuildDependency Project="Project2.nativeproj" />
<BuildDependency Project="Project3.csproj" />
<BuildDependency Project="Project3.nativeproj" />
<Platform Solution="*|Z80" Project="Z80" />
<Platform Solution="*|Arm64" Project="Z80" />
</Project>
<Project Path="other/Project5.nativeproj" />
<Project Path="other/Project6.nativeproj" />
Expand Down