apache / apache/cordova-android

Support Optional Android Dependencies For Plugin controlled via command line inputs

Open
#1,862 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.8k
Forks
1.6k
Avg merge
16h 18m
Merged PRs (30d)
11

Description

# 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

```

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

```

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



$ADD_ANALYTICS_SDK




```

is something like this possible for `plugin.xml` ?

Contributor guide

Open the contributing guide

Research direction

Start by tracing plugin.xml variable handling from the `cordova plugin add` command and reviewing how Android `` entries are processed. Define tests for an input such as `ADD_ANALYTICS_SDK` that includes or omits the optional framework and enforces the requested version constraint; done means installation behaves consistently for both choices.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, javascript
Domain
build-system, cli, mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.