Fix bgen CLI command for macos net6 TFM (#13572)

If you try and run bgen with a target framework of `'.NETCoreApp,Version=v6.0,Profile=macos'`, you will get a cryptic error.

```
drasticactions@DrasticnoMacBook-Pro % /usr/local/share/dotnet/packs/Microsoft.macOS.Sdk/12.0.101-preview.12.551/tools/bin/bgen --target-framework=.NETCoreApp,Version=v6.0,Profile=macos
error BI1053: bgen: Internal error: unknown target framework '.NETCoreApp,Version=v6.0,Profile=macos'.
```

If you give bgen an invalid framework, it will list this TFM as support, so it should work. The reason it doesn't is because of a missing `if` clause in the CLI. If you don't add a `baselibdll`, the code falls through to where it will always throw on this TFM. We should be able to do the same thing that's being done for the other net6 TFMs and add it to the list here. Now, it should work without needing to add the BaseLib location.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
This commit is contained in:
Tim Miller 2022-01-25 09:21:53 -05:00 коммит произвёл GitHub
Родитель 7a40f26320
Коммит 1e8c9e840c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 5 добавлений и 0 удалений

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

@ -100,6 +100,9 @@ public class BindingTouch : IDisposable {
if (!string.IsNullOrEmpty (attributedll))
return attributedll!;
if (IsDotNet)
return Path.Combine (GetSDKRoot (), "lib", "Xamarin.Apple.BindingAttributes.dll");
switch (CurrentPlatform) {
case PlatformName.iOS:
return Path.Combine (GetSDKRoot (), "lib", "bgen", "Xamarin.iOS.BindingAttributes.dll");
@ -371,6 +374,8 @@ public class BindingTouch : IDisposable {
baselibdll = Path.Combine (GetSDKRoot (), "lib", "reference", "mobile", "Xamarin.Mac.dll");
else if (target_framework == TargetFramework.Xamarin_Mac_4_5_Full || target_framework == TargetFramework.Xamarin_Mac_4_5_System)
baselibdll = Path.Combine (GetSDKRoot (), "lib", "reference", "full", "Xamarin.Mac.dll");
else if (target_framework == TargetFramework.DotNet_5_0_macOS)
baselibdll = Path.Combine (GetSDKRoot (), "lib", "mono", "Xamarin.Mac", "Xamarin.Mac.dll");
else
throw ErrorHelper.CreateError (1053, target_framework);
}