Cordova / PhoneGap Android Platform Development Workflow

I am developing a set of Cordoba plugins. The initial implementation will only be Android, so for now I am interested in the possibility of using ADT in Eclipse to develop plugins. I read the documentation and got the first plugin, but the workflow is a bit of a pain. I could not find any documents or tools in Cordoba that specifically support the plugin development workflow. I wonder if I am doing this harder than necessary? That's what I'm doing.

The plugin is configured according to the cordova plugin specification. I started by creating a directory structure and editing files in Sublime, so I have something like:

  • $ PLUGIN_ROOT
    • CSI
      • Android
        • Plugin.java
    • WWW
      • plugin.js
    • plugin.xml

I installed all this with a template and initial implementation. Then, to start testing, I created the cordova project, added the android platform, added my plugin, and built:

cordova create testProject cd testProject cordova platform add android cordova plugin add $PLUGIN_ROOT cordova build cordova run 

After all this, I import testProject / platform / android into ADT and start editing Plugin.java and plugin.js, as well as assets / www, to add a test harness.

Now, after everything works the way I want it, I need to manually copy all the changed files (plus any files that I added) back to the appropriate place under $ PLUGIN_ROOT. I also want to save my test harness, possibly in $ PLUGIN_ROOT / test. This is not so bad the first time, but after a few iterations, things get a little cumbersome. It also seems very error prone to do this manually, but I cannot use the merge tool to do this for me, because the directory structure is different. I could write a script, but then I will add extra overhead. However, I am now planning to write scripts to do this for each of the plugins that I am going to write.

Is there a better way? I'd love to hear how cordova plugin developers do this. Thanks.

+6
source share
1 answer

You need an automatic build tool, for example grunt , which monitors your plugin folder (for example, $ PLUGIN_ROOT) and runs the corresponding cordova commands whenever the file belonging to the plugin changes.

+3
source

Source: https://habr.com/ru/post/958171/


All Articles