Skip to content
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/tests/dotnet] Add support for xcframeworks for Hot Restart and add tests. Fixes #16571. #18103

Merged
merged 19 commits into from May 3, 2023

Conversation

rolfbjarne
Copy link
Member

@rolfbjarne rolfbjarne commented Apr 20, 2023

Rework Hot Restart builds to use as much as possible of the normal build
logic, because this is the easiest way to make sure the Hot Restart build is
as close as possible to normal builds (and we don't end up missing features).

This is done by executing selected parts of a normal build, and at the end we
have a new task that computes where each file goes in the various output
directories Hot Restart uses (HotRestartAppBundlePath, HotRestartContentDir,
HotRestartAppContentDir, etc.)

This PR also:

  • Adds a test that runs on Windows and verifies that everything consumed in a
    build is placed in the correct location for a Hot Restart build (this is a
    variation of the BundleStructure test we already have).
  • Removes tasks that aren't used anymore.
  • Misc fixes to make sure existing code works on Windows.

This PR is best reviewed commit-by-commit.

Ref: #13924

…e as well.

It's much easier to set an environment variable on Windows than it is to change the
test configuration, which is Makefile-based.
Rework Hot Restart builds to use as much as possible of the normal build logic, because
this is the easiest way to make sure the Hot Restart build is as close as possible
to normal builds (and we don't end up missing features).

This is done by executing selected parts of a normal build, and a the end we have
a new task that computes where each file goes in the various output directories Hot
Restart uses (HotRestartAppBundlePath, HotRestartContentDir, HotRestartAppContentDir,
etc.)
…several places.

Set/fix the PublishFolderType and RelativePath metata for returned items in the ComputeBundleLocation
and ResolveNativeReferences task, so that the new ComputeHotRestartBundleContents
task has enough (and the correct) information to do the right thing with items that
are to be copied to the app bundle.
This makes sure we find files in subdirectories too.
Make the CompileAppManifest task work on Windows by:

* Not requiring the default SDK version (impossible to calculate without Xcode)
  as an input property (we still require it when it's needed).
* Not requiring the SDK version (also impossible to calculate without Xcode).
* Using the minimum OS version we support as the as minimum OS version the app
  supports if building on Windows and an SDK version has not been provided.
* Not adding any of the app manifest values we get from Xcode.
…or hot restart.

And then adjust the resulting app manifest for hot restart in the
CompileHotRestartAppManifest target.

This makes sure we handle app manifests for hot restart builds just like we do
for normal builds.
* Take the BundleIdentifier we computed in the CompileAppManifest as input.
* This means we don't need to read the app manifest anymore, which means all the
  corresponding code can be removed.
The output of codesigning is the _CodeSignature\CodeResources file, so use
that as the sentinel file to determine if the code signature is up-to-date or
not.

Using the individual files in the app bundle doesn't work, because they will
always have an up-to-date filestamp (since they were just copied to the app
bundle).
…rget.

The output is the compiled Entitlements.plist file and
'archived-expanded-entitlements.xcent', not the Extracted sentinel file (which
is created when the prebuilt app bundle is unzipped).
…pressed.

1. Compute the path of the zip in the .props file, and use it as Inputs for
   the PrepareAppBundle target. This way we only run PrepareAppBundle if the
   zip file has changed (and we actually run it if it has changed).
2. Delete any previous unzipped contents if we're unzipping (to make sure we
   don't have files leftover from an earlier version of the prebuilt zip).
3. Compute the 'HotRestartAppBundlePath' in a new and earlier task. This means
   we can also depend on this targe in the _CleanHotRestartBundle target to
   avoid having to compute the 'HotRestartAppBundlePath' property there as
   well.
4. Move the touching of the stamp file (the 'Extracted' file) to MSBuild. This
   way it shows up in logs.
5. Enable nullability in the PrepareAppBundle target and fix any issues.
@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
Copy link
Collaborator

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: 312076a28cf5005eb8bfae8415a76a20b247eed0 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

📚 [PR Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent XAMMINI-014.Ventura
Hash: 312076a28cf5005eb8bfae8415a76a20b247eed0 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

Legacy Xamarin (No breaking changes)
  • iOS (no change detected)
  • tvOS (no change detected)
  • watchOS (no change detected)
  • macOS (no change detected)
NET (empty diffs)
  • iOS: (empty diff detected)
  • tvOS: (empty diff detected)
  • MacCatalyst: (empty diff detected)
  • macOS: (empty diff detected)

✅ API diff vs stable

Legacy Xamarin (No breaking changes)
.NET (No breaking changes)
Legacy Xamarin (stable) vs .NET

✅ Generator diff

Generator diff is empty

Pipeline on Agent
Hash: 312076a28cf5005eb8bfae8415a76a20b247eed0 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻

All tests on macOS M1 - Mac Big Sur (11.5) passed.

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Ventura (13.0) passed 💻

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

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build] Test results 🚀

Test results

✅ All tests passed on VSTS: simulator tests.

🎉 All 225 tests passed 🎉

Tests counts

✅ bcl: All 69 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests: All 1 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 7 tests passed. Html Report (VSDrops) Download
✅ framework: All 8 tests passed. Html Report (VSDrops) Download
✅ generator: All 2 tests passed. Html Report (VSDrops) Download
✅ interdependent_binding_projects: All 7 tests passed. Html Report (VSDrops) Download
✅ install_source: All 1 tests passed. Html Report (VSDrops) Download
✅ introspection: All 8 tests passed. Html Report (VSDrops) Download
✅ linker: All 65 tests passed. Html Report (VSDrops) Download
✅ mac_binding_project: All 1 tests passed. Html Report (VSDrops) Download
✅ mmp: All 2 tests passed. Html Report (VSDrops) Download
✅ mononative: All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch: All 25 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ mtouch: All 1 tests passed. Html Report (VSDrops) Download
✅ xammac: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 8 tests passed. Html Report (VSDrops) Download
✅ xtro: All 2 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 312076a28cf5005eb8bfae8415a76a20b247eed0 [PR build]

@rolfbjarne rolfbjarne changed the title [msbuild/tests/dotnet] Add support for xcframeworks for Hot Restart and add tests [msbuild/tests/dotnet] Add support for xcframeworks for Hot Restart and add tests. Fixes #16571. Apr 24, 2023
@rolfbjarne rolfbjarne merged commit 6e7128b into xamarin:main May 3, 2023
89 checks passed
@rolfbjarne rolfbjarne deleted the tests-windows branch May 3, 2023 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment