Skip to content

Commit

Permalink
[release/6.0.1xx-rc.1] Fixes Hot Restart build issues (#12517)
Browse files Browse the repository at this point in the history
* [net6] Bumps Xamarin Hot Restart to 1.0.70

This version contains fixes for building Maui projects with Hot Restart

* [msbuild] Fixes Hot Restart Entitlements.plist compilation

The build was failing if `CodesignEntitlements` was not set, even though the CompileEntitlements task has a default value. That default value is not compatible with Hot Restart because it is a template file that exists on the Mac (and Hot Restart is an offline build from Windows).

So if that property is not set we get the xcent file from the Hot Restart PreBuilt app bundle, which is essentially an empty plist.

* [net6] Makes Hot Restart consider Single Project app title

On a Maui Single Project the app title can be set on the project file using the `ApplicationTitle` property. If that's set Hot Restart should include that value in the compiled app manifest, so the app name is shown on the device when the app is deployed.

Co-authored-by: Emanuel Fernandez Dell'Oca <[email protected]>
  • Loading branch information
1 parent 453791f commit 2f30a46
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion msbuild/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MessagingVersion>1.3.27</MessagingVersion>
<HotRestartVersion>1.0.69</HotRestartVersion>
<HotRestartVersion>1.0.70</HotRestartVersion>
</PropertyGroup>
</Project>
6 changes: 6 additions & 0 deletions msbuild/Xamarin.iOS.Tasks.Windows/Tasks/CompileAppManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class CompileAppManifest : Task
[Required]
public string AppManifestPath { get; set; }

public string ApplicationTitle { get; set; }

#endregion

public override bool Execute()
Expand Down Expand Up @@ -60,6 +62,10 @@ public override bool Execute()
}
}

if (!string.IsNullOrEmpty (ApplicationTitle)) {
preBuiltInfoPlist[ManifestKeys.CFBundleDisplayName] = ApplicationTitle;
}

preBuiltInfoPlist.Save(preBuiltInfoPlistPath, binary: true);

return true;
Expand Down
10 changes: 8 additions & 2 deletions msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.HotRestart.targets
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,25 @@

<HotRestart.Tasks.CompileAppManifest
AppBundlePath="$(HotRestartAppBundlePath)"
AppManifestPath="$(_AppManifest)" />
AppManifestPath="$(_AppManifest)"
ApplicationTitle="$(ApplicationTitle)"/>
</Target>

<Target Name="_CompileHotRestartEntitlements"
Condition="'$(_CanOutputAppBundle)' == 'true' And '$(IsHotRestartBuild)' == 'true'"
Inputs="$(CodesignEntitlements);$(_ProvisioningProfilePath);$(HotRestartAppBundlePath)\Extracted"
Outputs="$(HotRestartSignedAppDir)archived-expanded-entitlements.xcent;$(HotRestartSignedAppDir)Extracted">

<PropertyGroup>
<_HotRestartEntitlementsFile>$(CodesignEntitlements)</_HotRestartEntitlementsFile>
<_HotRestartEntitlementsFile Condition="'$(_HotRestartEntitlementsFile)'== ''">$(HotRestartAppBundlePath)\archived-expanded-entitlements.xcent</_HotRestartEntitlementsFile>
</PropertyGroup>

<CompileEntitlements
AppBundleDir="$(HotRestartAppBundlePath)"
AppIdentifier="$(_AppIdentifier)"
BundleIdentifier="$(_BundleIdentifier)"
Entitlements="$(CodesignEntitlements)"
Entitlements="$(_HotRestartEntitlementsFile)"
CompiledEntitlements="$(DeviceSpecificIntermediateOutputPath)Entitlements.xcent"
IsAppExtension="$(IsAppExtension)"
ProvisioningProfile="$(_ProvisioningProfileId)"
Expand Down

5 comments on commit 2f30a46

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ [CI Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

API Diff (from PR only) (no change)
Generator Diff (only version changes)

Packages generated

View packages

Test results

3 tests failed, 247 tests passed.

Failed tests

  • introspection/Mac Catalyst/Debug [dotnet]: TimedOut (Execution timed out after 1200 seconds.
    No test log file was produced)
  • monotouch-test/iOS Unified 64-bits - simulator/Release (all optimizations) [dotnet]: Failed
  • Documentation/All: Failed

Pipeline on Agent XAMBOT-1027.BigSur'
[release/6.0.1xx-rc.1] Fixes Hot Restart build issues (#12517)

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[release/6.0.1xx-rc.1] Fixes Hot Restart build issues (#12517)

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[release/6.0.1xx-rc.1] Fixes Hot Restart build issues (#12517)

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Tests failed on macOS M1 - Mac Big Sur (11.5) ❌

Tests failed on M1 - Mac Big Sur (11.5).

Failed tests are:

  • xammac_tests

Pipeline on Agent
[release/6.0.1xx-rc.1] Fixes Hot Restart build issues (#12517)

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Tests passed on macOS Mac Mojave (10.14) ✅

Tests passed

All tests on macOS X Mac Mojave (10.14) passed.

Pipeline on Agent
[release/6.0.1xx-rc.1] Fixes Hot Restart build issues (#12517)

Please sign in to comment.