我想为phonegap / cordova开发一个插件。 我将在/ plugins /
中创建一个文件夹我想从命令行执行:
phonegap build android
或phonegap run android
我想将.java文件从我的插件文件夹复制到/ platforms / android / src
安装时的大多数插件都是复制的,但不是编译,运行任务。
知道在哪里放一个xml文件要编辑哪个或哪个?
编辑:
从Here来看,似乎我需要在某处声明/创建 before_build 文件/任务,在哪里? - 并且需要做 after_plugin_add 提交的内容Here
答案 0 :(得分:0)
Here是安装脚本的来源。
需要在run / build执行的代码部分是:
// 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是一个响应,用于描述具有这些名称的文件夹结构。