cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [1/2] js commit: CB-7219 added platformVersion, removed cordova.version
Date Tue, 12 Aug 2014 18:11:46 GMT
Repository: cordova-js
Updated Branches:
  refs/heads/cb-7219 [created] 71113eb61


CB-7219 added platformVersion, removed cordova.version


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

Branch: refs/heads/cb-7219
Commit: e078455d8918229cba7ef9c2003bc249d84467fd
Parents: 13b556e
Author: Steven Gill <stevengill97@gmail.com>
Authored: Mon Aug 11 17:31:51 2014 -0700
Committer: Steven Gill <stevengill97@gmail.com>
Committed: Mon Aug 11 17:31:51 2014 -0700

----------------------------------------------------------------------
 .jshintrc                         |  2 +-
 README.md                         | 12 ++++++++++--
 VERSION                           |  2 +-
 package.json                      |  2 +-
 src/cordova.js                    |  3 ++-
 src/cordova_b.js                  |  3 ++-
 tasks/compile-browserify.js       | 18 ++++++++++++++++--
 tasks/compile.js                  | 19 +++++++++++++++++--
 tasks/lib/bundle-browserify.js    |  5 +++--
 tasks/lib/bundle.js               |  8 +++++---
 tasks/lib/compute-commit-id.js    | 16 +++++++---------
 tasks/lib/packager-browserify.js  |  7 +++----
 tasks/lib/packager.js             |  6 +++---
 tasks/lib/write-license-header.js |  5 +++--
 14 files changed, 74 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e078455d/.jshintrc
----------------------------------------------------------------------
diff --git a/.jshintrc b/.jshintrc
index 505f458..b5f288c 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -28,7 +28,7 @@
   "dojo": false,
 
   // Custom predefined globals.
-  "predef": ["jasmine", "blackberry", "define", "alert", "prompt", "org", "deviceapis", "Osp",
"_cordovaExec", "WinJS", "Windows", "MSApp", "PalmSystem", "PalmServiceBridge", "Acceleration",
"webworks", "CORDOVA_JS_BUILD_LABEL"],
+  "predef": ["jasmine", "blackberry", "define", "alert", "prompt", "org", "deviceapis", "Osp",
"_cordovaExec", "WinJS", "Windows", "MSApp", "PalmSystem", "PalmServiceBridge", "Acceleration",
"webworks", "CORDOVA_JS_BUILD_LABEL", "PLATFORM_VERSION_BUILD_LABEL"],
 
 
   // Development

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e078455d/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 600c90d..b188caa 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,15 @@ All of the build tasks can be run via the `grunt` node module. Install
it global
 
 Then from the repository root run:
 
-    grunt
+    grunt --platformVersion=3.6.0
+
+To do just one platform, run:
+
+    grunt compile:android --platformVersion=3.6.0
+
+To create the browserify version, run:
+
+    grunt compile-browserify --platformVersion=3.6.0
 	
 For integration, see the 'Integration' section below.
 
@@ -82,7 +90,7 @@ The `boot` method does all the work.  First, it grabs the common platform
defini
 
 Tests run in node or the browser. To run the tests in node:
     
-    grunt test
+    grunt test --platformVersion=3.6.0
 
 To run them in the browser:
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e078455d/VERSION
----------------------------------------------------------------------
diff --git a/VERSION b/VERSION
index 86bab9c..7c69a55 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.6.0-dev
+3.7.0

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e078455d/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 8c24550..923033e 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
   "author": "Gord Tanner <gtanner@gmail.com> (http://github.com/gtanner)",
   "name": "cordova-js",
   "description": "Cordova JavaScript: a unified JavaScript layer for the Cordova suite of
projects enabling cross-platform native mobile development of applications using HTML, CSS
and JavaScript.",
-  "version": "3.6.2",
+  "version": "3.7.0",
   "homepage": "http://cordova.apache.org",
   "repository": {
     "type": "git",

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e078455d/src/cordova.js
----------------------------------------------------------------------
diff --git a/src/cordova.js b/src/cordova.js
index 3564d45..4d16516 100644
--- a/src/cordova.js
+++ b/src/cordova.js
@@ -93,7 +93,8 @@ function createEvent(type, data) {
 var cordova = {
     define:define,
     require:require,
-    version:CORDOVA_JS_BUILD_LABEL,
+    //version:CORDOVA_JS_BUILD_LABEL,
+    platformVersion:PLATFORM_VERSION_BUILD_LABEL,
     platformId:platform.id,
     /**
      * Methods to add/remove your own addEventListener hijacking on document + window.

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e078455d/src/cordova_b.js
----------------------------------------------------------------------
diff --git a/src/cordova_b.js b/src/cordova_b.js
index e4084ee..29177e2 100644
--- a/src/cordova_b.js
+++ b/src/cordova_b.js
@@ -91,7 +91,8 @@ function createEvent(type, data) {
 
 
 var cordova = {
-    version:CORDOVA_JS_BUILD_LABEL,
+    platformVersion:PLATFORM_VERSION_BUILD_LABEL,
+    //version:CORDOVA_JS_BUILD_LABEL,
     require: function(module) {
         if(module === "cordova/exec") {
             return cordova.exec;

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e078455d/tasks/compile-browserify.js
----------------------------------------------------------------------
diff --git a/tasks/compile-browserify.js b/tasks/compile-browserify.js
index 1d28510..f58c4f7 100644
--- a/tasks/compile-browserify.js
+++ b/tasks/compile-browserify.js
@@ -20,10 +20,24 @@ var generate = require('./lib/packager-browserify');
 
 module.exports = function(grunt) {
     grunt.registerMultiTask('compile-browserify', 'Packages cordova.js browserify style',
function() {
-
         var done = this.async();
         var platformName = this.target;
         var useWindowsLineEndings = this.data.useWindowsLineEndings;
-        generate(platformName, useWindowsLineEndings, done);
+
+        //grabs --platformVersion flag
+        var flags = grunt.option.flags();
+        var platformVersion;
+        flags.forEach(function(flag) {
+            if (flag.indexOf('platformVersion') > -1) {
+                var equalIndex = flag.indexOf('=');
+                platformVersion = flag.slice(equalIndex + 1);
+            }
+        });
+        if(!platformVersion){
+            console.log('please add a platform version flag and value');
+            console.log('ex: grunt compile-browserify --platformVersion=3.6.0');
+            throw new Error("platformVersion is required!");
+        }
+        generate(platformName, useWindowsLineEndings, platformVersion, done);
     });
 }

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e078455d/tasks/compile.js
----------------------------------------------------------------------
diff --git a/tasks/compile.js b/tasks/compile.js
index 58db43c..0e8392e 100644
--- a/tasks/compile.js
+++ b/tasks/compile.js
@@ -20,11 +20,26 @@ var generate = require('./lib/packager');
 
 module.exports = function(grunt) {
     grunt.registerMultiTask('compile', 'Packages cordova.js', function() {
-
         var done = this.async();
         var platformName = this.target;
         var useWindowsLineEndings = this.data.useWindowsLineEndings;
+        var platformVersion;
+       
+        //grabs --platformVersion flag
+        var flags = grunt.option.flags();
+        var platformVersion;
+        flags.forEach(function(flag) {
+            if (flag.indexOf('platformVersion') > -1) {
+                var equalIndex = flag.indexOf('=');
+                platformVersion = flag.slice(equalIndex + 1);
+            }
+        });
+        if(!platformVersion){
+            console.log('please add a platform version flag and value');
+            console.log('ex: grunt compile-browserify --platformVersion=3.6.0');
+            throw new Error("platformVersion is required!");
+        }
 
-        generate(platformName, useWindowsLineEndings, done);
+        generate(platformName, useWindowsLineEndings, platformVersion, done);
     });
 }

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e078455d/tasks/lib/bundle-browserify.js
----------------------------------------------------------------------
diff --git a/tasks/lib/bundle-browserify.js b/tasks/lib/bundle-browserify.js
index 1d948fa..f038117 100644
--- a/tasks/lib/bundle-browserify.js
+++ b/tasks/lib/bundle-browserify.js
@@ -23,13 +23,14 @@ var require_tr   = require('./require-tr');
 var root         = path.join(__dirname, '..', '..')
 
 
-module.exports = function bundle(platform, debug, commitId) {
+module.exports = function bundle(platform, debug, commitId, platformVersion) {
     require_tr.platform = platform;
     // FIXME: need to find a way to void ignore missing
     var b = browserify({debug: debug});
     // XXX plugin_list is not present at this stage 
     b.ignore(path.join(root, 'src', 'common', 'plugin_list'));
-
+    console.log('commitID: '+ commitId);
+    console.log('platformVersion: ' + platformVersion);
     b.transform(require_tr.transform);
 
     b.add(path.join(root, 'src', platform, 'exec.js'));

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e078455d/tasks/lib/bundle.js
----------------------------------------------------------------------
diff --git a/tasks/lib/bundle.js b/tasks/lib/bundle.js
index 8cdf11e..3937c51 100644
--- a/tasks/lib/bundle.js
+++ b/tasks/lib/bundle.js
@@ -24,12 +24,13 @@ var writeModule  = require('./write-module');
 var writeScript  = require('./write-script');
 var licensePath = path.join(__dirname, '..', 'templates', 'LICENSE-for-js-file.txt');
 
-module.exports = function bundle(platform, debug, commitId) {
+module.exports = function bundle(platform, debug, commitId, platformVersion) {
     var modules = collectFiles(path.join('src', 'common'));
     var scripts = collectFiles(path.join('src', 'scripts'));
     modules[''] = path.join('src', 'cordova.js');
     copyProps(modules, collectFiles(path.join('src', platform)));
-
+    console.log('commitID: '+ commitId);
+    console.log('platformVersion: ' + platformVersion);
     if (platform === 'test') {
         // Add any platform-specific modules that have tests to the test bundle.
         var testFilesPath = path.join('src', 'android', 'android');
@@ -46,7 +47,8 @@ module.exports = function bundle(platform, debug, commitId) {
     // write header
     output.push('/*', fs.readFileSync(licensePath, 'utf8'), '*/');
     output.push(';(function() {');
-    output.push("var CORDOVA_JS_BUILD_LABEL = '"  + commitId + "';");
+    //output.push("var CORDOVA_JS_BUILD_LABEL = '"  + commitId + "';");
+    output.push("var PLATFORM_VERSION_BUILD_LABEL = '"  + platformVersion + "';");
 
     // write initial scripts
     if (!scripts['require']) {

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e078455d/tasks/lib/compute-commit-id.js
----------------------------------------------------------------------
diff --git a/tasks/lib/compute-commit-id.js b/tasks/lib/compute-commit-id.js
index 6fb5500..d768340 100644
--- a/tasks/lib/compute-commit-id.js
+++ b/tasks/lib/compute-commit-id.js
@@ -30,9 +30,9 @@ module.exports = function computeCommitId(callback, cachedGitVersion) {
 
     var versionFileId = fs.readFileSync('VERSION', { encoding: 'utf8' }).trim();
 
-    if (/-dev$/.test(versionFileId) && fs.existsSync('.git')) {
+    if (fs.existsSync('.git')) {
         var gitPath = 'git';
-        var args = 'rev-list HEAD --max-count=1 --abbrev-commit';
+        var args = 'rev-list HEAD --max-count=1';
         childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) {
             var isWindows = process.platform.slice(0, 3) == 'win';
             if (err && isWindows) {
@@ -40,21 +40,19 @@ module.exports = function computeCommitId(callback, cachedGitVersion)
{
                 childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) {
                     if (err) {
                         console.warn('Error during git describe: ' + err);
-                        done(versionFileId + '-??');
+                        done('???');
                     } else {
-                        done(versionFileId + '-' + stdout);
+                        done(stdout);
                     }
                 });
             } else if (err) {
                 console.warn('Error during git describe: ' + err);
-                done(versionFileId + '-??');
+                done('???');
             } else {
-                done(versionFileId + '-' + stdout);
+                done(stdout);
             }
         });
-    } else {
-        done(fs.readFileSync('VERSION', { encoding: 'utf8' }));
-    }
+    } 
 
     function done(stdout) {
         var version = stdout.trim();

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e078455d/tasks/lib/packager-browserify.js
----------------------------------------------------------------------
diff --git a/tasks/lib/packager-browserify.js b/tasks/lib/packager-browserify.js
index 3e718c6..4d24592 100644
--- a/tasks/lib/packager-browserify.js
+++ b/tasks/lib/packager-browserify.js
@@ -23,15 +23,14 @@ var bundle             = require('./bundle-browserify');
 var computeCommitId    = require('./compute-commit-id');
 var writeLicenseHeader = require('./write-license-header');
 
-
-module.exports = function generate(platform, useWindowsLineEndings, done) {
+module.exports = function generate(platform, useWindowsLineEndings, platformVersion, done)
{
     computeCommitId(function(commitId) {
         var outReleaseFile, outReleaseFileStream,
             outDebugFile, outDebugFileStream,
             releaseBundle, debugBundle;
         var time = new Date().valueOf();
 
-        var libraryRelease = bundle(platform, false, commitId);
+        var libraryRelease = bundle(platform, false, commitId, platformVersion);
        // if we are using windows line endings, we will also add the BOM
        // if(useWindowsLineEndings) {
        //     libraryRelease = "\ufeff" + libraryRelease.split(/\r?\n/).join("\r\n");
@@ -49,7 +48,7 @@ module.exports = function generate(platform, useWindowsLineEndings, done)
{
         outReleaseFileStream = fs.createWriteStream(outReleaseFile);
         
         // write license header
-        writeLicenseHeader(outReleaseFileStream, platform, commitId);
+        writeLicenseHeader(outReleaseFileStream, platform, commitId, platformVersion);
 
         releaseBundle = libraryRelease.bundle();
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e078455d/tasks/lib/packager.js
----------------------------------------------------------------------
diff --git a/tasks/lib/packager.js b/tasks/lib/packager.js
index 0fd2bcc..7aba70f 100644
--- a/tasks/lib/packager.js
+++ b/tasks/lib/packager.js
@@ -22,17 +22,17 @@ var bundle          = require('./bundle');
 var computeCommitId = require('./compute-commit-id');
 
 
-module.exports = function generate(platform, useWindowsLineEndings, callback) {
+module.exports = function generate(platform, useWindowsLineEndings, platformVersion, callback)
{
     computeCommitId(function(commitId) {
         var outFile;
         var time = new Date().valueOf();
 
-        var libraryRelease = bundle(platform, false, commitId);
+        var libraryRelease = bundle(platform, false, commitId, platformVersion);
         // if we are using windows line endings, we will also add the BOM
         if(useWindowsLineEndings) {
             libraryRelease = "\ufeff" + libraryRelease.split(/\r?\n/).join("\r\n");
         }
-        var libraryDebug   = bundle(platform, true, commitId);
+        var libraryDebug   = bundle(platform, true, commitId, platformVersion);
 
         time = new Date().valueOf() - time;
         if (!fs.existsSync('pkg')) {

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e078455d/tasks/lib/write-license-header.js
----------------------------------------------------------------------
diff --git a/tasks/lib/write-license-header.js b/tasks/lib/write-license-header.js
index 8b33cbd..c8d4345 100644
--- a/tasks/lib/write-license-header.js
+++ b/tasks/lib/write-license-header.js
@@ -3,14 +3,15 @@ var util        = require('util');
 var fs          = require('fs');
 var licensePath = path.join(__dirname, '..', 'templates', 'LICENSE-for-js-file.txt');
 
-module.exports = function(outStream, platform, commitId) {
+module.exports = function(outStream, platform, commitId, platformVersion) {
   // some poppycock 
   var licenseText = util.format("/*\n *%s\n */\n", fs.readFileSync(licensePath, 'utf8').replace(/\n/g,
"\n *"));
 
   outStream.write("// Platform: " + platform + "\n", 'utf8');
   outStream.write("// "  + commitId + "\n", 'utf8');
   outStream.write(licenseText, 'utf8');
-  outStream.write("var CORDOVA_JS_BUILD_LABEL = '"  + commitId + "';\n", 'utf8');
+  //outStream.write("var CORDOVA_JS_BUILD_LABEL = '"  + commitId + "';\n", 'utf8');
+  outStream.write("var PLATFORM_VERSION_BUILD_LABEL = '"  + platformVersion + "';\n", 'utf8');
   outStream.write("var define = {moduleMap: []};\n", 'utf8');
 
 }


Mime
View raw message