From bf0267e16ee4bc456bdbd743d3be5e7304a2b309 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Tue, 9 Dec 2025 18:33:41 +0100 Subject: [PATCH] [dotnet] Prevent bundling/linking with libclrjit.dylib for CoreCLR on Apple mobile platforms. --- dotnet/targets/Xamarin.Shared.Sdk.targets | 21 +++++++++++++++++++ tests/dotnet/UnitTests/AppSizeTest.cs | 8 +++---- .../expected/iOS-CoreCLR-Interpreter-size.txt | 7 +++---- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index c13312d5986d..c0e454decf27 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -1258,6 +1258,14 @@ '%(ResolvedFileToPublish.NuGetPackageId)' == '$(_MonoNugetPackageId)' " /> + + <_MonoLibrary + Remove="@(_MonoLibrary)" + Condition=" '$(_XamarinRuntime)' == 'CoreCLR' And + '$(_PlatformName)' != 'macOS' And + '%(Filename)' == 'libclrjit' + " + /> @@ -2107,6 +2115,19 @@ + + + v); foreach (var key in allKeys) { if (!expectedLines.TryGetValue (key, out var expectedLine)) { - Console.WriteLine ($" File '{key}' was removed from app bundle: {actualLines [key]}"); - Assert.Fail ($"The file '{key}' was removed from the app bundle."); - } else if (!actualLines.TryGetValue (key, out var actualLine)) { - Console.WriteLine ($" File '{key}' was added to app bundle: {expectedLine}"); + Console.WriteLine ($" File '{key}' was added to app bundle: {actualLines [key]}"); Assert.Fail ($"The file '{key}' was added to the app bundle."); + } else if (!actualLines.TryGetValue (key, out var actualLine)) { + Console.WriteLine ($" File '{key}' was removed from app bundle: {expectedLine}"); + Assert.Fail ($"The file '{key}' was removed from the app bundle."); } else if (expectedLine != actualLine) { Console.WriteLine ($" File '{key}' changed in app bundle:"); Console.WriteLine ($" -{expectedLine}"); diff --git a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt index 153b739ec288..cc20f60d63d3 100644 --- a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt @@ -1,9 +1,8 @@ -AppBundleSize: 227,599,825 bytes (222,265.5 KB = 217.1 MB) +AppBundleSize: 224,442,526 bytes (219,182.2 KB = 214.0 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: -_CodeSignature/CodeResources: 47,045 bytes (45.9 KB = 0.0 MB) +_CodeSignature/CodeResources: 46,829 bytes (45.7 KB = 0.0 MB) archived-expanded-entitlements.xcent: 384 bytes (0.4 KB = 0.0 MB) -Info.plist: 1,147 bytes (1.1 KB = 0.0 MB) -libclrjit.dylib: 3,157,072 bytes (3,083.1 KB = 3.0 MB) +Info.plist: 1,136 bytes (1.1 KB = 0.0 MB) libcoreclr.dylib: 6,692,608 bytes (6,535.8 KB = 6.4 MB) libmscordaccore.dylib: 2,386,528 bytes (2,330.6 KB = 2.3 MB) libmscordbi.dylib: 1,852,576 bytes (1,809.2 KB = 1.8 MB)