[msbuild] Compute _AppContainerDir from AppBundleDir if AppBundleDir is set by the developer. Fixes #15014. (#15869)

Fixes https://github.com/xamarin/xamarin-macios/issues/15014.
This commit is contained in:
Rolf Bjarne Kvinge 2022-09-07 11:33:39 +02:00 коммит произвёл GitHub
Родитель 2415050767
Коммит 62bc02760a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 17 добавлений и 0 удалений

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

@ -2684,6 +2684,9 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<_AppContainerDir Condition="'$(IsAppDistribution)' == 'true'">$(ArchivePath)\Products\Applications\</_AppContainerDir> <_AppContainerDir Condition="'$(IsAppDistribution)' == 'true'">$(ArchivePath)\Products\Applications\</_AppContainerDir>
<AppBundleDir>$(_AppContainerDir)$(_AppBundleName)$(AppBundleExtension)</AppBundleDir> <AppBundleDir>$(_AppContainerDir)$(_AppBundleName)$(AppBundleExtension)</AppBundleDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(_AppContainerDir)' == ''">
<_AppContainerDir>$([System.IO.Path]::GetDirectoryName($(AppBundleDir)))/</_AppContainerDir>
</PropertyGroup>
<PropertyGroup> <PropertyGroup>
<!-- Ensure _AppBundlePath is a relative path (relative to the project directory) and contains a trailing slash --> <!-- Ensure _AppBundlePath is a relative path (relative to the project directory) and contains a trailing slash -->
<_AppBundlePath>$(AppBundleDir)</_AppBundlePath> <_AppBundlePath>$(AppBundleDir)</_AppBundlePath>

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

@ -982,5 +982,19 @@ namespace Xamarin.Tests {
Assert.That (errors [0].Message, Does.Contain ("Error loading Entitlements.plist template 'Entitlements.plist'"), "Message"); Assert.That (errors [0].Message, Does.Contain ("Error loading Entitlements.plist template 'Entitlements.plist'"), "Message");
} }
} }
[TestCase (ApplePlatform.MacOSX, "osx-arm64")]
public void CustomAppBundleDir (ApplePlatform platform, string runtimeIdentifiers)
{
var project = "MySimpleApp";
Configuration.IgnoreIfIgnoredPlatform (platform);
var project_path = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out var appPath);
Clean (project_path);
var properties = GetDefaultProperties (runtimeIdentifiers);
var customAppBundleDir = Path.Combine (Cache.CreateTemporaryDirectory (), project + ".app");
properties ["AppBundleDir"] = customAppBundleDir;
var result = DotNet.AssertBuild (project_path, properties);
}
} }
} }