[msbuild] Fix ILStripping of resource assemblies on Windows. (#18508)

Any assembly that's not already on the Mac must be copied there, so do that.
We detect if an assembly exist on the Mac by checking the file size of the
file on Windows: a 0-length file is an output file from an assembly that exist
on the Mac, otherwise it doesn't and must be copied.

Fixes https://github.com/xamarin/xamarin-macios/issues/17009.
Fixes https://github.com/xamarin/xamarin-macios/issues/14841.
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1817898.
This commit is contained in:
Rolf Bjarne Kvinge 2023-06-29 11:04:42 +02:00 коммит произвёл GitHub
Родитель 64b4a5909a
Коммит c7fa7ab52e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 14 добавлений и 1 удалений

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

@ -38,7 +38,20 @@ namespace Xamarin.MacDev.Tasks {
return result;
}
public bool ShouldCopyToBuildServer (ITaskItem item) => false;
public bool ShouldCopyToBuildServer (ITaskItem item)
{
// Some assemblies are already on the Mac, and we have a 0-length
// output file on Windows. We don't want to copy these files.
// However, some assemblies have to be copied, because they don't
// already exist on the Mac (typically resource assemblies). So
// filter to assemblies with a non-zero length.
var finfo = new FileInfo (item.ItemSpec);
if (!finfo.Exists || finfo.Length == 0)
return false;
return true;
}
public bool ShouldCreateOutputFile (ITaskItem item) => true;