cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Grebnov (Akvelon)" <v-seg...@microsoft.com>
Subject Plugman engine check and WP7/8
Date Wed, 23 Oct 2013 13:56:04 GMT
Hi,

#1 The problem
Right now the simplest (and also the most correct IMO) way to specify plugin restrictions
to specific cordova version is the following:

plugin.xml:

 <engines>
   <engine name="cordova" version=">=2.7.0" />
 </engines>

But in this case as per plugman engines definition (plugman/src/util/default-engines.js) plugman
will always try to find version verification script in some predefined location, not taking
into account currently running platform, and will fail on WP since correct script name is
version.bat, not just version.

module.exports = function(project_dir){
    return {
        'cordova': 
            { 'platform':'*', 'scriptSrc': path.join(project_dir,'cordova','version') }, <-
works in general, but NOT for WP7/8 
	 ...
        'cordova-wp8': 
            { 'platform':'wp8', 'scriptSrc': path.join(project_dir,'cordova','version.bat')
}, <- correct location, not used in case of example above


This means that right now there is no way to specify platform dependent location of version
verification script for 'cordova' engine check which  is going to be the most popular. 

#2 Proposed solution

Taking into account we have platform context when we are looking for the appropriate engine

plugman/src/install.js
	function getEngines(pluginElement, platform, project_dir, plugin_dir){

I propose to think about 'cordova' engine settings (in default-engines.js) as a fallback in
case we don't have any platform specific engine for some platform. So in case of  engine.attrib["name"]
== 'cordova' we should check if there is engine with ['cordova-' + platform] name first and
if it does not exist use 'cordova' engine settings only.  For example we already do this by
the following line, but we need both engines (cordova and cordova-wp8) specified in plugin.xml
file. Thoughts? 

// make sure we check for platform req's and not just cordova reqs
    if(cordovaEngineIndex && cordovaPlatformEngineIndex) uncheckedEngines.pop(cordovaEngineIndex);

PS. Another minor potential issue seems to be in check above; cordovaEngineIndex &&
cordovaPlatformEngineIndex will return false if one of indexes is zero (zero is valid/correct
index in this context so it must be true).

Thx!
Sergey

Mime
View raw message