Skip to content

Commit

Permalink
Add support for ARM and ARM64 (#446)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkl authored Jan 30, 2023
1 parent a76f2fd commit 771985b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
28 changes: 27 additions & 1 deletion src/Microsoft.VisualStudio.SlnGen.UnitTests/SlnFileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,35 @@ public void CustomConfigurationAndPlatforms()
ProjectTypeGuid = Guid.NewGuid(),
};

SlnProject projectF = new SlnProject
{
Configurations = new[] { "Debug" },
FullPath = GetTempFileName(),
IsMainProject = true,
Name = "ProjectF",
Platforms = new[] { "ARM" },
ProjectGuid = Guid.NewGuid(),
ProjectTypeGuid = Guid.NewGuid(),
};

SlnProject projectG = new SlnProject
{
Configurations = new[] { "Debug" },
FullPath = GetTempFileName(),
IsMainProject = true,
Name = "ProjectG",
Platforms = new[] { "ARM64" },
ProjectGuid = Guid.NewGuid(),
ProjectTypeGuid = Guid.NewGuid(),
};

SlnFile slnFile = new SlnFile()
{
Configurations = new[] { "Debug" },
Platforms = new[] { "Any CPU" },
};

slnFile.AddProjects(new[] { projectA, projectB, projectC, projectD, projectE });
slnFile.AddProjects(new[] { projectA, projectB, projectC, projectD, projectE, projectF, projectG });

string solutionFilePath = GetTempFileName();

Expand All @@ -97,6 +119,10 @@ public void CustomConfigurationAndPlatforms()
ValidateSolutionPlatformAndConfiguration(projectD, solutionFile, "Debug", "Razzle", expectedIncludeInBuild: false);

ValidateSolutionPlatformAndConfiguration(projectE, solutionFile, "Release", "AnyCPU", expectedIncludeInBuild: true);

ValidateSolutionPlatformAndConfiguration(projectF, solutionFile, "Debug", "ARM");

ValidateSolutionPlatformAndConfiguration(projectG, solutionFile, "Debug", "ARM64");
}

[Fact]
Expand Down
26 changes: 26 additions & 0 deletions src/Microsoft.VisualStudio.SlnGen/SlnFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ private IEnumerable<string> GetValidSolutionPlatforms(IEnumerable<string> platfo
"x86" => platform,
"amd64" => "x64",
"win32" => "x86",
"arm" => platform,
"arm64" => platform,
_ => null
};
})
Expand Down Expand Up @@ -627,6 +629,8 @@ private bool TryGetProjectSolutionPlatform(string solutionPlatform, SlnProject p
bool containsAmd64 = false;
bool containsX86 = false;
bool containsAnyCPU = false;
bool containsArm = false;
bool containsArm64 = false;

foreach (string projectPlatform in project.Platforms)
{
Expand Down Expand Up @@ -661,6 +665,14 @@ private bool TryGetProjectSolutionPlatform(string solutionPlatform, SlnProject p
case "win32":
containsWin32 = true;
break;

case "arm":
containsArm = true;
break;

case "arm64":
containsArm64 = true;
break;
}
}

Expand Down Expand Up @@ -693,6 +705,20 @@ private bool TryGetProjectSolutionPlatform(string solutionPlatform, SlnProject p

return true;
}

if (containsArm)
{
projectSolutionPlatform = projectBuildPlatform = "ARM";

return true;
}

if (containsArm64)
{
projectSolutionPlatform = projectBuildPlatform = "ARM64";

return true;
}
}

if (string.Equals(solutionPlatform, "x86", StringComparison.OrdinalIgnoreCase))
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "9.4",
"version": "9.5",
"assemblyVersion": "3.0",
"buildNumberOffset": 0,
"publicReleaseRefSpec": [
Expand Down

0 comments on commit 771985b

Please sign in to comment.