cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tim...@apache.org
Subject [1/2] git commit: [CB-4036] - first pass for adding version script
Date Thu, 25 Jul 2013 22:22:42 GMT
Updated Branches:
  refs/heads/version_engine_checks [created] 413c025c8


[CB-4036] - first pass for adding version script


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/b04fdc44
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/b04fdc44
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/b04fdc44

Branch: refs/heads/version_engine_checks
Commit: b04fdc44998ce2bb7acc8dcfc1d6b6b7bfd6fd62
Parents: 4cf0243
Author: Tim Kim <timk@adobe.com>
Authored: Thu Jul 25 14:56:23 2013 -0700
Committer: Tim Kim <timk@adobe.com>
Committed: Thu Jul 25 14:56:23 2013 -0700

----------------------------------------------------------------------
 spec/plugins/EnginePlugin/plugin.xml | 10 +++++++---
 src/install.js                       | 29 +++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/b04fdc44/spec/plugins/EnginePlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/EnginePlugin/plugin.xml b/spec/plugins/EnginePlugin/plugin.xml
index 62233e3..c29bb8c 100644
--- a/spec/plugins/EnginePlugin/plugin.xml
+++ b/spec/plugins/EnginePlugin/plugin.xml
@@ -23,8 +23,12 @@
 
     <name>Engine Choo Choo</name>
 
-    <engines>
-        <engine name="cordova" version=">=2.3.0" />
-    </engines>
+
+    
     
+    <platform name="android" min-sdk-version="1.0.1" min-os-version="9.2.1" />
+    <platform name="blackberry10" min-sdk-version="0.0.1" min-os-version="0.0.1" />
+    <platform name="ios" min-sdk-version="5.1" min-os-version="10.1" />
+    <platform name="wp7" min-sdk-version="0.0.1"/>
+    <platform name="wp8"  min-os-version="0.0.1"/>
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/b04fdc44/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 5b818ab..79482ba 100644
--- a/src/install.js
+++ b/src/install.js
@@ -130,6 +130,35 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir,
opt
         require('../plugman').emit('log', 'Cordova project version not detected (lacks a
./cordova/version script), continuing.');
     }
 
+    // check platform requirements - min sdks/min os version etc
+    var platformMinReqScript = { code: 0, output: { min_os_version: "5.0.0" , min_sdk_version:
"1.0.0" } }; // place holder for now until we have an actual script    
+    if(platformMinReqScript.code === 0){
+        var platformMinOS = plugin_et.findall('./platform[@name="'+platform+'"][@min-os-version]')[0].attrib["min-os-version"];
+        var platformMinSDK = plugin_et.findall('./platform[@name="'+platform+'"][@min-sdk-version]')[0].attrib["min-sdk-version"];
   
+
+        if( platformMinReqScript.output.min_os_version ) {
+            if(semver.satisfies(platformMinReqScript.output.min_os_version, platformMinOS)){
+                // min-os version ok
+            } else {
+                var err = new Error('Plugin doesn\'t support ' + platform + '  minimum os
version.  ' + platform + '  minimum os version: ' + platformMinReqScript.output.min_os_version
+ ', failed version requirement: ' + platformMinOS);
+                if (callback) return callback(err);
+                else throw err;
+            }            
+        }
+
+        if(platformMinReqScript.output.min_sdk_version) {
+            if(semver.satisfies(platformMinReqScript.output.min_sdk_version, platformMinSDK)){
+                // min-sdk version ok
+            } else {
+                var err = new Error('Plugin doesn\'t support ' + platform + '  minimum sdk
version.  ' + platform + '  minimum sdk version: ' + platformMinReqScript.output.min_sdk_version+
', failed version requirement: ' + platformMinSDK);
+                if (callback) return callback(err);
+                else throw err;
+            }                        
+        }
+    } else {
+        require('../plugman').emit('log', 'Cordova project minimum sdk or os version not
detected (lacks a ./cordova/sdkRequirement script), continuing.');
+    }
+    
     // checking preferences, if certain variables are not provided, we should throw.
     prefs = plugin_et.findall('./preference') || [];
     prefs = prefs.concat(plugin_et.findall('./platform[@name="'+platform+'"]/preference'));


Mime
View raw message