0

I want to develop a plugin for phonegap/cordova. I will create a folder into /plugins/

I want to execute from the command line:

phonegap build android or phonegap run android

I would like to have the .java files copied from my plugin folder to /platforms/android/src

Most of plugins at install time are copyed, but not at build, run tasks.

Any idea where to put an xml file for which or which one to edit?

Edit:

From Here it seems I need a before_build file/task declared / created somewhere, where? - and need to do what after_plugin_add does presented Here

1 Answers1

0

Here is the source of the installation script.

The code part which need to be executed at run / build is :

// queue up native stuff
        sourceFiles && sourceFiles.forEach(function(source) {
            actions.push(actions.createAction(handler["source-file"].install, [source, plugin_dir, project_dir, plugin_id], handler["source-file"].uninstall, [source, project_dir, plugin_id]));
        });

        headerFiles && headerFiles.forEach(function(header) {
            actions.push(actions.createAction(handler["header-file"].install, [header, plugin_dir, project_dir, plugin_id], handler["header-file"].uninstall, [header, project_dir, plugin_id]));
        });

        resourceFiles && resourceFiles.forEach(function(resource) {
            actions.push(actions.createAction(handler["resource-file"].install, [resource, plugin_dir, project_dir], handler["resource-file"].uninstall, [resource, project_dir]));
        });

        libFiles && libFiles.forEach(function(lib) {
            actions.push(actions.createAction(handler["lib-file"].install, [lib, plugin_dir, project_dir], handler["lib-file"].uninstall, [lib, project_dir]));
        });




// run through the action stack
actions.process(platform, project_dir, function(err) {
    if (err) {
        if (callback) callback(err);
        else throw err;
    } else {

        // queue up the plugin so prepare knows what to do.
        config_changes.add_installed_plugin_to_prepare_queue(plugins_dir, plugin_basename, platform, filtered_variables, is_top_level);
        // call prepare after a successful install
        require('./../plugman').prepare(project_dir, platform, plugins_dir);

        require('../plugman').emit('results', plugin_id + ' installed.');

Here is a response which describe the folder structure with those names.

Community
  • 1
  • 1