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

Duplication dart class in Mac OS product app #176

Closed
loongliu opened this issue Dec 18, 2018 · 7 comments
Closed

Duplication dart class in Mac OS product app #176

loongliu opened this issue Dec 18, 2018 · 7 comments

Comments

@loongliu
Copy link

setup the engine development environment according this

I changed some code both embedder.c and flutter/lib/ui/*.dart in flutter engine, add some instance variable to dart class.

build and copy the FlutterEmbedder.framework to desired location: flutter_engine_framework/macos/FlutterEmbedder.framework (in the original build pipeline, FlutterEmbedder.framework is downloaded from network)

Then change some code in flutter/flutter, this code depends on the dart code change in engine.

Build the macos example project with Debug configuration. Run the result Example Embedder.app.

I found both my dart code changes in engine and flutter/flutter works (two logs both printed). But the code in flutter/flutter does not find the instance variable previously added to flutter/lib/ui/*.dart.
And Application crashed.

After some debug, I found flutter/lib/ui/*.dart class is duplicated in product app.

There are two files in app folder (Right click Example Embedder.app and click Show Package Contents):

  1. Contents/Resources/flutter_assets/vm_snapshot_data
  2. Contents/Frameworks/FlutterEmbedderMac.framework/Versions/A/Frameworks/FlutterEmbedder.framework/Versions/Current/FlutterEmbedder.

file 1: app build result by flutter build bundle
file 2: engine build result by ninja -C

Check the file contents by Mac command line strings /path/to/file1or2 > output1or2.txt

Search for flutter/lib/ui/ in these generated output.txt, you can find flutter/lib/ui/*.dart class in both files.

Is anything wrong with my build settings?

@stuartmorgan
Copy link
Collaborator

Did you follow the instructions here?

(Issue #160 is about making what you are trying to do easier to set up.)

@stuartmorgan
Copy link
Collaborator

I'm a little confused as to why you've inlined build_flutter_assets into Xcode rather than modifying the script in place, but I'm not seeing any obvious issues with what you've posted. Other than deleting .../flutter_engine_framework/macos/FlutterEmbedder.framework and .../flutter_app/build just to make sure nothing is stale, I don't have any immediate suggestions. And maybe delete flutter/bin/cache as I think I saw a case where the previously-downloaded cache of sky_engine was being used instead of the new engine version (but I can't find where I encountered that, so may be misremembering).

If you provide the hashes for your Flutter tree and Flutter engine tree I can test a local engine override with the same versions to see if I can reproduce your issue with that version.

@krisgiesing
Copy link
Contributor

Did you pass --local-engine-src-path when running flutter build bundle? My understanding is that that's required when using a local engine build. I can see that might cause you to wind up with an extra copy in the built bundle.

@stuartmorgan
Copy link
Collaborator

The script in the first screenshot is (a slightly modified version of) the script I linked to above that passes that flag, showing the relevant lines uncommented.

@krisgiesing
Copy link
Contributor

You're right, apologies for missing that.

@loongliu
Copy link
Author

loongliu commented Dec 19, 2018

I'm a little confused as to why you've inlined build_flutter_assets into Xcode rather than modifying the script in place.
If you provide the hashes for your Flutter tree and Flutter engine tree I can test a local engine override with the same versions to see if I can reproduce your issue with that version.

Inline script is easier to modify in Xcode environment, since I don't need Linux built product.

flutter commit SHA : 0f10d3f992410a712af77a1d82ebe32aeeb4ef1c
engine commit SHA: 0e9ad4341695b8825ba90c60ce980f363ceb6c53

Notice that I do commit some changes locally base on posted SHA. so current SHA locally is not same as posted. However my commit should not change the build pipeline

@loongliu
Copy link
Author

After remove flutter/bin/cache, compile error fixed and app works fine.

So no block for my work. Close this issue for this moment.

When more time is available, I will do more check about whether dart class is duplicated.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants