Skip to content

Conversation

@rolfbjarne
Copy link
Member

@rolfbjarne rolfbjarne commented Nov 6, 2024

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:

  • Add new metadata to resource items, for the path of the defining project + the path of the main project. This is required to compute the correct virtual project path.
  • Completely rewrite the code to compute virtual project path, prioritizing making the code legible and easy to understand (in particular minimizing differences in code paths between macOS and Windows), and add lots of comments.
  • Add unit tests for computing the virtual project path.
  • Add a new .NET project test for all variations of resources we support.
  • Run said new test on Windows as well, both in remote and local (Hot Restart) mode.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2024

⚠️ Your code has been reformatted. ⚠️

If this is not desired, add the actions-disable-autoformat label, and revert the reformatting commit.

If files unrelated to your change were modified, try reverting the reformatting commit + merging with the target branch (and push those changes).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

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.
@rolfbjarne rolfbjarne force-pushed the dev/rolf/tests-resource-tests-on-windows branch from 5de156d to e70ae8c Compare November 8, 2024 14:08
@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2024

⚠️ Your code has been reformatted. ⚠️

If this is not desired, add the actions-disable-autoformat label, and revert the reformatting commit.

If files unrelated to your change were modified, try reverting the reformatting commit + merging with the target branch (and push those changes).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne marked this pull request as ready for review November 20, 2024 12:03
@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

.NET (No breaking changes)

✅ API diff vs stable

.NET (No breaking changes)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: f083830fcadeb53ae0fc1b6fdb8b9998d9696020 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: f083830fcadeb53ae0fc1b6fdb8b9998d9696020 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: f083830fcadeb53ae0fc1b6fdb8b9998d9696020 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: f083830fcadeb53ae0fc1b6fdb8b9998d9696020 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: f083830fcadeb53ae0fc1b6fdb8b9998d9696020 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [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
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 3 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 6 tests passed. Html Report (VSDrops) Download
✅ linker: All 40 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 10 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (tvOS): All 9 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: f083830fcadeb53ae0fc1b6fdb8b9998d9696020 [PR build]

@emaf
Copy link
Contributor

emaf commented Nov 20, 2024

@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.

@rolfbjarne
Copy link
Member Author

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?

I haven't tested resources from NuGet packages, but I'll test that and see what happens.

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 end up anywhere in the Mac.

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.

@rolfbjarne
Copy link
Member Author

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?

I haven't tested resources from NuGet packages, but I'll test that and see what happens.

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.

@rolfbjarne rolfbjarne merged commit 746f531 into main Nov 22, 2024
@rolfbjarne rolfbjarne deleted the dev/rolf/tests-resource-tests-on-windows branch November 22, 2024 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants