[msbuild] Augment the ResolveNativeReferences task to accept and understand *.xcframework paths.

Previously we'd only support passing in a fake reference to a file inside the *.xcframework.

This makes some other code simpler later on.

Best viewed by ignoring whitespace, since this is mostly whitespace changes.
This commit is contained in:
Rolf Bjarne Kvinge 2021-12-13 21:46:52 +01:00
Родитель 55f11650b3
Коммит 09fc600d0d
1 изменённых файлов: 16 добавлений и 14 удалений

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

@ -64,24 +64,26 @@ namespace Xamarin.MacDev.Tasks {
foreach (var nr in NativeReferences) {
var name = nr.ItemSpec;
switch (Path.GetExtension (name)) {
// '.' is used to represent a file (instead of the directory)
// '.' can be used to represent a file (instead of the directory)
case "":
name = Path.GetDirectoryName (name);
if (Path.GetExtension (name) == ".xcframework") {
var resolved = ResolveXCFramework (name);
if (resolved == null)
return false;
var t = new TaskItem (resolved);
t.SetMetadata ("Kind", "Framework");
t.SetMetadata ("Name", resolved);
if (Path.GetExtension (name) == ".xcframework")
goto case ".xcframework";
break;
case ".xcframework":
var resolved = ResolveXCFramework (name);
if (resolved == null)
return false;
var t = new TaskItem (resolved);
t.SetMetadata ("Kind", "Framework");
t.SetMetadata ("Name", resolved);
// add some metadata from the original item
var addToAppBundle = nr.GetMetadata ("AddToAppBundle");
if (!string.IsNullOrEmpty (addToAppBundle))
t.SetMetadata ("AddToAppBundle", addToAppBundle);
// add some metadata from the original item
var addToAppBundle = nr.GetMetadata ("AddToAppBundle");
if (!string.IsNullOrEmpty (addToAppBundle))
t.SetMetadata ("AddToAppBundle", addToAppBundle);
native_frameworks.Add (t);
}
native_frameworks.Add (t);
break;
case ".framework":
native_frameworks.Add (nr);