-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 TargetPlatform property #11625
base: master
Are you sure you want to change the base?
Add TargetPlatform property #11625
Conversation
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.
Few questions, but overall, this looks good. Thank you.
Directory.Build.props
Outdated
<!-- Set the target platform manually to be x86 (default), x64, arm64 --> | ||
<TargetPlatform Condition=" '$(TargetPlatform)' == '' ">x86</TargetPlatform> |
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.
IMO it should be inverted; x86 is a thing of a past, the default should be x64.
<!-- Set the target platform manually to be x86 (default), x64, arm64 --> | |
<TargetPlatform Condition=" '$(TargetPlatform)' == '' ">x86</TargetPlatform> | |
<!-- Set the target platform manually to be x64 (default), x86, arm64 --> | |
<TargetPlatform Condition=" '$(TargetPlatform)' == '' ">x64</TargetPlatform> |
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.
Yes, I agree that we should move forward and default to x64
Windows platform, but this comes with a catch: the resulting .msi
installer package will refuse to install in x86 (i.e. 32-bit) Windows box. Is this restriction acceptable?
With the default x86
platform, the .msi package will be installable on all 3 Windows platforms: x86, x64 and Arm64; it's the package of the "lowest common denominator." But I guess at some point we need to cut off this x86
support...
Anyway, the AppVeyor build script could be changed to generate packages for both x86
and x64
platforms at the same build time:
dotnet publish -c Release /p:TargetPlatform=x86
dotnet publish -c Release /p:TargetPlatform=x64
and the user can pick whatever .msi package they want to install.
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.
IIRC, there was some flag in the isntaller that forced user to manually uninstall the old app first then install the new one. This way we could migrate the user to the new 64bit app.
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.
Have a look into Setup/EnableUpgrades.wxi var.MinSupportedVersion
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.
I think all these extra requirements (default x64, upgrade strategy, minimum support version) should belong to a different PR than this one, as they require far too much work/consideration as compared to my original intention for this PR.
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.
Sure
@@ -249,7 +249,8 @@ | |||
|
|||
<!-- This property comes from GitInfo package, but can be overriden on AppVeyor --> | |||
<_PublishPortableCommitHashSuffix Condition="'$(GitCommit)' != ''">-$(GitCommit)</_PublishPortableCommitHashSuffix> | |||
<_PublishPortableFileName>GitExtensions-Portable$(_PublishPortableVersionSuffix)$(_PublishPortableCommitHashSuffix).zip</_PublishPortableFileName> | |||
<_PublishPortableFileName Condition="'$(TargetPlatform)' == 'x86'">GitExtensions-Portable$(_PublishPortableVersionSuffix)$(_PublishPortableCommitHashSuffix).zip</_PublishPortableFileName> | |||
<_PublishPortableFileName Condition="'$(TargetPlatform)' != 'x86'">GitExtensions-Portable-$(TargetPlatform)$(_PublishPortableVersionSuffix)$(_PublishPortableCommitHashSuffix).zip</_PublishPortableFileName> |
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.
I think we should always add the platform to the name to avoid confusion.
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.
Yes, I agree with this explicit platform in the build artifacts' names.
<PropertyGroup> | ||
<_AppVeyorSuffix>$(ARTIFACT_BUILD_SUFFIX)</_AppVeyorSuffix> | ||
<_PublishMsiVersionSuffix>-$(CurrentBuildVersion.ToString())$(_AppVeyorSuffix)</_PublishMsiVersionSuffix> | ||
<_PublishMsiCommitHashSuffix Condition="'$(GitCommit)' != ''">-$(GitCommit)</_PublishMsiCommitHashSuffix> | ||
<_PublishMsiCommitHashSuffix Condition="'$(env:APPVEYOR_REPO_COMMIT)' != ''">-$(env:APPVEYOR_REPO_COMMIT)</_PublishMsiCommitHashSuffix> | ||
<_PublishMsiCommitHashSuffix Condition="'$(env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT)' != ''">-$(env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT)</_PublishMsiCommitHashSuffix> | ||
<_PublishMsiFileName>GitExtensions$(_PublishMsiVersionSuffix)$(_PublishMsiCommitHashSuffix)</_PublishMsiFileName> | ||
<_PublishMsiFileName Condition="'$(TargetPlatform)' == 'x86'">GitExtensions$(_PublishMsiVersionSuffix)$(_PublishMsiCommitHashSuffix)</_PublishMsiFileName> | ||
<_PublishMsiFileName Condition="'$(TargetPlatform)' != 'x86'">GitExtensions-$(TargetPlatform)$(_PublishMsiVersionSuffix)$(_PublishMsiCommitHashSuffix)</_PublishMsiFileName> |
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.
ditto
@@ -62,7 +62,7 @@ | |||
</Exec> | |||
<!-- Build GitExtensionsShellEx project, x86 --> | |||
<Exec | |||
Condition="'$(Arm64Build)' != 'true'" | |||
Condition="'$(TargetPlatform)' != 'arm64'" |
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.
ditto
@@ -71,7 +71,7 @@ | |||
</Exec> | |||
<!-- Build GitExtensionsShellEx project, x64 --> | |||
<Exec | |||
Condition="'$(Arm64Build)' != 'true'" | |||
Condition="'$(TargetPlatform)' != 'arm64'" |
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.
Should this be constrained to x64 only? That is, this can't be used on x86 platforms.
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.
The default x86
package has always included this 64-bit component during build, but it is restricted (i.e. ignored) at installation time on an x86
(i.e. 32-bit) Windows box, by this condition in Product.wxs
:
gitextensions/Setup/Product.wxs
Line 246 in b4100e3
<Condition>VersionNT64</Condition> |
So it's safe to keep this thing as-is. But I don't have a 32-bit Windows box to really test it...
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.
I don't think anyone does these days :)
to control the specific platform for the GE installer (.msi) package. Currently the GE installer package is hard-coded to be built for the "x86" platform, with "C:\Program Files (x86)" as default installation folder. This makes sense to install it on the x86 (i.e. 32-bit) or x64 (i.e. 64-bit) Windows platforms, but feels weird when building an Arm64-specific installer package for Windows on Arm64 platform. This commit defines a new "TargetPlatform" property which can take the following values: "x86" (default), "x64", and "arm64". This property is passed on to the "Platform" parameter for WiX to create relevant installer package specific to that platform. Like any other property, this property can be specified on the command line to build a platform-specific installer, rather than using the default "x86" platform value. To build GE, the current build command series still work as before: dotnet build -c Release dotnet build -c Release script\native.proj dotnet publish -c Release and the following build artifacts are produced in the "artifacts\Release\publish" folder for the "x86" platform just like before (for example): GitExtensions-33.33.33.0-0e12afbf1.msi GitExtensions-Portable-33.33.33.0-0e12afbf1.zip If the TargetPlatform=x64 property value is specified in the "publish" command, like: dotnet publish -c Release /p:TargetPlatform=x64 then the following files are produced: GitExtensions-x64-33.33.33.0-0e12afbf1.msi GitExtensions-Portable-x64-33.33.33.0-0e12afbf1.zip The above x64 installer (.msi) package will default to "C:\Program Files" as the installation folder, and will refuse to install on x86 (i.e. 32-bit) Windows platform. Similarly, to produce an Arm64-specific installer package, the following build commands should be executed on a Windows on Arm64 box: dotnet build -c Release dotnet build -c Release script\native.proj /p:TargetPlatform=arm64 dotnet publish -c Release /p:TargetPlatform=arm64 and the following files will be produced for Arm64: GitExtensions-arm64-33.33.33.0-0e12afbf1.msi GitExtensions-Portable-arm64-33.33.33.0-0e12afbf1.zip The above Arm64 installer (.msi) package will default to "C:\Program Files" as the installation folder, and will refuse to install on any Windows platform except the Windows on Arm64 platform.
d8564ed
to
5a73892
Compare
Branch rebased to latest in master, and updated with the following as discussed:
|
Add new
TargetPlatform
property, to control the specific platform for the GE installer (.msi) package.Currently the GE installer package is hard-coded to be built for the
x86
platform, withC:\Program Files (x86)
as the default installation folder. This makes sense to install it on thex86
(i.e. 32-bit) Windows platform, but a bit weird onx64
(i.e. 64-bit) Windows platform (as discussed in #11554), and really feels weird when building anArm64-specific
installer package for Windows on Arm64 platform.This commit defines a new
TargetPlatform
property which can take the following values:x64
(default),x86
, orarm64
(must be lower-case values, as required by Wix). This property is passed on to thePlatform
parameter for WiX to create relevant installer package specific to that platform. Like any other property, thisTargetPlatform
property can be specified on the command line to build a platform-specific installer, rather than using the defaultx64
platform value.To build GE, the current build command series still work as before:
and the following build artifacts are produced in the
artifacts\Release\publish
folder for thex64
platform; for example:The above
x64
installer (.msi) package will default toC:\Program Files
as the installation folder, and will refuse to install onx86
(i.e. 32-bit) Windows platform. It can be installed on Windows on Arm64 platform, as this platform contains translation layer for runningx64
program.If the
TargetPlatform=x86
property value is specified in thepublish
command, like:then the following files are produced:
The above
x86
installer (.msi) package will default toC:\Program Files (x86)
as the installation folder, and can install onx86
(i.e. 32-bit) Windows,x64
Windows and Windows on Arm64 platforms.Similarly, to produce an
Arm64-specific
installer package, the following build commands should be executed on a Windows on Arm64 box:and the following files will be produced for Arm64:
The above
arm64
installer (.msi) package will default toC:\Program Files
as the installation folder, and will refuse to install on any Windows platform except the Windows on Arm64 platform.Fixes #11554
Test methodology
x64
platform, and check that it installs to the defaultC:\Program Files
folder and works properly on x64 and/or Arm64 Windows platforms. It should refuse to install on an x86 (i.e. 32-bit) Windows platform (but none are available to test.)x86
platform GE installer, by specifying theTargetPlatform=x86
property on thepublish
command, and check that it installs to the defaultC:\Program Files (x86)
folder and works properly on x64 and/or Arm64 Windows platforms. It should work on an x86 (i.e. 32-bit) Windows platform too, but none are available to test.Arm64
platform, by specifying theTargetPlatform=arm64
property on thepublish
command, and check that it installs to the defaultC:\Program Files
folder and works properly on Arm64 Windows platform. Check that it should refuse to install onx64
Windows platform. It should refuse to install on an x86 (i.e. 32-bit) Windows platform too, but none are available to test.Test environment(s)
Merge strategy
I agree that the maintainer squash merge this PR (if the commit message is clear).
✒️ I contribute this code under The Developer Certificate of Origin.