Skip to content

Commit

Permalink
[tools] Don't detect/resolve binding resource packages in mtouch/mmp/…
Browse files Browse the repository at this point in the history
…dotnet-linker. Fixes xamarin#19378.

We currently detect/resolve binding resource packages (the sidecar) in two places:

* The ResolveNativeReferences MSBuild task.
* Inside mtouch/mmp/dotnet-linker.

Which means we end up passing every native library or framework twice to the native linker.

This is usually not a problem, the native linker will ignore duplicated
arguments, except when building remotely from Windows, in which case the build
process may end up with native libraries in different locations, because files
may end up in multiple places on the remote Mac if using absolute paths (see
xamarin#18997 for a thorough explanation).

So completely remove the logic to detect/resolve binding resource packages in
mtouch/mmp/dotnet-linker, which will avoid the issue completely.

Fixes xamarin#19378.
  • Loading branch information
rolfbjarne authored and vs-mobiletools-engineering-service2 committed Nov 16, 2023
1 parent bef62e1 commit 4d595ea
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions tools/common/Assembly.cs
Expand Up @@ -157,44 +157,6 @@ public void ExtractNativeLinkInfo ()
if (!assembly.HasCustomAttributes)
return;

string resourceBundlePath = Path.ChangeExtension (FullPath, ".resources");
if (!Directory.Exists (resourceBundlePath)) {
var zipPath = resourceBundlePath + ".zip";
if (File.Exists (zipPath)) {
var path = Path.Combine (App.Cache.Location, Path.GetFileName (resourceBundlePath));
if (Driver.RunCommand ("/usr/bin/unzip", "-u", "-o", "-d", path, zipPath) != 0)
throw ErrorHelper.CreateError (1306, Errors.MX1306 /* Could not decompress the file '{0}'. Please review the build log for more information from the native 'unzip' command. */, zipPath);
resourceBundlePath = path;
}
}
string manifestPath = Path.Combine (resourceBundlePath, "manifest");
if (File.Exists (manifestPath)) {
foreach (NativeReferenceMetadata metadata in ReadManifest (manifestPath)) {
LogNativeReference (metadata);
ProcessNativeReferenceOptions (metadata);

switch (Path.GetExtension (metadata.LibraryName).ToLowerInvariant ()) {
case ".framework":
AssertiOSVersionSupportsUserFrameworks (metadata.LibraryName);
Frameworks.Add (metadata.LibraryName);
#if MMP // HACK - MMP currently doesn't respect Frameworks on non-App - https://github.com/xamarin/xamarin-macios/issues/5203
App.Frameworks.Add (metadata.LibraryName);
#endif
break;
case ".xcframework":
// this is resolved, at msbuild time, into a framework
// but we must ignore it here (can't be the `default` case)
break;
default:
#if MMP // HACK - MMP currently doesn't respect LinkWith - https://github.com/xamarin/xamarin-macios/issues/5203
Driver.native_references.Add (metadata.LibraryName);
#endif
LinkWith.Add (metadata.LibraryName);
break;
}
}
}

ProcessLinkWithAttributes (assembly);

// Make sure there are no duplicates between frameworks and weak frameworks.
Expand Down

0 comments on commit 4d595ea

Please sign in to comment.