Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0.1xx] [msbuild] Copy the entire frameworks to the Mac when building remotely in the ResolveNativeReferences task. Fixes #19173. #19234

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[msbuild] Copy the entire frameworks to the Mac when building remotel…
…y in the ResolveNativeReferences task. Fixes #19173.

Fixes #19173.
  • Loading branch information
rolfbjarne authored and vs-mobiletools-engineering-service2 committed Oct 17, 2023
commit a199cfb0fb0c4ab944dff2d7e03fbaddf92acfac
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ public bool ShouldCreateOutputFile (ITaskItem item)
return false;
}

public IEnumerable<ITaskItem> GetAdditionalItemsToBeCopied () => Enumerable.Empty<ITaskItem> ();
public IEnumerable<ITaskItem> GetAdditionalItemsToBeCopied ()
{
return CreateItemsForAllFilesRecursively (NativeReferences);
}
}
}
22 changes: 22 additions & 0 deletions msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

using Microsoft.Build.Framework;
using Microsoft.Build.Tasks;
Expand Down Expand Up @@ -217,5 +219,25 @@ protected string GetNonEmptyStringOrFallback (ITaskItem item, string metadataNam
foundInMetadata = false;
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));
}
}
}
Loading