-
Notifications
You must be signed in to change notification settings - Fork 510
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
Add support for bundling original assets in library projects #19028
Milestone
Comments
rolfbjarne
added a commit
to rolfbjarne/xamarin-macios
that referenced
this issue
May 3, 2024
…ixes xamarin#19028. If a library references resources, until now we've pre-compile/pre-processed some of those before embedding them the library. This applies to resources of the following item groups: * AtlasTexture * BundleResource * Collada * CoreMLModel * ImageAsset * InterfaceDefinition * SceneKitAsset However, pre-processing resources as a few problems: * It requires a native (Xcode) toolchain. * This is unfortunate when building from Windows: the current approach is that when building a library as a referenced project, the remoting part is skipped, so all such resources are just dropped. * It also means building on Linux doesn't work. * It makes it impossible to merge resources with the same name, if we wanted to do that. So I'm adding support for bundling the original resources in library projects. This is enabled using the MSBuild property `BundleOriginalResources=true`, which is turned off by default for .NET 8 and turned on by default for .NET 9. Additionally I've added logic to detect conflicting resources when they come from multiple sources. Fixes xamarin#19028.
rolfbjarne
added a commit
to rolfbjarne/xamarin-macios
that referenced
this issue
May 3, 2024
…ixes xamarin#19028. If a library references resources, until now we've pre-compile/pre-processed some of those before embedding them the library. This applies to resources of the following item groups: * AtlasTexture * BundleResource * Collada * CoreMLModel * ImageAsset * InterfaceDefinition * SceneKitAsset However, pre-processing resources as a few problems: * It requires a native (Xcode) toolchain. * This is unfortunate when building from Windows: the current approach is that when building a library as a referenced project, the remoting part is skipped, so all such resources are just dropped. * It also means building on Linux doesn't work. * It makes it impossible to merge resources with the same name, if we wanted to do that. So I'm adding support for bundling the original resources in library projects. This is enabled using the MSBuild property `BundleOriginalResources=true`, which is turned off by default for .NET 8 and turned on by default for .NET 9. Fixes xamarin#19028.
rolfbjarne
added a commit
that referenced
this issue
Jul 5, 2024
…ixes #19028. If a library references resources, until now we've pre-compile/pre-processed some of those before embedding them the library. This applies to resources of the following item groups: * AtlasTexture * BundleResource * Collada * CoreMLModel * ImageAsset * InterfaceDefinition * SceneKitAsset However, pre-processing resources as a few problems: * It requires a native (Xcode) toolchain. * This is unfortunate when building from Windows: the current approach is that when building a library as a referenced project, the remoting part is skipped, so all such resources are just dropped. * It also means building on Linux doesn't work. * It makes it impossible to merge resources with the same name, if we wanted to do that. So I'm adding support for bundling the original resources in library projects. This is enabled using the MSBuild property `BundleOriginalResources=true`, which is turned off by default for .NET 8 and turned on by default for .NET 9. Fixes #19028.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Library projects can have various types of bundle resources (storyboards, xibs, property lists, png images, CoreML models, texture atlases, etc - the
_BundleResourceWithLogicalName
item group), and they're bundled into the compiled library as embedded resources (using a prefix, like__monotouch_content_
) - in thePackLibraryResources
task.If any processing can be done (such as compiling storyboards or xibs, or optimizing property lists/png images, etc), it's done before embedding, but this complicates library builds a lot, because they:
The last part is important because of conflicting resources (#5755) - if the executable app ends up with multiple xcassets with the same name from multiple library projects (or a library project and the executable project), it's impossible to merge them post-compilation (while it could be done if we had access to all the original resources when compiling the executable project).
So the suggestion would be to add support for bundling original assets in libraries, by adding a new MSBuild property
BundleOriginalLibraryAssets
, and make the default valuetrue
.Unfortunately there may have been a reason it was done this way originally, but that potential reason has been lost in history. This means that we must support opting out of this behavior for a while.
Advantages:
The text was updated successfully, but these errors were encountered: