[msbuild] Share the _CleanAppBundleRootDirectory target between iOS and Mac logic. (#13680)

This commit is contained in:
Rolf Bjarne Kvinge 2022-01-12 19:21:45 +01:00 коммит произвёл GitHub
Родитель 17fbe27c1a
Коммит 38cf423936
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 42 добавлений и 36 удалений

Просмотреть файл

@ -67,6 +67,7 @@ Copyright (C) 2014 Xamarin. All rights reserved.
<PropertyGroup>
<_CodesignAppBundleDependsOn>
$(_CodesignAppBundleDependsOn);
_CreateAppBundle;
_EmbedProvisionProfile;
_CodesignNativeLibraries;

Просмотреть файл

@ -293,6 +293,41 @@ 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'">
<!-- 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 -->
<!-- Use a task to collect the files, so that we get the correct behavior on Windows -->
<GetFileSystemEntries
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' And ('$(_PlatformName)' == 'MacCatalyst' Or '$(_PlatformName)' == 'macOS')"
DirectoryPath="$(AppBundleDir)"
Pattern="mono_crash.*"
Recursive="false"
IncludeDirectories="false"
>
<Output TaskParameter="Entries" ItemName="_MonoCrashDumpsInAppBundle" />
</GetFileSystemEntries>
<Delete
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' And ('$(_PlatformName)' == 'MacCatalyst' Or '$(_PlatformName)' == 'macOS')"
Files="@(_MonoCrashDumpsInAppBundle)"
/>
<!-- Warn about any files that are left -->
<GetFileSystemEntries
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' And ('$(_PlatformName)' == 'MacCatalyst' Or '$(_PlatformName)' == 'macOS')"
DirectoryPath="$(AppBundleDir)"
Pattern="*"
Recursive="false"
IncludeDirectories="false"
>
<Output TaskParameter="Entries" ItemName="_FilesInAppBundleRootDirectory" />
</GetFileSystemEntries>
<Warning Text="Found files in the root directory of the app bundle. This will likely cause codesign to fail. Files:%0a@(_FilesInAppBundleRootDirectory, '%0a')" Condition="@(_FilesInAppBundleRootDirectory->Count()) &gt; 0"/>
</Target>
<Target Name="_CleanBindingResourcePackage">
<RemoveDir Directories="$(BindingResourcePath);" />
</Target>
@ -1680,6 +1715,11 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<!-- Code signing -->
<PropertyGroup>
<_CodesignAppBundleDependsOn>
$(_CodesignAppBundleDependsOn);
_CleanAppBundleRootDirectory;
</_CodesignAppBundleDependsOn>
<CoreCodesignDependsOn>
$(CoreCodesignDependsOn);
_CodesignAppBundle;

Просмотреть файл

@ -101,6 +101,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
<PropertyGroup>
<_CodesignAppBundleDependsOn>
$(_CodesignAppBundleDependsOn);
_EmbedProvisionProfile;
_CodesignNativeLibraries;
_CollectFrameworks;
@ -109,7 +110,6 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
_CodesignAppExtensions;
_PrepareCodesignAppExtension;
_CalculateCodesignAppBundleInputs;
_CleanAppBundleRootDirectory;
</_CodesignAppBundleDependsOn>
<CoreCodesignDependsOn>
@ -623,41 +623,6 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
/>
</Target>
<Target Name="_CleanAppBundleRootDirectory" Condition="'$(_PlatformName)' == 'MacCatalyst' Or '$(_PlatformName)' == 'macOS'">
<!-- 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 -->
<!-- Use a task to collect the files, so that we get the correct behavior on Windows -->
<GetFileSystemEntries
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' And ('$(_PlatformName)' == 'MacCatalyst' Or '$(_PlatformName)' == 'macOS')"
DirectoryPath="$(AppBundleDir)"
Pattern="mono_crash.*"
Recursive="false"
IncludeDirectories="false"
>
<Output TaskParameter="Entries" ItemName="_MonoCrashDumpsInAppBundle" />
</GetFileSystemEntries>
<Delete
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' And ('$(_PlatformName)' == 'MacCatalyst' Or '$(_PlatformName)' == 'macOS')"
Files="@(_MonoCrashDumpsInAppBundle)"
/>
<!-- Warn about any files that are left -->
<GetFileSystemEntries
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' And ('$(_PlatformName)' == 'MacCatalyst' Or '$(_PlatformName)' == 'macOS')"
DirectoryPath="$(AppBundleDir)"
Pattern="*"
Recursive="false"
IncludeDirectories="false"
>
<Output TaskParameter="Entries" ItemName="_FilesInAppBundleRootDirectory" />
</GetFileSystemEntries>
<Warning Text="Found files in the root directory of the app bundle. This will likely cause codesign to fail. Files:%0a@(_FilesInAppBundleRootDirectory, '%0a')" Condition="@(_FilesInAppBundleRootDirectory->Count()) &gt; 0"/>
</Target>
<Target Name="_CoreCreateIpa" Condition="'$(BuildIpa)' == 'true'" DependsOnTargets="Codesign">
<RemoveDir SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Directories="$(DeviceSpecificIntermediateOutputPath)ipa" />