I'm developing a Cordova plugin for Android that includes custom frameworks, and one of them is only compatible with cordova-android >= 4.0.0.
I know in the plugin.xml file we can target cordova-android specific versions, but that applies on the whole plugin for the platform.
Here is a short version of my 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="com.plugin.MyPlugin" version="1.0">
<name>MyPlugin</name>
<engines>
<engine name="cordova-android" version=">=4.0.0" />
</engines>
<js-module src="www/MyPlugin.js" name="MyPlugin">
<clobbers target="MyPlugin" />
</js-module>
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="MyPlugin">
<param name="android-package" value="com.plugin.MyPlugin" />
</feature>
</config-file>
<source-file src="src/android/MyPlugin.java" target-dir="src/com/plugin/MyPlugin" />
<framework src="path/to/first-framework" custom="true" />
<framework src="path/to/second-framework" custom="true" />
</platform>
</plugin>
Here, framework called "first-framework" works only with cordova-android < 4.0.0, and "second-framework" works only with cordova-android >= 4.0.0.
Basically my goal is to have only one plugin.xml file that declares :
- if cordova-android is < 4.0.0 : use "first-framework"
- else if cordova-android is >= 4.0.0 : use "second-framework"
How could I do this ?
Thanks