-
Notifications
You must be signed in to change notification settings - Fork 565
[net11.0] Support multiple R2R images for ios/tvos apps #25077
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
Merged
rolfbjarne
merged 34 commits into
net11.0
from
dev/rolf/dev/jekoritz/r2r-multiple-images
Apr 29, 2026
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
af34218
[R2R] Support multiple R2R modules with per-module frameworks
jkoritzinsky f2445b2
Add FrameworkName metadata for R2R post-processing
rolfbjarne 1e817d0
Update sizes
rolfbjarne a926910
Merge remote-tracking branch 'origin/net11.0' into dev/rolf/dev/jekor…
rolfbjarne df29933
[tests] Update expected sizes.
rolfbjarne 955b20c
Address PR feedback: remove fallback, fix incremental builds, add val…
jkoritzinsky 8cea1fd
Fix build failure and update expected sizes
jkoritzinsky 96ec7b6
Use full dylib filename as R2R module name
jkoritzinsky a1aec4b
Update expected sizes
jkoritzinsky 550f56d
Support Windows remote builds for R2R module registration
jkoritzinsky 8fc736e
Merge remote-tracking branch 'origin/net11.0' into dev/rolf/dev/jekor…
rolfbjarne 73c7a3d
Resolve R2R targets merge conflict
rolfbjarne 8b222e9
[tests] Update expected sizes.
rolfbjarne db90212
Use R2RHeaderSymbolName instead of linker symbol aliasing
jkoritzinsky a62bf08
Merge remote-tracking branch 'origin/net11.0' into dev/rolf/dev/jekor…
rolfbjarne ed732d1
[tests] Update expected sizes.
rolfbjarne 0450239
[dotnet] Fix R2R Mac Catalyst app builds
rolfbjarne 0e10198
A few fixes for RTR header name.
rolfbjarne 9868393
fix
rolfbjarne 9f0ea22
[tests] Update expected sizes.
rolfbjarne f489474
Skip a few more targets in the outer build for universal apps.
rolfbjarne f814e36
Fix R2R symbol name mismatch and BundleStructureTest for multi-module…
jkoritzinsky 9abe44a
Fix NullReferenceException in multi-RID macOS R2R builds
jkoritzinsky c8c5538
Fix R2R SanitizedName derivation to use .o filename instead of .dylib…
jkoritzinsky a3bd22b
[tests] Update expected sizes.
rolfbjarne d241823
Merge remote-tracking branch 'origin/net11.0' into dev/rolf/dev/jekor…
rolfbjarne 75ad348
[tests] Update expected sizes.
rolfbjarne 221afe7
Remove dependency that's causing a dependency loop
jkoritzinsky 9730de3
Fix R2R target cycle and improve incrementality
jkoritzinsky db1ee7f
[tests] Update expected sizes.
rolfbjarne 3a66d43
[tests] Update LinkedWithNativeLibraries expected frameworks for Core…
rolfbjarne 0ece463
[tests] Update expected sizes for CoreCLR-R2R.
jkoritzinsky 408c113
[tests] Update expected sizes.
rolfbjarne 68c2767
Merge remote-tracking branch 'origin/net11.0' into dev/rolf/dev/jekor…
rolfbjarne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateR2RModuleRegistration.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| using System.IO; | ||
| using System.Linq; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| using Microsoft.Build.Framework; | ||
| using Microsoft.Build.Utilities; | ||
|
|
||
| using Xamarin.Messaging.Build.Client; | ||
|
|
||
| #nullable enable | ||
|
|
||
| namespace Xamarin.MacDev.Tasks { | ||
| public class GenerateR2RModuleRegistration : XamarinTask, ITaskCallback { | ||
|
|
||
| #region Inputs | ||
| [Required] | ||
| public ITaskItem [] R2RModules { get; set; } = []; | ||
|
|
||
| [Required] | ||
| public string OutputFile { get; set; } = ""; | ||
| #endregion | ||
|
|
||
| public override bool Execute () | ||
| { | ||
| if (ShouldExecuteRemotely ()) | ||
| return ExecuteRemotely (); | ||
|
|
||
| var sb = new StringBuilder (); | ||
|
|
||
| sb.AppendLine ("#include \"xamarin/xamarin.h\""); | ||
| sb.AppendLine (); | ||
|
|
||
| foreach (var module in R2RModules) { | ||
| var symbolName = module.GetMetadata ("SymbolName"); | ||
| if (string.IsNullOrEmpty (symbolName)) { | ||
| Log.LogError ("Missing '{0}' metadata on item '{1}'.", "SymbolName", module.ItemSpec); | ||
| continue; | ||
| } | ||
| sb.AppendLine ($"extern void* {symbolName};"); | ||
| } | ||
|
|
||
| sb.AppendLine (); | ||
| sb.AppendLine ("static struct xamarin_r2r_module r2r_module_entries [] = {"); | ||
|
|
||
| foreach (var module in R2RModules) { | ||
| var moduleName = module.GetMetadata ("ModuleName"); | ||
| var symbolName = module.GetMetadata ("SymbolName"); | ||
| if (string.IsNullOrEmpty (moduleName)) { | ||
| Log.LogError ("Missing '{0}' metadata on item '{1}'.", "ModuleName", module.ItemSpec); | ||
| continue; | ||
| } | ||
| if (string.IsNullOrEmpty (symbolName)) | ||
| continue; // already reported above | ||
| var escapedModuleName = moduleName.Replace ("\\", "\\\\").Replace ("\"", "\\\""); | ||
| sb.AppendLine ($"\t{{ \"{escapedModuleName}\", &{symbolName} }},"); | ||
| } | ||
|
|
||
| sb.AppendLine ("};"); | ||
| sb.AppendLine (); | ||
|
|
||
| sb.AppendLine ("__attribute__ ((constructor))"); | ||
| sb.AppendLine ("static void xamarin_register_r2r_modules ()"); | ||
| sb.AppendLine ("{"); | ||
| sb.AppendLine ("\txamarin_r2r_modules = r2r_module_entries;"); | ||
| sb.AppendLine ("\txamarin_r2r_module_count = sizeof (r2r_module_entries) / sizeof (r2r_module_entries [0]);"); | ||
| sb.AppendLine ("}"); | ||
|
|
||
| if (Log.HasLoggedErrors) | ||
| return false; | ||
|
|
||
| var content = sb.ToString (); | ||
| var outputDir = Path.GetDirectoryName (OutputFile); | ||
| if (!string.IsNullOrEmpty (outputDir)) | ||
| Directory.CreateDirectory (outputDir); | ||
|
|
||
| if (!File.Exists (OutputFile) || File.ReadAllText (OutputFile) != content) | ||
| File.WriteAllText (OutputFile, content); | ||
|
|
||
| return !Log.HasLoggedErrors; | ||
| } | ||
|
|
||
| public bool ShouldCopyToBuildServer (ITaskItem item) => false; | ||
|
|
||
| public bool ShouldCreateOutputFile (ITaskItem item) => true; | ||
|
|
||
| public IEnumerable<ITaskItem> GetAdditionalItemsToBeCopied () => Enumerable.Empty<ITaskItem> (); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
tests/dotnet/UnitTests/expected/MacCatalyst-CoreCLR-Interpreter-size.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
tests/dotnet/UnitTests/expected/MacCatalyst-MonoVM-interpreter-size.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| AppBundleSize: 2,815,241 bytes (2,749.3 KB = 2.7 MB) | ||
| AppBundleSize: 2,815,261 bytes (2,749.3 KB = 2.7 MB) | ||
| # The following list of files and their sizes is just informational / for review, and isn't used in the test: | ||
| Contents/_CodeSignature/CodeResources: 2,358 bytes (2.3 KB = 0.0 MB) | ||
| Contents/Info.plist: 1,099 bytes (1.1 KB = 0.0 MB) | ||
| Contents/Info.plist: 1,119 bytes (1.1 KB = 0.0 MB) | ||
| Contents/MacOS/SizeTestApp: 2,809,968 bytes (2,744.1 KB = 2.7 MB) | ||
| Contents/MonoBundle/runtimeconfig.bin: 1,808 bytes (1.8 KB = 0.0 MB) | ||
| Contents/PkgInfo: 8 bytes (0.0 KB = 0.0 MB) |
6 changes: 3 additions & 3 deletions
6
tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
tests/dotnet/UnitTests/expected/TVOS-CoreCLR-Interpreter-size.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.