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

jnigen iterative development loop with plugin code is awkward #1660

Open
stuartmorgan opened this issue Oct 15, 2024 · 1 comment
Open

jnigen iterative development loop with plugin code is awkward #1660

stuartmorgan opened this issue Oct 15, 2024 · 1 comment
Assignees

Comments

@stuartmorgan
Copy link

The recommended workflow of building plugin source and then jnigening the resulting output doesn't work very well when iterating on hybrid development (e.g., migrating code from native to Dart). I've hit a variant of this flow quite a few times now:

  1. Try to write some Dart code using my plugin code.
  2. Realize that I can't access SomeJavaClass in Dart because it wasn't marked public (only becomes an issue when trying to call the code from Dart).
  3. Update the Java code.
  4. Try to flutter build the example app so that I can re-run jnigen now that it's public.
  5. Fail to build because of the in-progress code in step 1.

Obviously if I don't save in step 1 I wouldn't have that problem, but I save all the time, including commonly doing save-all when modifying anything, including the changes to the Java code (which I'm making in VS Code as well because they are trivial). I keeping hitting this even though in theory I know better at this point. Then I have to back out or comment our enough code from step 1. to be able to continue.

It would be nice if we could identify a specific command to regenerate just the Java code, so that I could iterate on Java+jnigen runs regardless of the state of my Dart code.

@HosseinYousefi
Copy link
Member

Yes, I have hit the same issue before: #628

I need to make some changes to flutter_tools so that it doesn't compile the Dart code if passed a certain flag. I tried this before but wasn't successful and had to move on to other tasks.

Something hacky that is easy to do:

  1. Create a new temporary flutter project
  2. Copy the android directory to that project
  3. Convert the plugin into an app if not one already or also do 1. and 2. for the example app
  4. Run flutter build apk to cache gradle dependencies
  5. Run jnigen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants