-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Windows x64 and arm64 builds #1846
base: main
Are you sure you want to change the base?
Add support for Windows x64 and arm64 builds #1846
Conversation
run: dotnet build --configuration WindowsRelease | ||
run: | | ||
dotnet build src/windows/Installer.Windows/Installer.Windows.csproj ` | ||
--configuration=Release ` | ||
--runtime=${{ matrix.runtime }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly, dotnet build
doesn't support setting --runtime
at the solution level. I basically took the same logic as #1633 by setting it at the project level: the Installer.Windows
project has all the necessary dependencies so this builds correctly.
<Exec Condition="'$(NoLayout)'!='true'" Command="powershell.exe –NonInteractive –ExecutionPolicy Unrestricted -Command "& {&'$(MSBuildProjectDirectory)\layout.ps1' -Configuration '$(Configuration)' -Output '$(PayloadPath)'}"" /> | ||
<Exec Condition="'$(NoLayout)'!='true'" | ||
ConsoleToMSBuild="true" | ||
Command="powershell.exe –NonInteractive –ExecutionPolicy Unrestricted -Command "& {&'$(MSBuildProjectDirectory)\layout.ps1' -Configuration '$(Configuration)' -Output '$(PayloadPath)' -RuntimeIdentifier '$(RuntimeIdentifier)'; if ($?) { exit 0 } else { exit 1 }}"" | ||
IgnoreExitCode="true"> | ||
<!-- If we want to display the console output if the exit code is not 0, we need to capture it and then output it using the <Error /> below --> | ||
<Output TaskParameter="ExitCode" PropertyName="ExitCodeOfExec" /> | ||
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" /> | ||
</Exec> | ||
<Error Condition="'$(NoLayout)'!='true' AND '$(ExitCodeOfExec)' != '0'" Text="Layout script failed with exit code $(ExitCodeOfExec) and message $(OutputOfExec)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While updating layout.ps1
, this initially just errored with the non-helpful ... exited with code 1
. The changes here ensure that the actual output of the layout.ps1
script will also be shown in case it fails.
; Windows ARM64 supports installing and running x64 binaries, but not vice versa. | ||
#if GcmRuntimeIdentifier=="win-x64" | ||
ArchitecturesAllowed=x64compatible | ||
ArchitecturesInstallIn64BitMode=x64compatible | ||
#elif GcmRuntimeIdentifier=="win-arm64" | ||
ArchitecturesAllowed=arm64 | ||
ArchitecturesInstallIn64BitMode=arm64 | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this logic, the supported installation types are:
Machine | x86 GCM installer | x64 GCM installer | arm64 GCM installer |
---|---|---|---|
x86 | ✅ | ❌ | ❌ |
x64 | ✅ | ✅ | ❌ |
arm64 | ✅ | ✅ | ✅ |
This ensures that e.g. x64 Windows can not accidentally install the arm64 GCM version, which it can't run. If you want, we could even make this more strict and force users of x64 Windows to install the x64 version and prohibit installation of the x86 version on that architecture, even though it will work on there as well. But that probably goes a bit too far.
Also, on x64 and arm64, this will install GCM into C:\Program Files\Git Credential Manager
instead of C:\Program Files (x86)\Git Credential Manager
.
Currently, GCM is only offered as an x86 build for Windows. On arm64, this results in poor performance because the code has to be fully emulated.
Luckily,
dotnet
fully supportswin-arm64
nowadays. Even the .NET Framework supports it! Here's some more details.This PR follows the same logic as #1633, which added support for Linux arm64. The main
git-credential-manager.exe
executable now becomes native, while the DLLs remainAny CPU
. This allows for .NET Framework to run natively on arm64. I also addedwin-x64
while at it.Confirmed to work correctly both on x64 and arm64 for GitHub operations.
x64
arm64