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

fix(shorebird_cli): use aot-tools.dill for linking if available #1596

Merged
merged 7 commits into from
Jan 2, 2024

Conversation

bryanoltman
Copy link
Contributor

@bryanoltman bryanoltman commented Dec 21, 2023

Description

Because the precompiled aot-tools executable will only work on architectures that match the dart executable used to build it, and because we build dart on arm64 macs, the aot-tools executable does not work on x64 macs. This change looks for an aot-tools kernel file (.dill) and uses the dart packaged with shorebird's flutter (which was used to produce the kernel file) to run it.

Fixes #1595

Related to but not dependent on https://github.com/shorebirdtech/_build_engine/pull/56

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

Copy link

codecov bot commented Dec 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (09f21c8) 100.00% compared to head (183384a) 100.00%.

❗ Current head 183384a differs from pull request most recent head adf32e2. Consider uploading reports for the commit adf32e2 to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1596   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          155       155           
  Lines         4828      4829    +1     
=========================================
+ Hits          4828      4829    +1     
Flag Coverage Δ
shorebird_cli 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

packages/shorebird_cli/lib/src/cache.dart Outdated Show resolved Hide resolved
@bryanoltman bryanoltman merged commit 049ac46 into main Jan 2, 2024
6 checks passed
@bryanoltman bryanoltman deleted the bo/aot-tools-kernel branch January 2, 2024 20:48
@@ -198,7 +199,10 @@ class AotToolsArtifact extends CachedArtifact {
String get name => 'aot-tools';
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we rename this to executableName to avoid confusion? I don't think it's obvious what the difference between name and fileName is at first glance.

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 can add some comments. I changed executables to executable (because our artifacts only ever have one file) to fileName (because our artifacts aren't always executable).

@@ -198,7 +199,10 @@ class AotToolsArtifact extends CachedArtifact {
String get name => 'aot-tools';

@override
List<String> get executables => ['aot-tools'];
String get fileName => 'aot-tools.dill';
Copy link
Contributor

Choose a reason for hiding this comment

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

Why couldn't we change name to be aot-tools.dill and avoid introducing a new fileName?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the artifact path is [name]/[fileName] (or, in the case of aot-tools, [name]/[flutterRev]/[fileName]). We could use fileName for both, but this felt cleaner.

return '${cache.storageBaseUrl}/${cache.storageBucket}/shorebird/${shorebirdEnv.shorebirdEngineRevision}/$artifactName';
}
String get storageUrl =>
'${cache.storageBaseUrl}/${cache.storageBucket}/shorebird/${shorebirdEnv.shorebirdEngineRevision}/aot-tools.dill';
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this use fileName instead of the string literal aot-tools.dill?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could ¯_(ツ)_/¯

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.

fix: shorebird doesn't work on mac x64 machines
3 participants