我想为phonegap/cordova开发一个插件。我将在/plugins/中创建一个文件夹
我想从命令行执行:
phonegap build android
或phonegap run android
我想把.java文件从我的插件文件夹复制到/platforms/android/src
大多数插件在安装时都是复制的,但在构建、运行任务时则不然。
你知道把xml文件放在哪里吗?该编辑哪个文件?
编辑:
从这里开始,我似乎需要在某个地方声明/创建一个before_build文件/任务,在哪里?-并且需要执行after_plugin_add在此处呈现的操作
这是安装脚本的来源。
需要在运行/构建时执行的代码部分是:
// 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.');
下面是一个响应,用这些名称描述文件夹结构。