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

Wrapper source code aren't locateable #4

Closed
unsuitable001 opened this issue May 11, 2021 · 5 comments · Fixed by #5
Closed

Wrapper source code aren't locateable #4

unsuitable001 opened this issue May 11, 2021 · 5 comments · Fixed by #5

Comments

@unsuitable001
Copy link
Owner

When I was adding this library to another dart project from local file system, shell scripts and C/C++ source files from the bin folder were also accessible. The moment I switched to git dependency, it stopped working.

Current solution in my head: Use the dart file under bin to download necessary files from the repo and do it's job.

It will be great if there's a way to also include non-dart files in bin folder.

@unsuitable001
Copy link
Owner Author

CC @mannprerak2 @dcharkes

@dcharkes
Copy link

See dart-lang/sdk#36712. In general we don't have a solution for non-Dart source code or compiled binaries in packages yet. I'm working on it.

If you are in Dart standalone mode and running in JIT (dart), and not AOT (dart compile exe) you can find the folder of your source package with: https://api.dart.dev/stable/2.2.0/dart-isolate/Isolate/packageConfig.html

Stay tuned on the SDK issue for a proper solution.

@mannprerak2
Copy link

What if we place the C wrapper source under lib/src/wrapper for now? That's what we did with ffigen when it used a wrapper.

@unsuitable001
Copy link
Owner Author

Files were on lib/src/wrapper previously. Though I'll try again. Locally, the current solution I have works. But, not from git.
I'll also try that tflite package's approach.

Overall, what I've planned is, if this package is added as a dependency, people can run a command (just like ffigen) and that will build the wrapper and copy it to the actual project's root directory. (And, maybe we can also download cronet binaries in the same way)

unsuitable001 added a commit that referenced this issue May 12, 2021
Idea credits: ffigen (commit: ed21cf5392ab9980947d838d0432efa65582f67d), tflite_native
Reference #4
@unsuitable001
Copy link
Owner Author

Issue fixed :). Thank you @mannprerak2 and @dcharkes
Before closing this issue, I'm going to link some resources for future references and others in need.

I got the idea from: https://github.com/dart-lang/ffigen/blob/ed21cf5392ab9980947d838d0432efa65582f67d/lib/src/find_resource.dart

Other critical resources:
https://github.com/dart-archive/tflite_native/tree/master/lib/src
dart-lang/sdk#36712
https://github.com/am15h/tflite_flutter_plugin

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 a pull request may close this issue.

3 participants