Support Optional Android Dependencies For Plugin controlled via command line inputs
Opened this issue · 0 comments
root-ansh commented
Feature Request
Support Optional Android Dependencies For Plugin controlled via command line inputs
Motivation Behind Feature
This will allow us to develop cordova plugins that depend on multiple optional libraries. in android we can develop 2 separate libraries a
& b
, where a
can check whether the user has included b
library, and if so, can change its working accordingly.
Feature Description
in cordova, if i have defined the following preference in my plugin.xml:
<preference name="FIREBASE_MESSAGING_VERSION" default="21.0.0"/>
then the users of my plugin can pass this variable while adding the plugin as :
cordova plugin add https://github.com/root-ansh/my-plugin --variable FIREBASE_MESSAGING_VERSION="20.4.0"
furthermore, in my plugin.xml , i am able to use this version as :
<framework src="com.google.firebase:firebase-messaging:$FIREBASE_MESSAGING_VERSION" />
what we need is
- to restrict user to use versions above
21.0.0
(which i think will be covered in next point) - to have 'optional' depenedencies . like if i take a boolean variable
ADD_ANALYTICS_SDK
as input during plugin installation, then i should be able to add an additional , optional framework, something like this :
<rule>
<if>
<conditions>
<condition var="ADD_ANALYTICS_SDK" >$ADD_ANALYTICS_SDK</condition>
</conditions>
<statements>
<framework src="com.google.firebase:firebase-analytics:21.0.0" />
</statements>
</if>
</rule>
is something like this possible for plugin.xml
?