-
Notifications
You must be signed in to change notification settings - Fork 555
[msbuild] Fix some issues with various types of resources when building from Windows. #21586
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
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.
This way we treat collada assets like any other compilable asset/resource.
…rce.GetLogicalName.
* Completely rework the code to make it more readable add lots of comments explaining
what it's doing.
* Fix some issues on Windows: for each item whose virtual project path or logical
name we want to compute, we need to know the path to the MSBuild file that defined
the item in question ('DefiningProjectFullPath'), as well as the path to the project
file ('MSBuildProjectFullPath'). Unfortunately, when executing remotely, these
values are not the original values, which means we need to store them as additional
metadata ('LocalDefiningProjectFullPath' and 'LocalMSBuildProjectFullPath', respectively)
in our MSBuild logic, so that we can access them in the task. Do this by adding
a new target ("_SetResourceMetadata") that sets these new metadata.
* Add lots of comments explaining what the code does, since it's not the first
time we've tinkered with these functions. Also add tests to make sure we don't regress.
* Add optional tracing to ease future debugging.
* Enable nullability and fix any issues.
5de156d to
e70ae8c
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.
…ce-tests-on-windows
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.
✅ 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] Windows Integration Tests passed 💻✅ All Windows Integration Tests passed. Pipeline on Agent |
💻 [CI Build] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 109 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
|
@rolfbjarne the changes look good. When building remotely and you have files that are outside of the project directory (like NuGet packages), are those still copied into project's directory in the Mac side? In general, the problem with files that are not inside the project dir on the Windows side, is that we should not copy those to the Mac outside of the projects dir because those files could ed up anywhere in the Mac. |
I haven't tested resources from NuGet packages, but I'll test that and see what happens.
Yes, that's one of the problems I noticed when I wrote this test: resource files ended up outside the project directory in the Mac. |
Everything I tried ended up copying files from NuGets into the project directory on the Mac (or failing to build before that point), so this looks good. |
While adding a test for a new feature, it turned out that the new test uncovered existing bugs. So here I'm adding that new test, and fixing those bugs.
The main part is that computing the virtual project path for resource items on Windows wasn't correct, in particular when referencing resources outside the current project directory. The existing code didn't even have enough information to compute the correct values...
Sidenote: the virtual project path is used to decide where in an app bundle a particular resource should go.
So: