You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2014/08/26 22:46:38 UTC

[05/15] git commit: bin/build/[build,run] add --framework option

bin/build/[build,run] add --framework option


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

Branch: refs/heads/master
Commit: bb6b1b4632a68810207a0743434ed290c7d1042f
Parents: 11e4cf2
Author: Maxim Ermilov <ma...@canonical.com>
Authored: Tue Jun 3 01:52:43 2014 +0400
Committer: Maxim Ermilov <ma...@canonical.com>
Committed: Tue Aug 19 14:19:23 2014 +0400

----------------------------------------------------------------------
 bin/build/build         |  4 +++-
 bin/build/lib/ubuntu.js | 29 +++++++++++++++++------------
 bin/build/run           |  4 ++--
 bin/create              |  1 -
 4 files changed, 22 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/bb6b1b46/bin/build/build
----------------------------------------------------------------------
diff --git a/bin/build/build b/bin/build/build
index 81810d3..e4caeba 100755
--- a/bin/build/build
+++ b/bin/build/build
@@ -25,6 +25,8 @@ var platform = require('./lib/ubuntu');
 var root = path.resolve();
 var www = path.join(root, 'www');
 
+var argv = require('optimist').string(['framework']).argv;
+
 platform.check_reqs(root).then(function () {
-    return platform.build(root, platform.ALL);
+    return platform.build(root, platform.ALL, false, undefined, argv.framework);
 }).done();

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/bb6b1b46/bin/build/lib/ubuntu.js
----------------------------------------------------------------------
diff --git a/bin/build/lib/ubuntu.js b/bin/build/lib/ubuntu.js
index b7f5ed2..7ef54ba 100644
--- a/bin/build/lib/ubuntu.js
+++ b/bin/build/lib/ubuntu.js
@@ -81,15 +81,14 @@ function cpuCount() {
     return os.cpus().length;
 }
 
-function buildClickPackage(campoDir, ubuntuDir, nobuild, architecture) {
+function buildClickPackage(campoDir, ubuntuDir, nobuild, architecture, framework) {
     assert.ok(architecture && architecture.match(/^[a-z0-9_]+$/));
 
-    var archDir = path.join(ubuntuDir, architecture);
+    var archDir = path.join(ubuntuDir, framework, architecture);
     var prefixDir = path.join(archDir, 'prefix');
-    var framework = "ubuntu-sdk-13.10";
 
     if (!fs.existsSync(archDir))
-        shell.mkdir(archDir);
+        shell.mkdir('-p', archDir);
 
     if (nobuild && fs.existsSync(path.join(prefixDir, 'cordova-ubuntu'))) {
         return Q();
@@ -121,6 +120,7 @@ function buildClickPackage(campoDir, ubuntuDir, nobuild, architecture) {
 
         var content = JSON.parse(fs.readFileSync(path.join(ubuntuDir, 'manifest.json'), {encoding: "utf8"}));
         content.architecture = architecture;
+        content.framework = framework;
         fs.writeFileSync(path.join(prefixDir, 'manifest.json'), JSON.stringify(content));
 
         pushd(prefixDir);
@@ -190,22 +190,24 @@ module.exports.ALL = 2;
 module.exports.PHONE = 0;
 module.exports.DESKTOP = 1;
 
-module.exports.build = function(rootDir, target, nobuild, architecture) {
+module.exports.build = function(rootDir, target, nobuild, architecture, framework) {
     var ubuntuDir = path.join(rootDir, 'platforms', 'ubuntu');
     var campoDir = path.join(ubuntuDir, 'build');
 
     if (!architecture)
         architecture = 'armhf';
+    if (!framework)
+        framework = "ubuntu-sdk-13.10";
 
     assert.ok(fs.existsSync(ubuntuDir));
     assert.ok(fs.existsSync(campoDir));
 
     if (target === module.exports.PHONE)
-        return buildClickPackage(campoDir, ubuntuDir, nobuild, architecture);
+        return buildClickPackage(campoDir, ubuntuDir, nobuild, architecture, framework);
     if (target === module.exports.DESKTOP)
         return buildNative(campoDir, ubuntuDir, nobuild);
     if (target === module.exports.ALL) {
-        return buildClickPackage(campoDir, ubuntuDir, nobuild, architecture).then(function () {
+        return buildClickPackage(campoDir, ubuntuDir, nobuild, architecture, framework).then(function () {
             return buildNative(campoDir, ubuntuDir, nobuild);
         });
     }
@@ -271,7 +273,7 @@ function getDeviceArch(target) {
     return out[0];
 }
 
-function runOnDevice(rootDir, debug, target, architecture) {
+function runOnDevice(rootDir, debug, target, architecture, framework) {
     var ubuntuDir = path.join(rootDir, 'platforms', 'ubuntu');
 
     if (!isDeviceAttached(target)) {
@@ -279,7 +281,7 @@ function runOnDevice(rootDir, debug, target, architecture) {
         process.exit(1);
     }
 
-    var archDir = path.join(ubuntuDir, architecture);
+    var archDir = path.join(ubuntuDir, framework, architecture);
     var prefixDir = path.join(archDir, 'prefix');
 
     pushd(prefixDir);
@@ -314,13 +316,16 @@ function runOnDevice(rootDir, debug, target, architecture) {
     });
 }
 
-module.exports.run = function(rootDir, desktop, debug, target, nobuild, emulator) {
+module.exports.run = function(rootDir, desktop, debug, target, nobuild, emulator, framework) {
     if (desktop && !emulator) {
         return module.exports.build(rootDir, module.exports.DESKTOP, nobuild).then(function () {
             return runNative(rootDir, debug);
         });
     }
 
+    if (!framework)
+        framework = "ubuntu-sdk-13.10";
+
     if (!target) {
         var devices = deviceList();
 
@@ -348,8 +353,8 @@ module.exports.run = function(rootDir, desktop, debug, target, nobuild, emulator
     }
     var arch = getDeviceArch(target);
 
-    return module.exports.build(rootDir, module.exports.PHONE, nobuild, arch).then(function () {
-        return runOnDevice(rootDir, debug, target, arch);
+    return module.exports.build(rootDir, module.exports.PHONE, nobuild, arch, framework).then(function () {
+        return runOnDevice(rootDir, debug, target, arch, framework);
     });
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/bb6b1b46/bin/build/run
----------------------------------------------------------------------
diff --git a/bin/build/run b/bin/build/run
index a69b28a..8a1d9ca 100755
--- a/bin/build/run
+++ b/bin/build/run
@@ -24,9 +24,9 @@ var platform = require('./lib/ubuntu');
 var root = path.resolve();
 var www = path.join(root, 'www');
 
-var argv = require('optimist').boolean(['device', 'emulator', 'debug', 'nobuild']).string(['target']).argv;
+var argv = require('optimist').boolean(['device', 'emulator', 'debug', 'nobuild']).string(['target', 'framework']).argv;
 
 platform.check_reqs(root).then(function () {
-    return platform.run(root, !argv.device, argv.debug, argv.target, argv.nobuild, argv.emulator);
+    return platform.run(root, !argv.device, argv.debug, argv.target, argv.nobuild, argv.emulator, argv.framework);
 }).done();
 

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/bb6b1b46/bin/create
----------------------------------------------------------------------
diff --git a/bin/create b/bin/create
index bf5c25f..cd99fcc 100755
--- a/bin/create
+++ b/bin/create
@@ -41,7 +41,6 @@ function create(project_path, package_name, project_name, project_template_dir)
         }
         shell.mkdir(project_path);
         shell.cp('-r', path.join(ROOT, '*'), path.join(project_path, 'build'));
-        shell.mkdir(path.join(project_path, 'armhf'));
         shell.mkdir(path.join(project_path, 'native'));
         shell.cp('-r', path.join(ROOT, 'bin/build/*'), path.join(project_path, 'cordova'));
         shell.cp('-r', path.join(ROOT, 'bin/check_reqs'), path.join(project_path, 'cordova'));