You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "root-ansh (via GitHub)" <gi...@apache.org> on 2025/11/03 15:47:57 UTC

[I] Support Optional Android Dependencies For Plugin controlled via command line inputs [cordova-android]

root-ansh opened a new issue, #1862:
URL: https://github.com/apache/cordova-android/issues/1862

   # 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:
   ```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 : 
   
   ```xml
   <framework src="com.google.firebase:firebase-messaging:$FIREBASE_MESSAGING_VERSION" />
   ```
   
   what we need is 
   1. to restrict user to use versions above `21.0.0` (which i think will be covered in next point)
   2. 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 : 
   ```xml
   <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` ?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org