cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject js commit: [all] CB-3305 Use packager to set device.cordova
Date Tue, 30 Apr 2013 18:10:25 GMT
Updated Branches:
  refs/heads/master abc9de8e2 -> 27734156d


[all] CB-3305 Use packager to set device.cordova

Instead of having to update the inlined version of the value for each
release.


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

Branch: refs/heads/master
Commit: 27734156d52903581b308375e7a1a270de83f0c6
Parents: abc9de8
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Tue Apr 30 14:09:14 2013 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue Apr 30 14:09:14 2013 -0400

----------------------------------------------------------------------
 .jshintrc                                   |    2 +-
 Jakefile                                    |   22 +---------------------
 build/packager.js                           |   19 ++++++++++---------
 lib/bada/plugin/bada/device.js              |    2 +-
 lib/blackberry/plugin/air/device.js         |    2 +-
 lib/blackberry/plugin/qnx/device.js         |    2 +-
 lib/common/plugin/device.js                 |    6 +++++-
 lib/firefoxos/plugin/firefoxos/device.js    |    2 +-
 lib/tizen/plugin/tizen/Device.js            |    2 +-
 lib/windows8/plugin/windows8/DeviceProxy.js |    2 +-
 10 files changed, 23 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/27734156/.jshintrc
----------------------------------------------------------------------
diff --git a/.jshintrc b/.jshintrc
index 076a30e..505f458 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"],
+  "predef": ["jasmine", "blackberry", "define", "alert", "prompt", "org", "deviceapis", "Osp",
"_cordovaExec", "WinJS", "Windows", "MSApp", "PalmSystem", "PalmServiceBridge", "Acceleration",
"webworks", "CORDOVA_JS_BUILD_LABEL"],
 
 
   // Development

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/27734156/Jakefile
----------------------------------------------------------------------
diff --git a/Jakefile b/Jakefile
index fab22a0..bd1639e 100644
--- a/Jakefile
+++ b/Jakefile
@@ -82,7 +82,7 @@ task('clean', ['set-cwd'], function () {
 }, true);
 
 desc("compiles the source files for all extensions");
-task('build', ['clean', 'hint', 'update-version'], function () {
+task('build', ['clean', 'hint'], function () {
     var packager = require("./build/packager");
     computeGitVersion(function(version) {
         console.log("building " + version);
@@ -103,26 +103,6 @@ task('build', ['clean', 'hint', 'update-version'], function () {
     });
 }, true);
 
-desc("drops VERSION into JavaScript-based platforms");
-task('update-version', ['set-cwd'], function() {
-    var version = fs.readFileSync("VERSION", "utf-8").toString().split(/\r?\n/).join('');
-
-    // List of files that need to be interpolated with matching regexes
-    var files = {
-        "lib/bada/plugin/bada/device.js":/(me\.cordova\s=\s").+(")/,
-        "lib/tizen/plugin/tizen/Device.js":/(this\.cordova\s=\s").+(")/,
-        "lib/firefoxos/plugin/firefoxos/device.js":/(this\.cordova\s=\s").+(")/,
-        "lib/blackberry/plugin/qnx/device.js":/(cordova:\s").+(")/,
-        "lib/blackberry/plugin/air/device.js":/(cordova:\s").+(")/,
-        "lib/windows8/plugin/windows8/DeviceProxy.js":/(cordova:\s").+(")/
-    };
-
-    for (var f in files) if (files.hasOwnProperty(f)) {
-        var interpolatedContent = fs.readFileSync(f, "utf-8").toString().replace(files[f],
"$1" + version + "$2");
-        fs.writeFileSync(f, interpolatedContent);
-    }
-});
-
 desc("prints a dalek");
 task('dalek', ['set-cwd'], function () {
     util.puts(fs.readFileSync("build/dalek", "utf-8"));

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/27734156/build/packager.js
----------------------------------------------------------------------
diff --git a/build/packager.js b/build/packager.js
index d73c789..0801451 100644
--- a/build/packager.js
+++ b/build/packager.js
@@ -72,13 +72,14 @@ packager.bundle = function(platform, debug, commitId ) {
 
     var output = [];
 	
-    output.push("// Platform: " + platform + "\n");
-    output.push("// "  + commitId + "\n");
-	output.push("// File generated at :: "  + new Date() + "\n");
-
-    // write header     
-    output.push('/*\n' + getContents('LICENSE-for-js-file.txt') + '\n*/')
-    output.push('\n;(function() {\n')
+    output.push("// Platform: " + platform);
+    output.push("// "  + commitId);
+    output.push("// File generated at :: " + new Date());
+
+    // write header
+    output.push('/*', getContents('LICENSE-for-js-file.txt'), '*/')
+    output.push(';(function() {')
+    output.push("var CORDOVA_JS_BUILD_LABEL = '"  + commitId + "';");
     
     // write initial scripts
     if (!scripts['require']) {
@@ -97,7 +98,7 @@ packager.bundle = function(platform, debug, commitId ) {
         writeModule(output, modules[moduleId], moduleId, debug)
     }
 
-    output.push("\nwindow.cordova = require('cordova');\n")
+    output.push("window.cordova = require('cordova');")
 
     // write final scripts
     if (!scripts['bootstrap']) {
@@ -122,7 +123,7 @@ packager.bundle = function(platform, debug, commitId ) {
     }
 
     // write trailer
-    output.push('\n})();')
+    output.push('})();')
 
     return output.join('\n')
 }

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/27734156/lib/bada/plugin/bada/device.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/device.js b/lib/bada/plugin/bada/device.js
index 0ae0095..8896c25 100644
--- a/lib/bada/plugin/bada/device.js
+++ b/lib/bada/plugin/bada/device.js
@@ -69,7 +69,7 @@ Device.prototype.getDeviceInfo = function(success, fail, args) {
            me.platform = os_vendor + " " + os_name;
            me.version = os_version;
            me.uuid = uuid;
-           me.cordova = "2.7.0rc1";
+           me.cordova = CORDOVA_JS_BUILD_LABEL;
            success(me);
        }
    };

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/27734156/lib/blackberry/plugin/air/device.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/device.js b/lib/blackberry/plugin/air/device.js
index be252e9..9d0ecc0 100644
--- a/lib/blackberry/plugin/air/device.js
+++ b/lib/blackberry/plugin/air/device.js
@@ -35,7 +35,7 @@ module.exports = {
                     model: "PlayBook",
                     name: "PlayBook", // deprecated: please use device.model
                     uuid: info.uuid,
-                    cordova: "2.7.0rc1"
+                    cordova: CORDOVA_JS_BUILD_LABEL
                 });
             }),
             request = new blackberry.transport.RemoteFunctionCall("org/apache/cordova/getDeviceInfo");

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/27734156/lib/blackberry/plugin/qnx/device.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/qnx/device.js b/lib/blackberry/plugin/qnx/device.js
index 0d805ff..8898e09 100644
--- a/lib/blackberry/plugin/qnx/device.js
+++ b/lib/blackberry/plugin/qnx/device.js
@@ -33,7 +33,7 @@ module.exports = {
             model: "Dev Alpha",
             name: "Dev Alpha", // deprecated: please use device.model
             uuid: blackberry.identity.uuid,
-            cordova: "2.7.0rc1"
+            cordova: CORDOVA_JS_BUILD_LABEL
         });
 
         return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "Device info returned"
};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/27734156/lib/common/plugin/device.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/device.js b/lib/common/plugin/device.js
index 6dd4d85..73e9de9 100644
--- a/lib/common/plugin/device.js
+++ b/lib/common/plugin/device.js
@@ -45,12 +45,16 @@ function Device() {
 
     channel.onCordovaReady.subscribe(function() {
         me.getInfo(function(info) {
+            var buildLabel = info.cordova;
+            if (buildLabel != CORDOVA_JS_BUILD_LABEL) {
+                buildLabel += ' JS=' + CORDOVA_JS_BUILD_LABEL;
+            }
             me.available = true;
             me.platform = info.platform;
             me.version = info.version;
             me.name = info.name;
             me.uuid = info.uuid;
-            me.cordova = info.cordova;
+            me.cordova = buildLabel;
             me.model = info.model;
             channel.onCordovaInfoReady.fire();
         },function(e) {

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/27734156/lib/firefoxos/plugin/firefoxos/device.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/plugin/firefoxos/device.js b/lib/firefoxos/plugin/firefoxos/device.js
index 5d9d36b..7de2209 100644
--- a/lib/firefoxos/plugin/firefoxos/device.js
+++ b/lib/firefoxos/plugin/firefoxos/device.js
@@ -33,7 +33,7 @@ module.exports = {
             model: "Beta Phone",
             name: "Beta Phone", // deprecated: please use device.model
             uuid: "somestring",
-            cordova: "2.4.0rc1"
+            cordova: CORDOVA_JS_BUILD_LABEL
         });
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/27734156/lib/tizen/plugin/tizen/Device.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Device.js b/lib/tizen/plugin/tizen/Device.js
index a6a6e94..75b12fe 100644
--- a/lib/tizen/plugin/tizen/Device.js
+++ b/lib/tizen/plugin/tizen/Device.js
@@ -29,7 +29,7 @@ function Device() {
     this.version = null;
     this.uuid = null;
     this.name = null;
-    this.cordova = "2.7.0rc1";
+    this.cordova = CORDOVA_JS_BUILD_LABEL;
     this.platform = "Tizen";
 
     var me = this;

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/27734156/lib/windows8/plugin/windows8/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/DeviceProxy.js b/lib/windows8/plugin/windows8/DeviceProxy.js
index 5aa0819..cf442e3 100644
--- a/lib/windows8/plugin/windows8/DeviceProxy.js
+++ b/lib/windows8/plugin/windows8/DeviceProxy.js
@@ -50,7 +50,7 @@ module.exports = {
         }
 
         setTimeout(function () {
-            win({ platform: "windows8", version: "8", name: name, uuid: deviceId, cordova:
"2.7.0rc1" });
+            win({ platform: "windows8", version: "8", name: name, uuid: deviceId, cordova:
CORDOVA_JS_BUILD_LABEL });
         }, 0);
     }
 


Mime
View raw message