You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2014/05/15 20:37:14 UTC

[1/2] git commit: CB-5751 FirefoxOS build issue (untested, as I have no Windows. coppied from version.bat, so it shoud be a no-brainer)

Repository: cordova-firefoxos
Updated Branches:
  refs/heads/3.5.x d8c99f9d6 -> 27a505695


CB-5751 FirefoxOS build issue
(untested, as I have no Windows. coppied from version.bat, so it shoud be a no-brainer)


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

Branch: refs/heads/3.5.x
Commit: ef309055aaa12b27772f7eddcb6de4079e4d1e8f
Parents: d8c99f9
Author: braas <br...@steckelfisch.nl>
Authored: Thu Feb 13 11:53:53 2014 +0100
Committer: Steven Gill <st...@gmail.com>
Committed: Thu May 15 11:36:28 2014 -0700

----------------------------------------------------------------------
 bin/templates/project/cordova/build.bat | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/ef309055/bin/templates/project/cordova/build.bat
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/build.bat b/bin/templates/project/cordova/build.bat
new file mode 100644
index 0000000..02641bc
--- /dev/null
+++ b/bin/templates/project/cordova/build.bat
@@ -0,0 +1,26 @@
+:: Licensed to the Apache Software Foundation (ASF) under one
+:: or more contributor license agreements.  See the NOTICE file
+:: distributed with this work for additional information
+:: regarding copyright ownership.  The ASF licenses this file
+:: to you under the Apache License, Version 2.0 (the
+:: "License"); you may not use this file except in compliance
+:: with the License.  You may obtain a copy of the License at
+::
+:: http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing,
+:: software distributed under the License is distributed on an
+:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+:: KIND, either express or implied.  See the License for the
+:: specific language governing permissions and limitations
+:: under the License.
+
+@ECHO OFF
+SET script_path="%~dp0build"
+IF EXIST %script_path% (
+        node %script_path% %*
+) ELSE (
+    ECHO.
+    ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2
+    EXIT /B 1
+)


[2/2] git commit: Simplifies build for firefoxos

Posted by st...@apache.org.
Simplifies build for firefoxos


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

Branch: refs/heads/3.5.x
Commit: 27a505695a2407974d3d845b8eb0fb3ae2328603
Parents: ef30905
Author: Rodrigo Silveira <ro...@outlook.com>
Authored: Wed May 14 20:30:10 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu May 15 11:36:54 2014 -0700

----------------------------------------------------------------------
 bin/templates/project/cordova/build        |  25 +----
 bin/templates/project/cordova/lib/build.js | 129 +++---------------------
 2 files changed, 19 insertions(+), 135 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/27a50569/bin/templates/project/cordova/build
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/build b/bin/templates/project/cordova/build
index 51f43c5..64b68f4 100755
--- a/bin/templates/project/cordova/build
+++ b/bin/templates/project/cordova/build
@@ -20,33 +20,14 @@
 */
 
 
-var path = require('path'),
-    build = require('./lib/build'),
-    reqs  = require('./lib/check_reqs'),
+var build = require('./lib/build'),
     args  = process.argv;
 
 // provide help
-if ( args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
+if ( args[2] == '--help' || args[2] == '/?' || args[2] == '-h' || args[2] == '/h' ||
                     args[2] == 'help' || args[2] == '-help' || args[2] == '/help') {
     build.help();
     process.exit(0);
-}
-
-// check for the correct argument count, the correct options
-if (  (args.length > 3)
-   || (args[2] && (   (args[2] != '--debug') 
-                   && (args[2] != '--release')))) {
-      console.error('please only use --debug or --release as argument');
-      build.help();
-      process.exit(2);
 } else {
-    var buildOpt     = 'debug';
-    //var buildTypeOpt = 'web';
-    if(args[2] && args[2] == '--release') {
-        buildOpt = 'release'
-    }
-
-    build.buildProject(buildOpt);
+    build.buildProject();
 }
-
-

http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/27a50569/bin/templates/project/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/project/cordova/lib/build.js b/bin/templates/project/cordova/lib/build.js
index 73fbedd..89f3621 100644
--- a/bin/templates/project/cordova/lib/build.js
+++ b/bin/templates/project/cordova/lib/build.js
@@ -25,79 +25,15 @@ var path = require('path'),
     shjs = require('shelljs'),
     zip = require('adm-zip'),
     check_reqs = require('./check_reqs'),
-    buildReleaseDirInMerge  = 'build--release',
     platformWwwDir          = path.join('platforms', 'firefoxos', 'www'),
     platformBuildDir        = path.join('platforms', 'firefoxos', 'build'),
-    buildReleaseDirInWwwDir = path.join(platformWwwDir, buildReleaseDirInMerge);
-
-function hasMergesCustomReleaseArtifactsDir() {
-    return fs.existsSync(path.join('merges', 'firefoxos', buildReleaseDirInMerge));
-}
-
-function hasCustomReleaseArtifactsDir() {
-    return fs.existsSync(path.join(platformWwwDir,buildReleaseDirInMerge));
-}
-
-/**
- * hasAllMergesRequiredCustomReleaseArtifacts()
- * checks that merges/firefoxos/build--release is avialable and properly filled.
- *
- */
-function hasAllRequiredCustomReleaseArtifacts() {
-    var mergeDir = path.join('merges', 'firefoxos', buildReleaseDirInMerge);
-    if (!fs.existsSync( path.join(mergeDir, 'manifest.webapp'))) { 
-        console.error('\nPlease provide <project> '+mergeDir+'/manifest.webapp');
-    }
-
-    if (!fs.existsSync( path.join(mergeDir, 'index.html'))) {
-        console.error('\nPlease provide <project> '+mergeDir+'/index.html');
-    }
-
-    return (   fs.existsSync( path.join(mergeDir, 'manifest.webapp'))
-            && fs.existsSync( path.join(mergeDir, 'index.html')) );
-}
-
-/**
- * hasCopiedRequiredCustomReleaseArtifacts()
- * checks that 'cordova prepare' has copied merges/firefoxos to platforms/firefoxos/www
- *
- */
-function hasCopiedAllRequiredCustomReleaseArtifacts() {
-    if (!fs.existsSync( path.join(buildReleaseDirInWwwDir, 'manifest.webapp'))) { 
-        console.error('\n'+path.join(buildReleaseDirInWwwDir, 'manifest.webapp')+' is not found');
-    }
-
-    if (!fs.existsSync( path.join(buildReleaseDirInWwwDir, 'index.html'))) {
-        console.error('\n'+path.join(buildReleaseDirInWwwDir, 'index.html')+' is not found');
-    }
-
-    return (   fs.existsSync( path.join(buildReleaseDirInWwwDir, 'manifest.webapp'))
-            && fs.existsSync( path.join(buildReleaseDirInWwwDir, 'index.html')) );
-}
-
-function moveWwwBuildReleaseToBuild() {
-    hasAllRequiredCustomReleaseArtifacts();
-    
-    shjs.mv('-f', path.join(buildReleaseDirInWwwDir, 'index.html'),       path.join(platformBuildDir, 'index.html'));
-    shjs.mv('-f' ,path.join(buildReleaseDirInWwwDir, 'manifest.webapp'),  path.join(platformBuildDir, 'manifest.webapp'));
-}
-
-// cordova merges merge/firefoxos to platforms/firefoxos/www
-// this removes the 'build--release' directory from platforms/firefoxos/www
-function removeWwwBuildRelease() {
-    if (fs.existsSync(buildReleaseDirInWwwDir)) {
-        shjs.rm('-r', buildReleaseDirInWwwDir);
-    }
-}
+    packageFile             = path.join(platformBuildDir, 'package.zip');
 
 /**
  * buildProject
- *   --debug (default):      
- *
- *   --release
- *
+ *   Creates a zip file int platform/build folder
  */
-exports.buildProject = function(buildTarget){
+exports.buildProject = function(){
 
     // Check that requirements are (stil) met
     if (!check_reqs.run()) {
@@ -106,55 +42,22 @@ exports.buildProject = function(buildTarget){
     }
     
     clean.cleanProject(); // remove old build result
-    
-    // if 'debug' (default), remove files we only need for 'release'
-    if (buildTarget == 'debug') {
-        if(hasCustomReleaseArtifactsDir()){ 
-            removeWwwBuildRelease();
-        }
-        process.exit(0);
-    }
-
-    if (buildTarget == 'release') {
-        console.log('Building Firefoxos project in '+platformBuildDir);
-
-        if (!hasAllRequiredCustomReleaseArtifacts()) {
-               console.error('\nCheck \'https://developer.mozilla.org/en-US/Marketplace/Publishing/Packaged_apps\' for the required artifacts');
-               console.error('\n');
-               process.exit(2);
-        }
-
-        if (!hasCopiedAllRequiredCustomReleaseArtifacts()) {
-               console.error('\nIf merges/firefoxos/build-release has proper content, make sure \'cordova prepare firefoxos\' is run.');
-               console.error('\n');
-               process.exit(2);
-        }
 
-        if (!fs.existsSync(platformBuildDir)) {
-            fs.mkdir(platformBuildDir); 
-        }
-
-        moveWwwBuildReleaseToBuild();
-        removeWwwBuildRelease(); 
+    if (!fs.existsSync(platformBuildDir)) {
+        fs.mkdirSync(platformBuildDir);
+    }
 
-        // add the project to a zipfile
-        var zipFile = zip();
-        zipFile.addLocalFolder(platformWwwDir, '.');
-        zipFile.writeZip(path.join(platformBuildDir, 'package.zip'));
+    // add the project to a zipfile
+    var zipFile = zip();
+    zipFile.addLocalFolder(platformWwwDir, '.');
+    zipFile.writeZip(packageFile);
 
-        process.exit(0);
-    }
+    console.log('Firefox OS packaged app built in '+ packageFile);
 
-    // should never get here
-    console.error('Illegal target to build a firefoxos cordova project ('+buildTarget+')');
-    process.exit(2);
-}
+    process.exit(0);
+};
 
 module.exports.help = function() {
-    console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'build')) + ' [build_type]');
-    console.log('Build Types : ');
-    console.log('    \'--debug\': Default build.');
-    console.log('    \'--release\': will build a zip-file of the project in \''+platformBuildDir+'\'.');
-    console.log('                  Please provide manifest.webapp and index.html in '+path.join('merges', 'firefoxos', buildReleaseDirInMerge));
-}
-
+    console.log('Usage: cordova build firefoxos');
+    console.log('Build will create the packaged app in \''+platformBuildDir+'\'.');
+};