cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [5/5] js commit: CB-9156 added ability to pass in custom path via command line for platforms
Date Sat, 20 Jun 2015 01:45:54 GMT
CB-9156 added ability to pass in custom path via command line for platforms


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

Branch: refs/heads/master
Commit: b08a012c77cbc5f49d4d0a9e05f666b70dd48b49
Parents: 9ade05c
Author: Steve Gill <stevengill97@gmail.com>
Authored: Wed Jun 10 20:01:16 2015 -0700
Committer: Steve Gill <stevengill97@gmail.com>
Committed: Fri Jun 19 18:44:37 2015 -0700

----------------------------------------------------------------------
 README.md             |  8 +++++++-
 tasks/compile.js      |  9 ++++++++-
 tasks/lib/bundle.js   | 12 ++----------
 tasks/lib/packager.js |  6 +++---
 4 files changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/b08a012c/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 3a51a3e..6c74955 100644
--- a/README.md
+++ b/README.md
@@ -61,14 +61,20 @@ All of the build tasks can be run via the `grunt` node module. Install
it global
 
     sudo npm install -g grunt-cli
 
+`grunt compile` task assumes that users have cordova-platforms as siblings to this cordova.js
directory. When generating cordova.js, `grunt compile` will grab platform specific files from
these directories if they exist. The default locations are defined in `package.json`.
+
 Then from the repository root run:
 
-    grunt --platformVersion=4.0.0
+    grunt 
 
 To compile the js for just one platform, run:
 
     grunt compile:android --platformVersion=4.0.0
 
+To comiple the js for all platforms but pass in a relative path custom root for your cordova-android
and cordova-ios platforms, run:
+
+    grunt compile --android='../custompath/cordova-android' --ios='../custompath/cordova-ios'
+
 To create the browserify version of the js, run:
 
     grunt compile-browserify --platformVersion=4.0.0

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/b08a012c/tasks/compile.js
----------------------------------------------------------------------
diff --git a/tasks/compile.js b/tasks/compile.js
index fd7d897..c86a62d 100644
--- a/tasks/compile.js
+++ b/tasks/compile.js
@@ -31,11 +31,18 @@ module.exports = function(grunt) {
         //grabs --platformVersion flag
         var flags = grunt.option.flags();
         var platformVersion;
+        var platformPath = undefined;
         flags.forEach(function(flag) {
             if (flag.indexOf('platformVersion') > -1) {
                 var equalIndex = flag.indexOf('=');
                 platformVersion = flag.slice(equalIndex + 1);
             }
+
+            if (flag.indexOf(platformName) > -1) {
+                var equalIndex = flag.indexOf('=');
+                platformPath = flag.slice(equalIndex + 1);
+                console.log(platformPath);
+            }
         });
         if(!platformVersion) {
             //grab platformVersion from sibling platform directoreis
@@ -46,6 +53,6 @@ module.exports = function(grunt) {
                 platformVersion="N/A";
             }
         }
-        generate(platformName, useWindowsLineEndings, platformVersion, done);
+        generate(platformName, useWindowsLineEndings, platformVersion, platformPath, done);
     });
 }

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/b08a012c/tasks/lib/bundle.js
----------------------------------------------------------------------
diff --git a/tasks/lib/bundle.js b/tasks/lib/bundle.js
index a991614..34bffeb 100644
--- a/tasks/lib/bundle.js
+++ b/tasks/lib/bundle.js
@@ -25,9 +25,6 @@ var writeScript  = require('./write-script');
 var licensePath  = path.join(__dirname, '..', 'templates', 'LICENSE-for-js-file.txt');
 var pkgJson      = require(process.cwd()+'/package.json');
 
-console.log(__dirname);
-//console.log(pkgJson);
-
 module.exports = function bundle(platform, debug, commitId, platformVersion, platformPath)
{
     var modules = collectFiles(path.join('src', 'common'));
     var scripts = collectFiles(path.join('src', 'scripts'));
@@ -36,20 +33,17 @@ module.exports = function bundle(platform, debug, commitId, platformVersion,
pla
 
     //Use passed in platformPath if it exists
     if(platformPath) {
-        //USE PLATFORM PATH passed in
-
+        platformDep = path.join(process.cwd(), platformPath);
     //see if platform location exists in package.json
     } else if(pkgJson['cordova-platforms']['cordova-'+platform]){
         platformDep = path.join(process.cwd(), pkgJson['cordova-platforms']['cordova-'+platform]);
     } else {
         platformDep = undefined;
     }
-    console.log(platform +' '+ platformDep)
-    console.log(process.cwd());
+
     //check to see if platform dependency has cordova-js-src directory
     if(fs.existsSync(platformDep) && fs.existsSync(path.join(platformDep, 'cordova-js-src')))
{
         copyProps(modules, collectFiles(path.join(platformDep, 'cordova-js-src')));
-        console.log('using sibiling directories');
     } else {
         if(platform !== 'test') {
             //for platforms that don't have a release with cordova-js-src yet
@@ -66,7 +60,6 @@ module.exports = function bundle(platform, debug, commitId, platformVersion,
pla
         if(fs.existsSync(path.join(process.cwd(), pkgJson['cordova-platforms']['cordova-android'])))
{
             testFilesPath = path.join(process.cwd(), pkgJson['cordova-platforms']['cordova-android'],
'cordova-js-src', 'android');
             modules['android/exec'] = path.join(process.cwd(), pkgJson['cordova-platforms']['cordova-android'],
'cordova-js-src', 'exec.js');
-            console.log('android test sibling');
         } else {
             testFilesPath = path.join('src', 'legacy-exec', 'android');
             modules['android/exec'] = path.join('src', 'legacy-exec', 'android', 'exec.js');
@@ -76,7 +69,6 @@ module.exports = function bundle(platform, debug, commitId, platformVersion,
pla
         //Add iOS platform-specific modules that have tests for the test bundle.
         if(fs.existsSync(path.join(process.cwd(), pkgJson['cordova-platforms']['cordova-ios'])))
{
             modules['ios/exec'] = path.join(process.cwd(), pkgJson['cordova-platforms']['cordova-ios'],
'cordova-js-src', 'exec.js');
-            console.log('ios test sibiling');
         } else {
             modules['ios/exec'] = path.join('src', 'legacy-exec', 'ios', 'exec.js');
         }

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/b08a012c/tasks/lib/packager.js
----------------------------------------------------------------------
diff --git a/tasks/lib/packager.js b/tasks/lib/packager.js
index 7aba70f..5461773 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, platformVersion, callback)
{
+module.exports = function generate(platform, useWindowsLineEndings, platformVersion, platformPath,
callback) {
     computeCommitId(function(commitId) {
         var outFile;
         var time = new Date().valueOf();
 
-        var libraryRelease = bundle(platform, false, commitId, platformVersion);
+        var libraryRelease = bundle(platform, false, commitId, platformVersion, platformPath);
         // 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, platformVersion);
+        var libraryDebug   = bundle(platform, true, commitId, platformVersion, platformPath);
 
         time = new Date().valueOf() - time;
         if (!fs.existsSync('pkg')) {


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


Mime
View raw message