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/02/03 19:37:37 UTC

[24/33] git commit: CB-5889 Make update script find project name instead of using "null" for CordovaLib

CB-5889 Make update script find project name instead of using "null" for CordovaLib


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/35f2f7d8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/35f2f7d8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/35f2f7d8

Branch: refs/heads/master
Commit: 35f2f7d812a1e27f462ed794af8f119c0dfa76d8
Parents: 7668a69
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jan 24 10:40:09 2014 -0500
Committer: Archana Naik <na...@lab126.com>
Committed: Fri Jan 31 15:08:10 2014 -0800

----------------------------------------------------------------------
 bin/lib/create.js | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/35f2f7d8/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index e92027c..1b62bd8 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -195,20 +195,29 @@ exports.createProject = function(project_path, package_name, project_name, proje
 
 // Attribute removed in Cordova 4.4 (CB-5447).
 function removeDebuggableFromManifest(projectPath) {
-    var manifestPath   = path.join(projectPath, 'AndroidManifest.xml');
+    var manifestPath = path.join(projectPath, 'AndroidManifest.xml');
     shell.sed('-i', /\s*android:debuggable="true"/, '', manifestPath);
 }
 
+function extractProjectNameFromManifest(projectPath) {
+    var manifestPath = path.join(projectPath, 'AndroidManifest.xml');
+    var manifestData = fs.readFileSync(manifestPath, 'utf8');
+    var m = /<activity[\s\S]*?android:name\s*=\s*"(.*?)"/i.exec(manifestData);
+    if (!m) {
+      throw new Error('Could not find activity name in ' + manifestPath);
+    }
+    return m[1];
+}
+
 // Returns a promise.
 exports.updateProject = function(projectPath) {
     var version = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
     // Check that requirements are met and proper targets are installed
     return check_reqs.run()
     .then(function() {
+        var projectName = extractProjectNameFromManifest(projectPath);
         var target_api = check_reqs.get_target();
-        return ensureJarIsBuilt(version, target_api);
-    }).then(function() {
-        copyJsAndJar(projectPath, version);
+        copyJsAndLibrary(projectPath, false, projectName);
         copyScripts(projectPath);
         copyAntRules(projectPath);
         removeDebuggableFromManifest(projectPath);