Skip to content

Commit

Permalink
[release/7.0.3xx] [msbuild] Fix ILStripping of resource assemblies on…
Browse files Browse the repository at this point in the history
… Windows. (#18511)

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 #17009.
Fixes #14841.
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1817898.

Backport of #18508.
  • Loading branch information
rolfbjarne committed Jun 30, 2023
1 parent 663e05a commit 43ae6c7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion msbuild/Xamarin.iOS.Tasks/Tasks/ILStrip.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Build.Tasks;
using Microsoft.Build.Framework;
Expand All @@ -14,7 +15,20 @@ public override bool Execute ()
return base.Execute ();
}

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;

Expand Down

6 comments on commit 43ae6c7

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ API diff for current PR / commit

NET (empty diffs)
  • iOS: (empty diff detected)
  • tvOS: (empty diff detected)
  • MacCatalyst: (empty diff detected)
  • macOS: (empty diff detected)

✅ API diff vs stable

.NET (No breaking changes)

✅ Generator diff

Generator diff is empty

Pipeline on Agent
Hash: 43ae6c749407e47fdf5fa07295119b87f7328ea6 [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💻 [CI Build] Tests on macOS M1 - Mac Ventura (13.0) passed 💻

All tests on macOS M1 - Mac Ventura (13.0) passed.

Pipeline on Agent
Hash: 43ae6c749407e47fdf5fa07295119b87f7328ea6 [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: 43ae6c749407e47fdf5fa07295119b87f7328ea6 [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💻 [CI Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻

All tests on macOS M1 - Mac Big Sur (11.5) passed.

Pipeline on Agent
Hash: 43ae6c749407e47fdf5fa07295119b87f7328ea6 [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📚 [CI Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent XAMMINI-071.Ventura
Hash: 43ae6c749407e47fdf5fa07295119b87f7328ea6 [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 [CI Build] Test results 🚀

Test results

✅ All tests passed on VSTS: simulator tests.

🎉 All 79 tests passed 🎉

Tests counts

⚠️ bcl: No tests selected. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests: All 1 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ framework: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 1 tests passed. Html Report (VSDrops) Download
✅ interdependent_binding_projects: All 4 tests passed. Html Report (VSDrops) Download
⚠️ install_source: No tests selected. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 40 tests passed. Html Report (VSDrops) Download
⚠️ mac_binding_project: No tests selected. Html Report (VSDrops) Download
⚠️ mmp: No tests selected. Html Report (VSDrops) Download
⚠️ mononative: No tests selected. Html Report (VSDrops) Download
✅ monotouch: All 13 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
⚠️ mtouch: No tests selected. Html Report (VSDrops) Download
⚠️ xammac: No tests selected. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 43ae6c749407e47fdf5fa07295119b87f7328ea6 [CI build]

Please sign in to comment.