cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [06/13] git commit: bin/build/run: --nobuild option
Date Thu, 30 Jan 2014 23:25:30 GMT
bin/build/run: --nobuild 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/a4aaf83f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/tree/a4aaf83f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/diff/a4aaf83f

Branch: refs/heads/master
Commit: a4aaf83f774cb18ae318f2b0a767d61db6690607
Parents: c948125
Author: Maxim Ermilov <maxim.ermilov@canonical.com>
Authored: Mon Dec 23 19:37:15 2013 +0400
Committer: Maxim Ermilov <maxim.ermilov@canonical.com>
Committed: Mon Dec 23 19:37:15 2013 +0400

----------------------------------------------------------------------
 bin/build/lib/ubuntu.js | 26 +++++++++++++++++---------
 bin/build/run           |  4 ++--
 2 files changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/a4aaf83f/bin/build/lib/ubuntu.js
----------------------------------------------------------------------
diff --git a/bin/build/lib/ubuntu.js b/bin/build/lib/ubuntu.js
index 476ed53..1fde472 100644
--- a/bin/build/lib/ubuntu.js
+++ b/bin/build/lib/ubuntu.js
@@ -57,12 +57,16 @@ function popd(dir) {
     shell.popd();
 }
 
-function buildArmPackage(campoDir, ubuntuDir) {
+function buildArmPackage(campoDir, ubuntuDir, nobuild) {
     var armhfDir = path.join(ubuntuDir, 'armhf');
+    var prefixDir = path.join(armhfDir, 'prefix');
+
+    if (nobuild && fs.existsSync(path.join(prefixDir, 'cordova-ubuntu'))) {
+        return;
+    }
 
     shell.rm('-rf', path.join(armhfDir, 'build'));
 
-    var prefixDir = path.join(armhfDir, 'prefix');
     shell.rm('-rf', prefixDir);
     shell.mkdir(path.join(armhfDir, 'build'));
     shell.mkdir(prefixDir);
@@ -92,10 +96,14 @@ function buildArmPackage(campoDir, ubuntuDir) {
     popd();
 }
 
-function buildNative(campoDir, ubuntuDir) {
+function buildNative(campoDir, ubuntuDir, nobuild) {
     var nativeDir = path.join(ubuntuDir, 'native');
     var prefixDir = path.join(nativeDir, 'prefix');
 
+    if (nobuild && fs.existsSync(path.join(prefixDir, 'cordova-ubuntu'))) {
+        return;
+    }
+
     shell.rm('-rf', path.join(nativeDir, 'build'));
     shell.rm('-rf', prefixDir);
 
@@ -118,7 +126,7 @@ module.exports.ALL = 2;
 module.exports.PHONE = 0;
 module.exports.DESKTOP = 1;
 
-module.exports.build = function(rootDir, target) {
+module.exports.build = function(rootDir, target, nobuild) {
     var ubuntuDir = path.join(rootDir, 'platforms', 'ubuntu');
     var campoDir = path.join(ubuntuDir, 'build');
 
@@ -126,9 +134,9 @@ module.exports.build = function(rootDir, target) {
     assert.ok(fs.existsSync(campoDir));
 
     if (target === module.exports.PHONE || target === module.exports.ALL)
-        buildArmPackage(campoDir, ubuntuDir);
+        buildArmPackage(campoDir, ubuntuDir, nobuild);
     if (target === module.exports.DESKTOP || target === module.exports.ALL)
-        buildNative(campoDir, ubuntuDir);
+        buildNative(campoDir, ubuntuDir, nobuild);
 }
 
 function runNative(rootDir, debug) {
@@ -223,9 +231,9 @@ function runOnDevice(rootDir, debug, target) {
     console.log('have fun!'.rainbow);
 }
 
-module.exports.run = function(rootDir, desktop, debug, target) {
+module.exports.run = function(rootDir, desktop, debug, target, nobuild) {
     if (desktop) {
-        module.exports.build(rootDir, module.exports.DESKTOP);
+        module.exports.build(rootDir, module.exports.DESKTOP, nobuild);
         runNative(rootDir, debug);
     } else {
         if (!target) {
@@ -244,7 +252,7 @@ module.exports.run = function(rootDir, desktop, debug, target) {
             }
         }
 
-        module.exports.build(rootDir, module.exports.PHONE);
+        module.exports.build(rootDir, module.exports.PHONE, nobuild);
         runOnDevice(rootDir, debug, target);
     }
 }

http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/a4aaf83f/bin/build/run
----------------------------------------------------------------------
diff --git a/bin/build/run b/bin/build/run
index 2b6e549..20b95cc 100755
--- a/bin/build/run
+++ b/bin/build/run
@@ -24,7 +24,7 @@ var platform = require('./lib/ubuntu');
 var root = path.resolve();
 var www = path.join(root, 'www');
 
-var argv = require('optimist').boolean(['device', 'debug']).string(['target']).argv;
+var argv = require('optimist').boolean(['device', 'debug', 'nobuild']).string(['target']).argv;
 
-platform.run(root, !argv.device, argv.debug, argv.target);
+platform.run(root, !argv.device, argv.debug, argv.target, argv.nobuild);
 


Mime
View raw message