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] Improve logic to clean up app bundle for unwanted files. #15080

Merged

Conversation

rolfbjarne
Copy link
Member

The current directory at launch is the root directory of the app bundle. This
means that any files written to the current directory when an app is executed,
will be placed there. This becomes a problem when the app is rebuilt (and
resigned), because a valid macOS app bundle doesn't have any files in the root
directory of the app bundle, so signing fails.

We have logic to automatically crash crash reports from the app bundle, but it
turns out this is a more common problem with other types of files (and
folders), so improve the logic a bit:

  • Add support for setting a property to automatically clean up everything from
    an app bundle we don't think should be there (which is anything not in a
    Contents/ subdirectory).
  • Use the same property to add support for disabling any cleaning (we already
    clean mono's crash reports by default).
  • Improve detection of unwanted files to include directories inside the app
    bundle, not only files.

Ref: dotnet/maui#7353

The current directory at launch is the root directory of the app bundle. This
means that any files written to the current directory when an app is executed,
will be placed there. This becomes a problem when the app is rebuilt (and
resigned), because a valid macOS app bundle doesn't have any files in the root
directory of the app bundle, so signing fails.

We have logic to automatically crash crash reports from the app bundle, but it
turns out this is a more common problem with other types of files (and
folders), so improve the logic a bit:

* Add support for setting a property to automatically clean up everything from
  an app bundle we don't think should be there (which is anything not in a
  Contents/ subdirectory).
* Use the same property to add support for disabling any cleaning (we already
  clean mono's crash reports by default).
* Improve detection of unwanted files to include directories inside the app
  bundle, not only files.

Ref: dotnet/maui#7353
@rolfbjarne rolfbjarne added the bug If an issue is a bug or a pull request a bug fix label May 20, 2022
@chamons chamons changed the title [msbuild] Improve logic ot clean up app bundle for unwanted files. [msbuild] Improve logic to clean up app bundle for unwanted files. May 20, 2022
Copy link
Contributor

@chamons chamons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ the test.

@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 was marked as outdated.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

📚 [PR Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent XAMBOT-1109.Monterey
Hash: 7862c9231cd47401f46c62870fb92a0adf19a829

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS Mac Catalina (10.15) passed 💻

All tests on macOS Mac Catalina (10.15) passed.

Pipeline on Agent
Hash: 7862c9231cd47401f46c62870fb92a0adf19a829

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) failed ❌

Failed tests are:

  • xammac_tests
  • monotouch-test

Pipeline on Agent
Hash: 7862c9231cd47401f46c62870fb92a0adf19a829

@vs-mobiletools-engineering-service2
Copy link
Collaborator

📋 [PR Build] API Diff 📋

API diff (for current PR)

ℹ️ API Diff (from PR only) (please review changes)

API diff: vsdrops gist

Xamarin
.NET
Xamarin vs .NET
iOS vs Mac Catalyst (.NET)

API diff (vs stable)

✅ API Diff from stable

API diff: vsdrops gist

Xamarin
.NET
Xamarin vs .NET
iOS vs Mac Catalyst (.NET)

Generator diff

Generator Diff (no change)

Pipeline on Agent XAMBOT-1105.Monterey'
Hash: 7862c9231cd47401f46c62870fb92a0adf19a829

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build] Tests passed on VSTS: simulator tests iOS. ✅

Tests passed on VSTS: simulator tests iOS.

🎉 All 58 tests passed 🎉

Pipeline on Agent XAMBOT-1030.Monterey'
Merge 7862c92 into 91b4d15

@rolfbjarne rolfbjarne merged commit cf7c6b5 into xamarin:main May 30, 2022
@rolfbjarne rolfbjarne deleted the improve-automatic-app-bundle-cleanup branch May 30, 2022 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug If an issue is a bug or a pull request a bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants