Philipp Kursawe created CB-12594:
------------------------------------
Summary: Local development of plugins with variables need
variables in fetch.json
Key: CB-12594
URL: https://issues.apache.org/jira/browse/CB-12594
Project: Apache Cordova
Issue Type: Bug
Components: Android, CLI, iOS, Plugins
Reporter: Philipp Kursawe
Consider a plugin that defined a preference in its plugin.xml
When you use the CLI feature to save plugins into config.xml and also add the
variables for this plugin, the CLI complains when adding the plugin during
platform restore (missing variables):
{code:title=plugin.xml}
<?xml version="1.0" encoding="UTF-8"?>
<plugin
xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin" version="1.0">
<preference name="COMPANY_NAME" />
{code}
{code:title=config.xml}
<plugin name="cordova-plugin" spec="cordova-plugin-insert-io">
<variable name="COMPANY_NAME" value="acme" />
{code}
When removing a platform and re-adding it this is the result:
{code}
Installing "cordova-plugin" for android
Failed to install 'cordova-plugin':Error: Variable(s) missing: COMPANY_NAME
at
/Users/xxx/.nvm/versions/node/v6.2.0/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:362:23
at _fulfilled
(/Users/xxx/.nvm/versions/node/v6.2.0/lib/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done
(/Users/xxx/.nvm/versions/node/v6.2.0/lib/node_modules/cordova/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch
(/Users/xxx/.nvm/versions/node/v6.2.0/lib/node_modules/cordova/node_modules/q/q.js:749:13)
at
/Users/xxx/.nvm/versions/node/v6.2.0/lib/node_modules/cordova/node_modules/q/q.js:557:44
at flush
(/Users/xxx/.nvm/versions/node/v6.2.0/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
Error: Variable(s) missing: INSERT_COMPANY_NAME
{code}
It seems, the CLI checks the fetch.json file, and if that does not contain the
variables, it fails with this error. Manually adding the variables to the
fetch.json file, or re-installing the plugin helps (reinstalling rewrites the
fetch.json file).
That means, if we add a variable to our plugin during plugin development, we
would have to remove the plugin (unlink) it first, and then re-add it,
specifying all the variables at the CLI.
How it should actually work is that config.xml has precedence over whatever it
says in fetch.json. Or get rid of fetch.json alltogether. I think its only
there for historical reasons?
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]