[msbuild] Put Info.plist in the Contents/ subdirectory in the app for catalyst apps.

This commit is contained in:
Rolf Bjarne Kvinge 2020-11-18 08:38:01 +01:00
Родитель afb3971f23
Коммит a2af2a1925
6 изменённых файлов: 24 добавлений и 3 удалений

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

@ -17,7 +17,7 @@ namespace Xamarin.Mac.Tasks
var archiveDir = CreateArchiveDirectory ();
try {
var plist = PDictionary.FromFile (Path.Combine (AppBundleDir.ItemSpec, "Contents", "Info.plist"));
var plist = PDictionary.FromFile (PlatformFrameworkHelper.GetAppManifestPath (Platform, AppBundleDir.ItemSpec));
var productsDir = Path.Combine (archiveDir, "Products");
// Archive the Applications...

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

@ -24,6 +24,7 @@
// THE SOFTWARE.
using System;
using System.IO;
using Xamarin.Utils;
@ -91,5 +92,20 @@ namespace Xamarin.MacDev.Tasks
{
return $"-m{GetMinimumVersionOperatingSystem (targetFrameworkMoniker, isSimulator)}-version-min={minimumOSVersion}";
}
public static string GetAppManifestPath (ApplePlatform platform, string appBundlePath)
{
switch (platform) {
case ApplePlatform.iOS:
case ApplePlatform.TVOS:
case ApplePlatform.WatchOS:
return Path.Combine (appBundlePath, "Info.plist");
case ApplePlatform.MacOSX:
case ApplePlatform.MacCatalyst:
return Path.Combine (appBundlePath, "Contents", "Info.plist");
default:
throw new InvalidOperationException ($"Invalid platform: {platform}");
}
}
}
}

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

@ -213,6 +213,8 @@ Copyright (C) 2020 Microsoft. All rights reserved.
<!-- This is the prefix used for embedded resources, both for library projects and binding projects -->
<_EmbeddedResourcePrefix Condition="'$(_PlatformName)' == 'macOS'">xammac</_EmbeddedResourcePrefix>
<_EmbeddedResourcePrefix Condition="'$(_PlatformName)' != 'macOS'">monotouch</_EmbeddedResourcePrefix>
<_AppBundleManifestRelativePath Condition="'$(_PlatformName)' == 'macOS' Or '$(_IsMacCatalyst)' == 'true'">Contents/</_AppBundleManifestRelativePath>
</PropertyGroup>
<PropertyGroup Condition="'$(IsBindingProject)' == 'true'">

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

@ -676,6 +676,9 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<Output TaskParameter="Item" PropertyName="_AppManifest" />
</FindItemWithLogicalName>
<Error Condition="'$(_AppManifest)' == '' And '$(_CanOutputAppBundle)' == 'true'" Text="Info.plist not found."/>
<PropertyGroup>
<_AppBundleManifestPath>$(_AppBundlePath)$(_AppBundleManifestRelativePath)$(_AppManifest)</_AppBundleManifestPath>
</PropertyGroup>
</Target>
<PropertyGroup Condition="'$(IsBindingProject)' == 'true'">

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

@ -279,7 +279,7 @@ namespace Xamarin.iOS.Tasks
public override bool Execute ()
{
var mainInfoPath = Path.Combine (AppBundlePath, "Info.plist");
var mainInfoPath = PlatformFrameworkHelper.GetAppManifestPath (Platform, AppBundlePath);
if (!File.Exists (mainInfoPath)) {
Log.LogError (7040, AppBundlePath, MSBStrings.E7040, AppBundlePath);
return false;

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

@ -384,7 +384,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
<GetNativeExecutableName
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
AppManifest="$(_AppBundlePath)Info.plist"
AppManifest="$(_AppBundlePath)$(_AppBundleManifestRelativePath)Info.plist"
>
<Output TaskParameter="ExecutableName" PropertyName="_ExecutableName" />
</GetNativeExecutableName>