[dotnet] macOS/MacCatalyst Archive and publishing support (#15720)
These changes are required to support Archive and Publishing for .NET macOS/MacCatalyst projects from VS for Mac. Co-authored-by: Alex Soto <alex@alexsoto.me>
This commit is contained in:
Родитель
15d27acd92
Коммит
b1a732d526
|
@ -42,7 +42,6 @@ namespace Xamarin.MacDev.Tasks
|
|||
|
||||
public string SolutionPath { get; set; }
|
||||
|
||||
[Required]
|
||||
public string SigningKey { get; set; }
|
||||
|
||||
public ITaskItem [] WatchAppReferences { get; set; }
|
||||
|
@ -205,6 +204,7 @@ namespace Xamarin.MacDev.Tasks
|
|||
if (icons.Count > 0)
|
||||
props.Add ("IconPaths", icons);
|
||||
|
||||
if (!string.IsNullOrEmpty (SigningKey))
|
||||
props.Add ("SigningIdentity", SigningKey);
|
||||
|
||||
arInfo.Add ("ApplicationProperties", props);
|
||||
|
|
|
@ -289,7 +289,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
|
|||
<Delete SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Files="$(DeviceSpecificOutputPath)bundler.stamp" />
|
||||
</Target>
|
||||
|
||||
<Target Name="_CleanAppBundleRootDirectory" Condition="'$(_PlatformName)' == 'MacCatalyst' Or '$(_PlatformName)' == 'macOS'">
|
||||
<Target Name="_CleanAppBundleRootDirectory" Condition="'$(_PlatformName)' == 'MacCatalyst' Or '$(_PlatformName)' == 'macOS'" DependsOnTargets="_GenerateBundleName">
|
||||
<!-- There shouldn't be any files in the root directory of the app bundle for macOS or Mac Catalyst (signing will fail) -->
|
||||
|
||||
<!-- Delete any crash dumps in the app bundle that might exist. Ref: https://github.com/xamarin/xamarin-macios/issues/12320 -->
|
||||
|
@ -1425,6 +1425,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
|
|||
<_AppBundleManifestPath>$(_AppBundlePath)$(_AppBundleManifestRelativePath)Info.plist</_AppBundleManifestPath>
|
||||
<!-- We should only write out a compiled app manifest if we're creating an app bundle -->
|
||||
<_CreateAppManifest>$(_CanOutputAppBundle)</_CreateAppManifest>
|
||||
<_CreateAppManifest Condition="'$(IsAppDistribution)' == 'true'">false</_CreateAppManifest>
|
||||
<_TemporaryAppManifest>$(DeviceSpecificIntermediateOutputPath)AppManifest.plist</_TemporaryAppManifest>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
@ -1829,6 +1830,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
|
|||
|
||||
<_CodesignAppBundleDependsOn>
|
||||
$(_CodesignAppBundleDependsOn);
|
||||
_DetectSigningIdentity;
|
||||
_CleanAppBundleRootDirectory;
|
||||
_EmbedProvisionProfile;
|
||||
_CollectCodesigningData;
|
||||
|
@ -2728,7 +2730,17 @@ Copyright (C) 2018 Microsoft. All rights reserved.
|
|||
</CompileProductDefinition>
|
||||
</Target>
|
||||
|
||||
<Target Name="_CreateInstaller" Condition="'$(CreatePackage)' == 'true' And '$(_CanOutputAppBundle)' == 'true'" DependsOnTargets="Codesign;_CompileProductDefinition;_WriteAppManifest">
|
||||
<PropertyGroup>
|
||||
<_CreateInstallerDependsOn>
|
||||
_GenerateBundleName;
|
||||
_GetAppBundleEntitlements;
|
||||
Codesign;
|
||||
_CompileProductDefinition;
|
||||
_WriteAppManifest
|
||||
</_CreateInstallerDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="_CreateInstaller" Condition="'$(CreatePackage)' == 'true' And '$(_CanOutputAppBundle)' == 'true'" DependsOnTargets="$(_CreateInstallerDependsOn)">
|
||||
<PropertyGroup>
|
||||
<PkgPackageDir Condition="'$(PkgPackageDir)' == ''">$(TargetDir)</PkgPackageDir>
|
||||
</PropertyGroup>
|
||||
|
@ -2751,6 +2763,25 @@ Copyright (C) 2018 Microsoft. All rights reserved.
|
|||
</CreateInstallerPackage>
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
Creates a plist with the entitlements used to sign the App bundle.
|
||||
MacCatalyst apps don't have a compiled entitlements file in the app bundle,
|
||||
so to re-sign the app we need to reuse the entitlements that were originally used to sign it
|
||||
-->
|
||||
<Target Name="_GetAppBundleEntitlements" Condition="'$(IsAppDistribution)' == 'true' And '$(CodesignEntitlements)' == '' And Exists('$(AppBundleDir)\Contents\_CodeSignature')">
|
||||
<PropertyGroup>
|
||||
<_CompiledCodesignEntitlements>$(DeviceSpecificIntermediateOutputPath)AppBundleEntitlements.plist</_CompiledCodesignEntitlements>
|
||||
</PropertyGroup>
|
||||
|
||||
<Delete SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Files="$(_CompiledCodesignEntitlements)" />
|
||||
|
||||
<!-- The following command grabs the entitlements that are part of the signature of the app bundle, and creates a plist containing those -->
|
||||
<Exec
|
||||
SessionId="$(BuildSessionId)"
|
||||
Condition="'$(IsMacEnabled)' == 'true'"
|
||||
Command="codesign --display --entitlements '$(_CompiledCodesignEntitlements)' --xml '$(AppBundleDir)'" />
|
||||
</Target>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Extensibility point for VS Publishing Workflow -->
|
||||
<_BeforeCreateIpaForDistributionDependsOn />
|
||||
|
|
Загрузка…
Ссылка в новой задаче