You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by na...@apache.org on 2014/06/16 22:33:49 UTC

git commit: [CB-6740]Cleanup error reporting when AmazonWebView SDK is not found Updated create script to check commonlibs folder under ~/.cordova/lib. If it doesnt exist create one and let user know. Error message updated. If exists copy it to specific

Repository: cordova-amazon-fireos
Updated Branches:
  refs/heads/master 11ba0a443 -> 5fa8d6ef3


[CB-6740]Cleanup error reporting when AmazonWebView SDK is not found
Updated create script to check commonlibs folder under ~/.cordova/lib.
If it doesnt exist create one and let user know. Error message updated.
If exists copy it to specific release's framework/libs folder.


Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/5fa8d6ef
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/5fa8d6ef
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/5fa8d6ef

Branch: refs/heads/master
Commit: 5fa8d6ef36412e21df6a190c780502b41f982504
Parents: 11ba0a4
Author: Archana Naik <na...@lab126.com>
Authored: Tue Jun 3 12:15:02 2014 -0700
Committer: Archana Naik <na...@lab126.com>
Committed: Mon Jun 16 13:33:33 2014 -0700

----------------------------------------------------------------------
 bin/lib/create.js | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/5fa8d6ef/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 42911e7..4a63c6b 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -161,15 +161,28 @@ exports.createProject = function(project_path, package_name, project_name, proje
         return Q.reject('Package name must look like: com.company.Name');
     }
     
+    //See if commonlibs exists under root .cordova folder. If not, prompt the error and exit
+    var HOME = process.env[(process.platform.slice(0, 3) == 'win') ? 'USERPROFILE' : 'HOME'];
+    var global_config_path = path.join(HOME, '.cordova');
+    var lib_path = path.join(global_config_path, 'lib');
+    var awv_sdk_expected_path=path.join(lib_path, 'commonlibs');
+    var awv_interface_jar_commonlib_path = path.join(awv_sdk_expected_path, awv_interface);
+    console.log('Checking if awv sdk is installed at : ' + awv_sdk_expected_path);
+    if (!fs.existsSync(awv_sdk_expected_path) || !fs.existsSync(awv_interface_jar_commonlib_path)) {
+        shell.mkdir('-p',awv_sdk_expected_path);
+        var msg = '\n*********************************\n\nAmazon WebView API Library Not Found.\n\nPlease download the AmazonWebView SDK from:\n\nhttps://developer.amazon.com/public/solutions/platforms/android-fireos/docs/building-and-testing-your-hybrid-app\n\nThen copy awv_interface.jar from the SDK into this folder:\n\n' + awv_sdk_expected_path + '\n\nRe-run \'cordova platform add amazon-fireos\' to finish adding Amazon Fire OS support to your project.\n\n*********************************\n';
+        console.log(msg);
+        return Q.resolve();
+
+    } 
+    //Copy awv_interface.jar to ~/.cordova/lib/amazon-fireos/cordova/[cordova_release]/framework/libs folder.
     var awv_interface_expected_path=path.join(ROOT, 'framework','libs');
     console.log('awv_path : ' + awv_interface_expected_path);
-    if (!fs.existsSync(awv_interface_expected_path)) {
+    if (!fs.existsSync(awv_interface_expected_path) || !fs.existsSync(path.join(awv_interface_expected_path, awv_interface))) {
         shell.mkdir('-p', awv_interface_expected_path);
-    }
-    
-    if (!fs.existsSync(path.join(awv_interface_expected_path,awv_interface))) {
-        return Q.reject(new Error('awv_interface.jar not found in ' + awv_interface_expected_path +' folder. \nPlease download the AmazonWebView SDK from http://developer.amazon.com/sdk/fire/IntegratingAWV.html#installawv and copy the awv_interface.jar file to this folder:' + awv_interface_expected_path + ' and re-run cordova platform add amazon-fireos command.'));
-    }
+        shell.cp(awv_interface_jar_commonlib_path, awv_interface_expected_path);
+    } 
+          
     // Check that requirements are met and proper targets are installed
     return check_reqs.run()
     .then(function() {