You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by da...@apache.org on 2016/05/13 11:12:57 UTC

[1/2] cordova-coho git commit: CB-9858 Implement Cordova Fetch Proposal

Repository: cordova-coho
Updated Branches:
  refs/heads/master e05ad85ae -> 9c6987041


CB-9858 Implement Cordova Fetch Proposal

Ensure fetch and cli is properly installed/linked
Add fetch to list of tools repos
Resolve cordova-fetch location properly when npm-linking modules


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

Branch: refs/heads/master
Commit: be7eb6edb56de7022f00af53d79aa6705c0d2f66
Parents: e05ad85
Author: Vladimir Kotikov <ko...@gmail.com>
Authored: Thu May 12 18:21:42 2016 +0300
Committer: daserge <v-...@microsoft.com>
Committed: Fri May 13 13:55:46 2016 +0300

----------------------------------------------------------------------
 src/npm-link.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/be7eb6ed/src/npm-link.js
----------------------------------------------------------------------
diff --git a/src/npm-link.js b/src/npm-link.js
index e6e98c2..0c7e1ef 100644
--- a/src/npm-link.js
+++ b/src/npm-link.js
@@ -57,7 +57,9 @@ function *createLink(argv) {
 
     npmLinkOut("cordova-common");
     npmLinkIn("cordova-common", "cordova-lib");
-    npmLinkIn("cordova-common", "cordova-android");
+
+    npmLinkOut("cordova-fetch");
+    npmLinkIn("cordova-fetch", "cordova-lib");
 
     npmLinkOut("cordova-lib");
     npmLinkIn("cordova-lib", "cordova-plugman");
@@ -67,7 +69,10 @@ function *createLink(argv) {
 module.exports = createLink;
 
 function getPathFromModuleName(moduleName) {
-    if (moduleName == "cordova-lib" || moduleName == "cordova-common") {
+    if (moduleName == "cordova-lib" ||
+        moduleName == "cordova-common" ||
+        moduleName == "cordova-fetch") {
+
         return("cordova-lib" + path.sep + moduleName);
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[2/2] cordova-coho git commit: CB-7904 Built nightly releases using coho

Posted by da...@apache.org.
CB-7904 Built nightly releases using coho

Updates code for the current version
Fixed the date format
Add 'ignore-test-failures' flag for debugging purposes
Clone repos if necessary before updating
Add commit short SHA to the lib/cli build version
Adds handling for separate CLI and LIB nightly versions unpublishing
Fixes npm-unpublish-nightly entryPoint


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

Branch: refs/heads/master
Commit: 9c6987041c7fbd649ed8f2c87e635bfd6ab7c09c
Parents: be7eb6e
Author: daserge <v-...@microsoft.com>
Authored: Fri May 13 14:00:22 2016 +0300
Committer: daserge <v-...@microsoft.com>
Committed: Fri May 13 14:04:37 2016 +0300

----------------------------------------------------------------------
 src/main.js         |   2 +-
 src/nightly.js      | 106 ++++++++++++++++++++---------------------------
 src/retrieve-sha.js |   2 +-
 3 files changed, 47 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/9c698704/src/main.js
----------------------------------------------------------------------
diff --git a/src/main.js b/src/main.js
index b41b91e..ec7a9c3 100644
--- a/src/main.js
+++ b/src/main.js
@@ -121,7 +121,7 @@ module.exports = function() {
         },  {
             name: 'npm-unpublish-nightly',
             desc: 'Unpublishes last nightly versions for cli and lib',
-            entryPoint: lazyRequire('./npm-publish', 'unpublishNightly')
+            entryPoint: lazyRequire('./npm-publish', 'unpublish')
         }];
     var otherCommands = [{
             name: 'list-pulls',

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/9c698704/src/nightly.js
----------------------------------------------------------------------
diff --git a/src/nightly.js b/src/nightly.js
index aa81a3d..ad455e1 100644
--- a/src/nightly.js
+++ b/src/nightly.js
@@ -17,6 +17,7 @@ specific language governing permissions and limitations
 under the License.
 */
 
+var apputil = require('./apputil');
 var executil = require('./executil');
 var optimist = require('optimist');
 var flagutil = require('./flagutil');
@@ -29,9 +30,17 @@ var gitutil = require('./gitutil');
 var fs = require('fs');
 var path = require('path');
 var npmlink = require('./npm-link');
+var repoclone = require('./repo-clone');
+
+function pad(number) {
+    if (number < 10) {
+        return '0' + number;
+    }
+    return number;
+}
 
 module.exports = function*(argv) {
-    var repos = flagutil.computeReposFromFlag('nightly');
+    var repos = flagutil.computeReposFromFlag('tools');
     var cli = repoutil.getRepoById('cli');
     var cordovaLib = repoutil.getRepoById('lib');
     var opt = flagutil.registerHelpFlag(optimist);
@@ -45,59 +54,41 @@ module.exports = function*(argv) {
             desc: 'Don\'t actually publish to npm, just print what would be run.',
             type:'boolean'
         })
+        .options('ignore-test-failures', {
+            desc: 'Run the tests for cli and lib but don\'t fail the build if the tests are failing',
+            type:'boolean',
+            alias : 'ignoreTestFailures'
+        })
         .argv;
 
     if(argv.h) {
         optimist.showHelp();
         process.exit(1);
     }
-    
-    //Grab currently published nightly version so we can unpublish it later
-    //Assumes lib and cli have same version
-    var oldNightlyVersion = yield executil.execHelper(executil.ARGS('npm view cordova dist-tags.nightly'));
-    console.log(oldNightlyVersion);
 
-    //Update Repos
+    // Clone and update Repos
+    yield repoclone.cloneRepos(repos, /*silent=*/true);
     yield repoupdate.updateRepos(repos);
 
     //remove local changes and sync up with remote master
     yield repoutil.forEachRepo(repos, function*() {
         yield gitutil.gitClean();
         yield gitutil.resetFromOrigin();
-    })
-
-    //get SHAS from platforms
-    var SHAJSON = yield retrieveSha(repos);
-
-    //save SHAJSON in cordova-cli repo
-    yield repoutil.forEachRepo([cli], function*() {
-        //need to get the path to cordova-cli using executil
-        var cordovaclidir = process.cwd();
-        fs.writeFileSync((path.join(cordovaclidir, 'shas.json')), JSON.stringify(SHAJSON, null, 4), 'utf8', function(err) {
-            if (err) return console.log (err);
-        });
-
-    });
-
-    //Update platform references at cordova-lib/src/cordova/platformsConfig.json
-    var cordovalibdir;
-    yield repoutil.forEachRepo([cordovaLib], function*() {
-        //need to get the path to cordova-lib using executil
-        cordovalibdir = process.cwd();
     });
 
-    yield updatePlatformsFile(path.join(cordovalibdir, 'src/cordova/platformsConfig.json'), SHAJSON);
-
+    // Get SHAS from repos
+    var SHAJSON = yield retrieveSha(repos);
 
     var currentDate = new Date();
     var nightlyVersion = '-nightly.' + currentDate.getFullYear() + '.' +
-                        currentDate.getMonth() + '.' + currentDate.getDate();
+                        pad(currentDate.getMonth() + 1) + '.' + pad(currentDate.getDate());
     var cordovaLibVersion;
     //update package.json version for cli + lib, update lib reference for cli
     yield repoutil.forEachRepo([cordovaLib, cli], function*(repo) {
         var dir = process.cwd();
         var packageJSON = require(dir+'/package.json');
-        packageJSON.version = versionutil.removeDev(packageJSON.version) + nightlyVersion;
+        packageJSON.version = versionutil.removeDev(packageJSON.version) + nightlyVersion +
+            '+' + SHAJSON[repo.id];
 
         if(repo.id === 'lib'){
             cordovaLibVersion = packageJSON.version;
@@ -113,49 +104,42 @@ module.exports = function*(argv) {
     //npm link repos that should be linked
     yield npmlink();
 
+    // npm install cli
+    yield repoutil.forEachRepo([cli], function*(repo) {
+        yield executil.execHelper(executil.ARGS('npm install'), /*silent=*/true, false);
+    });
+
     //run CLI + cordova-lib tests
-    //NOTE: Commented out because of issues running on jenkins machine.
-    //Will rely on medic to test nightlys instead
-    //yield runTests(cli, cordovaLib);
+    yield runTests(cli, cordovaLib, argv.ignoreTestFailures);
 
-    //create options object
     var options = {};
     options.tag = 'nightly';
-    options.r = ['lib', 'cli'];
     options.pretend = argv.pretend;
 
-    //publish to npm under nightly tag
-    yield npmpublish.publishTag(options);
-
     //unpublish old nightly
-    options.version = oldNightlyVersion;
-    yield npmpublish.unpublish(options);
-}
-
-//updates platforms.js with the SHA
-function *updatePlatformsFile(file, shajson) {
-    var platformsJS = require(file);
+    yield repoutil.forEachRepo([cordovaLib, cli], function*(repo) {
+        var repoName = repo.id === 'cli' ? 'cordova' : repo.repoName;
+        var oldNightlyVersion = yield executil.execHelper(executil.ARGS('npm view ' + repoName + ' dist-tags.nightly'));
+        apputil.print('Latest ' + repoName + '@nightly version is ' + oldNightlyVersion);
 
-    var repos = flagutil.computeReposFromFlag('active-platform');
+        options.r = [repo.id];
+        options.version = oldNightlyVersion;
 
-    yield repoutil.forEachRepo(repos, function*(repo) {
-        if(repo.id === 'windows') {
-            platformsJS[repo.id].version = shajson[repo.id];
-            platformsJS['windows8'].version = shajson[repo.id];
-        } else if(repo.id === 'blackberry') {
-            platformsJS['blackberry10'].version = shajson[repo.id];
-        } else {
-            platformsJS[repo.id].version = shajson[repo.id];
-        }
+        yield npmpublish.unpublish(options);
     });
 
-    fs.writeFileSync(file, JSON.stringify(platformsJS, null, 4), 'utf8', function(err) {
-        if (err) return console.log (err);
-    });
+    options.r = ['lib', 'cli'];
+    //publish to npm under nightly tag
+    yield npmpublish.publishTag(options);
 }
 
-function *runTests(cli, lib) {
+function *runTests(cli, lib, ignoreTestFailures) {
     yield repoutil.forEachRepo([cli, lib], function *(repo) {
-           yield executil.execHelper(executil.ARGS('npm test'), false, false);
+        try {
+            yield executil.execHelper(executil.ARGS('npm test'), false, ignoreTestFailures);
+        } catch (e) {
+            if (!ignoreTestFailures) throw e;
+            apputil.print('Skipping failing tests due to "ignore-test-failures flag"');
+        }
     });
 }

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/9c698704/src/retrieve-sha.js
----------------------------------------------------------------------
diff --git a/src/retrieve-sha.js b/src/retrieve-sha.js
index a694cdc..713629a 100644
--- a/src/retrieve-sha.js
+++ b/src/retrieve-sha.js
@@ -22,7 +22,7 @@ var executil = require('./executil');
 module.exports = function *(repos) {
     var shas = {};
     yield repoutil.forEachRepo(repos, function*(repo) {
-        shas[repo.id] = yield executil.execHelper(executil.ARGS('git rev-parse HEAD'), true, true);
+        shas[repo.id] = yield executil.execHelper(executil.ARGS('git rev-parse --short=8 HEAD'), true, true);
     });
     return shas;
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org