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

feat: add support for releasing and patching macOS apps #2644

Merged
merged 78 commits into from
Dec 16, 2024
Merged

Conversation

bryanoltman
Copy link
Contributor

@bryanoltman bryanoltman commented Nov 26, 2024

Description

Adds shorebird release macos and shorebird patch macos

Remaining work

Note: These should probably be moved to issues, as they aren't prereqs for landing this PR, but for announcing beta mac support.

  • Add beta warning to mac release and patch
  • Add validator for network access in mac app entitlements
  • Preview needs to stream logs
  • Preview should (maybe) open the directory where the app is downloaded for relaunching (tbd if this is the right solution, just trying to find a way to make it easy to view patches in a previewed app)
  • Patch diffing (native and asset change detection)

Fixes #2654

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore
  • 🧪 Tests

Copy link

codecov bot commented Nov 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

Base automatically changed from bo/macos-protocol to main December 2, 2024 15:28
@bryanoltman bryanoltman marked this pull request as ready for review December 11, 2024 22:10
.sorted(
(a, b) => b.statSync().modified.compareTo(a.statSync().modified),
)
.firstWhereOrNull((directory) => directory.path.endsWith('.app'));
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought in the iOS case we'd move to reading the path from the logs? But maybe that was a different kind of path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You might be thinking of the app.dill?

Copy link
Contributor

@eseidel eseidel left a comment

Choose a reason for hiding this comment

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

I left a bunch of nits, none of which need to be addressed.

I do think there is a ton of copy/paste code that we may wish to try and unify more before soon.

});

String get _patchClassTableLinkInfoPath =>
p.join(buildDirectory.path, 'macos', 'shorebird', 'App.ct.link');
Copy link
Contributor

Choose a reason for hiding this comment

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

I probably would have written myself a little _buildPath('macos', 'shorebird','App.ct.link') helper. 🤷

outputDirectory: tempDir,
);
releaseClassTableLinkInfoFile = File(p.join(tempDir.path, 'App.ct.link'));
if (!releaseClassTableLinkInfoFile.existsSync()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I probably would have had an _existsOrExit(file, 'class table link debug info') if I'm doing this more often. 🤷

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm planning to refactor all this and extract the shared logic in a subsequent PR.

'cache',
'artifacts',
'engine',
'darwin-x64-release',
Copy link
Contributor

Choose a reason for hiding this comment

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

We're using the enum to differentiate based on Target, but we may also need to differentiate based on Host

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, we'll probably want to refactor ShorebirdArtifacts to accept host and/or target in the future.

@@ -652,6 +714,7 @@ aar artifact already exists, continuing...''',

final zippedRunner = await Directory(runnerPath).zipToTempFile();
try {
logger.detail('[archive] zipped runner.app to ${zippedRunner.path}');
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want this log? We don't have an equivalent for other platforms so just wondering if this was left in intentionally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't feel strongly. Users will only see it when running with the -v flag, and there's so much other output that I'm not sure it matters much one way or the other.

),
);

Future<_LinkResult> _runLinker({
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably create a Linker class that contains this shared logic instead of duplicating on both iOS and MacOS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I have a TODO earlier in this file on line 33 for the _LinkResult typedef.

@bryanoltman bryanoltman merged commit 8eebf95 into main Dec 16, 2024
12 checks passed
@bryanoltman bryanoltman deleted the bo/macos branch December 16, 2024 19:11
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.

feat: make macOS releases previewable
3 participants