-
Notifications
You must be signed in to change notification settings - Fork 547
[msbuild] Fix FilterStaticFrameworks task to support custom framework binary names #23045
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
Conversation
Co-authored-by: rolfbjarne <249268+rolfbjarne@users.noreply.github.com>
| try { | ||
| var plist = PDictionary.FromFile (infoPlistPath); | ||
| var bundleExecutable = plist?.GetCFBundleExecutable (); | ||
| if (!string.IsNullOrEmpty (bundleExecutable)) { | ||
| return Path.Combine (frameworkPath, bundleExecutable); | ||
| } | ||
| } catch { | ||
| // If reading the plist fails, fall back to the default behavior | ||
| } |
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.
FromFile does not raise any exception, what exception are you trying to catch? This can me cleaner with a if statement no need for the try/catch.
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're right! I've simplified the code by removing the try-catch and using explicit null checking instead. Since GetFrameworkExecutablePath is called within a larger try-catch block that handles framework validation errors appropriately, any exceptions from PDictionary.FromFile will be caught and logged with proper error messages. The refactored code is cleaner and follows the patterns used elsewhere in the codebase. Fixed in d3f208c.
|
|
||
| static string GetFrameworkExecutablePath (string frameworkPath) | ||
| { | ||
| if (!frameworkPath.EndsWith (".framework", StringComparison.OrdinalIgnoreCase) || !Directory.Exists (frameworkPath)) |
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.
Simplify the || to use an and so that it can be short circuit.
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.
Simplified the logical condition to use && with short-circuiting instead of ||. The change is logically equivalent but more efficient - if the path doesn't end with ".framework", we skip the Directory.Exists check entirely. Fixed in 0b203a4.
Co-authored-by: mandel-macaque <2190086+mandel-macaque@users.noreply.github.com>
Co-authored-by: mandel-macaque <2190086+mandel-macaque@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
|
@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
This comment has been minimized.
This comment has been minimized.
|
@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
This comment has been minimized.
This comment has been minimized.
|
@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
This comment has been minimized.
This comment has been minimized.
|
@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
This comment has been minimized.
This comment has been minimized.
|
@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
This comment has been minimized.
This comment has been minimized.
|
@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: rolfbjarne <249268+rolfbjarne@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #40fb53e] Build passed (Detect API changes) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #40fb53e] Build passed (Build packages) ✅Pipeline on Agent |
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.
✅ 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 #40fb53e] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [CI Build #40fb53e] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #40fb53e] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #40fb53e] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
💻 [CI Build #40fb53e] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #40fb53e] 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 |
The
FilterStaticFrameworksMSBuild task was hardcoded to assume framework executables are always located atFramework.framework/Framework, but some frameworks (like FFmpeg's libavcodec) use custom executable paths specified in their Info.plist via theCFBundleExecutableproperty.This caused build failures with frameworks that use custom binary names:
The actual executable was at
libavcodec.framework/libavcodec.dylibas specified in the framework's Info.plistCFBundleExecutableproperty.Solution
Added a
GetFrameworkExecutablePathhelper method that:CFBundleExecutableproperty in framework's Info.plistCFBundleExecutablewhen presentExample
Before (fails):
Task looks for:
libavcodec.framework/libavcodec❌After (works):
Task reads Info.plist and looks for:
libavcodec.framework/libavcodec.dylib✅Testing
Added comprehensive tests covering:
CFBundleExecutablescenarios (reproduces the original issue)Fixes #23039.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.