Skip to content

Conversation

@dcharkes
Copy link
Contributor

@dcharkes dcharkes commented Jan 3, 2024

Packages the native assets for iOS and MacOS in frameworks.

Issue:

Details

  • This packages dylibs from the native assets feature in frameworks. It packages every dylib in a separate framework.
  • The dylib name is updated to use @rpath instead of @executable_path.
  • The dylibs for flutter-tester are no longer modified to change the install name. (Previously it was wrongly updating the install name to the location the dylib would have once deployed in an app.)
  • Use symlinking on MacOS.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@github-actions github-actions bot added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. a: desktop Running on desktop labels Jan 3, 2024
@dcharkes dcharkes requested review from jmagman and vashworth January 3, 2024 19:59
@dcharkes dcharkes force-pushed the native-assets-frameworks branch from e204e61 to d7e14f9 Compare January 4, 2024 12:29
@gspencergoog gspencergoog requested a review from cbracken January 4, 2024 19:15
@dcharkes
Copy link
Contributor Author

dcharkes commented Jan 8, 2024

@jmagman @vashworth Friendly ping!

return asset.copyWith(path: AssetAbsolutePath(Uri(path: fileName)));
final String name =
fileName.replaceFirst('lib', '').replaceFirst('.dylib', '');
return asset.copyWith(
Copy link
Contributor

Choose a reason for hiding this comment

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

Are all absolute asset paths guaranteed to start with lib?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, are other path types guaranteed to be the correct name?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment, explaining why this is needed?

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've moved it to a separate function and added the comments there.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's still unclear to me why only AssetAbsolutePath need to have the name parsed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The other 3 types do not reflect path types in the destination app:

  • Executable: symbol is available in the current executable (will be used once we have static linking)
  • Process: symbol is available in the current process (current executable or a dylib already loaded)
  • System: symbol is available in the system include path (e.g. win32 dlls on Windows)

All these 3 path types are untreated by the Flutter tools. Whatever build.dart outputs will be put 1 on 1 into the native assets mapping.
The paths are untreated, because there are no files being treated.

For absolute asset paths, the files are being treated by Flutter, we lipo them, put them in a .framework and resign them.

@dcharkes
Copy link
Contributor Author

@jmagman @vashworth Friendly ping!

Copy link
Contributor

@vashworth vashworth left a comment

Choose a reason for hiding this comment

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

LGTM

@dcharkes
Copy link
Contributor Author

Friendly ping @jmagman.

Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

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

Apologies for the delay on this.
@dcharkes can you point me to an example of how to generate these frameworks? I try it out and see if the bundle format looks correct with a manual test.

@dcharkes
Copy link
Contributor Author

Apologies for the delay on this. @dcharkes can you point me to an example of how to generate these frameworks? I try it out and see if the bundle format looks correct with a manual test.

You can run test/integration.shard/native_assets_test.dart locally and stop it from deleting the temp folders.
Or you can do the steps manually, flutter create --template=package_ffi --target=macos,ios and use flutter build macos.

@dcharkes dcharkes requested a review from jmagman January 19, 2024 16:25
Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for tackling all this!

@dcharkes dcharkes added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 19, 2024
@dcharkes
Copy link
Contributor Author

LGTM, thanks for tackling all this!

You're welcome! And thanks for pointing me in the right direction!

Thanks @SKKbySSK for reporting the problem!

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jan 19, 2024
@auto-submit
Copy link
Contributor

auto-submit bot commented Jan 19, 2024

auto label is removed for flutter/flutter/140907, due to - The status or check suite Mac tool_integration_tests_4_4 has failed. Please fix the issues identified (or deflake) before re-applying this label.

@jmagman
Copy link
Member

jmagman commented Jan 19, 2024

Not sure about that overall_experience_test failure, I filed #141892 to investigate. Re-running.

@dcharkes dcharkes added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 19, 2024
@auto-submit auto-submit bot merged commit 2e229be into master Jan 19, 2024
@auto-submit auto-submit bot deleted the native-assets-frameworks branch January 19, 2024 20:29
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 19, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jan 19, 2024
Manual roll Flutter from f77f824 to 684247a (39 revisions)

Manual roll requested by [email protected]

flutter/flutter@f77f824...684247a

2024-01-19 [email protected] Use Integer instead of int in map in flutter.groovy  (flutter/flutter#141895)
2024-01-19 [email protected] Roll Flutter Engine from c953c83112ba to f2b441a26416 (4 revisions) (flutter/flutter#141894)
2024-01-19 [email protected] Native assets: package in framework on iOS and MacOS (flutter/flutter#140907)
2024-01-19 [email protected] Revert "Make tests more resilient to Skia gold failures and refactor flutter_goldens for extensive technical debt removal (#140101)" (flutter/flutter#141814)
2024-01-19 [email protected] Roll Flutter Engine from 538975f2511b to c953c83112ba (3 revisions) (flutter/flutter#141886)
2024-01-19 [email protected] Add `showDragHandle` to `showBottomSheet` (flutter/flutter#141754)
2024-01-19 [email protected] Roll Flutter Engine from 9a6c64de8a46 to 538975f2511b (8 revisions) (flutter/flutter#141881)
2024-01-19 [email protected] Make pumpWidget's arguments named (flutter/flutter#141728)
2024-01-19 [email protected] Tiny fix inaccurate documentations about bindings (flutter/flutter#140282)
2024-01-19 [email protected] Roll engine to 9a6c64de8a4694cef59a338cd33ac1a9e7d23d9d (flutter/flutter#141870)
2024-01-19 [email protected] Roll Packages from 83c2c4d to 129e08c (13 revisions) (flutter/flutter#141865)
2024-01-19 [email protected] Add mac_x64_ios configuration. (flutter/flutter#141828)
2024-01-19 [email protected] Roll Flutter Engine from 90be25d8aac3 to d1afda52d254 (1 revision) (flutter/flutter#141825)
2024-01-19 [email protected] Move the requestKeyboard up to the widgets layer (flutter/flutter#141655)
2024-01-19 [email protected] Roll Flutter Engine from dde3ebf6551a to 90be25d8aac3 (1 revision) (flutter/flutter#141817)
2024-01-18 [email protected] enable more tests in web mode (flutter/flutter#141791)
2024-01-18 [email protected] Roll Flutter Engine from 9dded186bcff to dde3ebf6551a (2 revisions) (flutter/flutter#141811)
2024-01-18 [email protected] Update margin between label and icon in Tab to better reflect Material specs (flutter/flutter#140698)
2024-01-18 [email protected] Roll Flutter Engine from 3106e08e1219 to 9dded186bcff (2 revisions) (flutter/flutter#141807)
2024-01-18 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Enable native compilation for windows-arm64 " (flutter/flutter#141809)
2024-01-18 [email protected] Run framework_tests_misc in arm64 and x64. (flutter/flutter#141797)
2024-01-18 [email protected] Roll Flutter Engine from f4a4f046b173 to 3106e08e1219 (1 revision) (flutter/flutter#141802)
2024-01-18 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 4.1.0 to 4.2.0 (flutter/flutter#141803)
2024-01-18 [email protected] Update labeler.yml (flutter/flutter#141697)
2024-01-18 [email protected] Roll Flutter Engine from 75400c49fa0b to f4a4f046b173 (2 revisions) (flutter/flutter#141800)
2024-01-18 [email protected] Reland "Remove hack from PageView." (flutter/flutter#141533)
2024-01-18 [email protected] ScaleGestureRecognizer pointerCount=2 for trackpad gestures (flutter/flutter#140745)
2024-01-18 [email protected] Roll Flutter Engine from de68e7612948 to 75400c49fa0b (2 revisions) (flutter/flutter#141796)
2024-01-18 [email protected] Run `flutter_gallery_ios__start_up` test on Mac-14 in staging (flutter/flutter#141795)
2024-01-18 [email protected] Roll Flutter Engine from d80fe1cb5854 to de68e7612948 (1 revision) (flutter/flutter#141789)
2024-01-18 [email protected] Enable native compilation for windows-arm64  (flutter/flutter#137618)
2024-01-18 [email protected] [github actions] Fix token issue on actions/checkout package (flutter/flutter#141652)
2024-01-18 [email protected] Roll Flutter Engine from b75d6d80d813 to d80fe1cb5854 (2 revisions) (flutter/flutter#141785)
2024-01-18 [email protected] Revert "Native assets: roll deps" (flutter/flutter#141748)
2024-01-18 [email protected] Deprecate M2 curves (flutter/flutter#134417)
2024-01-18 [email protected] Fix: TextField can inherit `errorStyle` from `InputDecorationTheme`. (flutter/flutter#141227)
2024-01-18 [email protected] Add check for Bank of Brazil security module to Windows Flutter Doctor validators (flutter/flutter#141135)
2024-01-18 [email protected] Fix gradle lints No semantic change should be present. (flutter/flutter#141692)
2024-01-18 [email protected] Roll Packages from 1a2b780 to 83c2c4d (5 revisions) (flutter/flutter#141778)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
...
@SKKbySSK
Copy link

@dcharkes
I've confirmed that the framework was built as expected on the latest master.
Thanks for handling the issue!

@dcharkes
Copy link
Contributor Author

@dcharkes I've confirmed that the framework was built as expected on the latest master. Thanks for handling the issue!

Thanks for double checking! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop autosubmit Merge PR when tree becomes green via auto submit App platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants