-
Notifications
You must be signed in to change notification settings - Fork 543
[msbuild] Add validation for conflicting resources. Fixes #19029. #22996
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
[msbuild] Add validation for conflicting resources. Fixes #19029. #22996
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
7360f12
to
777706c
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
777706c
to
e824020
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving since I'm not going to block for the use of Count, I trust your call in that regard.
// More than one item per LogicalName is not good at all. | ||
var notBundledInAssembly = group.Where (item => string.IsNullOrEmpty (item.GetMetadata ("BundledInAssembly"))); | ||
var bundledInAssembly = group.Where (item => !string.IsNullOrEmpty (item.GetMetadata ("BundledInAssembly"))); | ||
if (notBundledInAssembly.Count () == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are using Count several times in the IEnumerable, that means that the notBundledInAssembly is being iterated several times. Why not do a ToArray and then use Length? Otherwise in the worst case scenario we are iterating over the collection 3 times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements enhanced duplicate resource detection by adding new validation logic and warnings when conflicting resources are encountered. Key changes include:
- Updating MSBuild tasks (e.g. TextureAtlas, IBTool, ScnTool, CoreMLCompiler, CompileSceneKitAssets, ACTool, and CollectBundleResources) to compute logical names and detect duplicates.
- Enhancing project configurations and test setups for different platforms (macOS, iOS, MacCatalyst) to incorporate the new validation.
- Adding new methods and error/warning messages in common utilities and localization resource files.
Reviewed Changes
Copilot reviewed 20 out of 89 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/dotnet/AppWithDuplicatedResources/shared.csproj | Added resource item groups with duplicate resource conditions. |
tests/dotnet/AppWithDuplicatedResources/macOS/.csproj, iOS/.csproj, MacCatalyst/*.csproj | Updated project files to import shared settings. |
tests/common/DotNet.cs | Updated AssertBuild signature with an extra ‘target’ parameter. |
tests/common/Configuration.cs | Introduced GetAllRuntimeIdentifiers for runtime identifier aggregation. |
msbuild/Xamarin.Shared/Xamarin.Shared.targets | Removed an obsolete TODO comment regarding duplicate items. |
msbuild/Xamarin.MacDev.Tasks/Tasks/* | Modified various tasks to incorporate duplicate resource detection and proper logical naming. |
msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx | Added new error and warning messages related to resource duplicate conflicts. |
Comments suppressed due to low confidence (1)
tests/common/DotNet.cs:66
- Consider updating the method documentation for 'AssertBuild' to describe the new 'target' parameter and its intended usage.
public static ExecutionResult AssertBuild (string project, Dictionary<string, string>? properties = null, string? target = null, TimeSpan? timeout = null)
…-if-duplicate-bundle-resources
✅ [CI Build #120071c] Build passed (Build packages) ✅Pipeline on Agent |
✅ [PR Build #120071c] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ API diff for current PR / commit.NET ( No breaking changes )✅ API diff vs stable.NET ( No breaking changes )ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
✅ [CI Build #120071c] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [CI Build #120071c] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #120071c] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #120071c] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
💻 [CI Build #120071c] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
🚀 [CI Build #120071c] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 115 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Add validation for conflicting resources, showing a warning if the same
resource is found from multiple sources.
Fixes #19029.