[msbuild] Copy the entire frameworks to the Mac when building remotely in the ResolveNativeReferences task. Fixes #19173. (#19227)

Fixes https://github.com/xamarin/xamarin-macios/issues/19173.
This commit is contained in:
Rolf Bjarne Kvinge 2023-10-17 17:33:59 +02:00 коммит произвёл GitHub
Родитель b73cb11dc1
Коммит fbe5fdd1ea
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 26 добавлений и 1 удалений

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

@ -524,6 +524,9 @@ namespace Xamarin.MacDev.Tasks {
return false; return false;
} }
public IEnumerable<ITaskItem> GetAdditionalItemsToBeCopied () => Enumerable.Empty<ITaskItem> (); public IEnumerable<ITaskItem> GetAdditionalItemsToBeCopied ()
{
return CreateItemsForAllFilesRecursively (NativeReferences);
}
} }
} }

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

@ -1,5 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Build.Framework; using Microsoft.Build.Framework;
using Microsoft.Build.Tasks; using Microsoft.Build.Tasks;
@ -217,5 +219,25 @@ namespace Xamarin.MacDev.Tasks {
foundInMetadata = false; foundInMetadata = false;
return fallbackValue; return fallbackValue;
} }
protected IEnumerable<ITaskItem> CreateItemsForAllFilesRecursively (IEnumerable<string>? directories)
{
if (directories is null)
yield break;
foreach (var dir in directories) {
// Don't try to find files if we don't have a directory in the first place (or it doesn't exist).
if (!Directory.Exists (dir))
continue;
foreach (var file in Directory.EnumerateFiles (dir, "*", SearchOption.AllDirectories))
yield return new TaskItem (file);
}
}
protected IEnumerable<ITaskItem> CreateItemsForAllFilesRecursively (IEnumerable<ITaskItem>? directories)
{
return CreateItemsForAllFilesRecursively (directories?.Select (v => v.ItemSpec));
}
} }
} }