cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [1/2] wp7 commit: Fixed up dev scripts to work with cordova-cli
Date Fri, 15 Mar 2013 00:31:28 GMT
Fixed up dev scripts to work with cordova-cli


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

Branch: refs/heads/master
Commit: 081963443c242e678a4f6b7dab284a1694e71cbb
Parents: b1f4e54
Author: Benn Mapes <benn.mapes@gmail.com>
Authored: Fri Mar 1 14:03:01 2013 -0800
Committer: Benn Mapes <benn.mapes@gmail.com>
Committed: Thu Mar 14 14:14:40 2013 -0700

----------------------------------------------------------------------
 bin/create.js                            |   85 +++++++++++++++----------
 framework/WPCordovaClassLib.csproj       |    4 +-
 templates/full/cordova/debug.bat         |   86 +++++-------------------
 templates/full/cordova/emulate.bat       |   42 +++++-------
 templates/standalone/cordova/debug.bat   |   86 +++++-------------------
 templates/standalone/cordova/emulate.bat |   42 +++++-------
 tooling/scripts/buildjs.js               |   56 +++++++++++++---
 tooling/scripts/deploy.js                |   32 +++++++--
 tooling/scripts/dist.js                  |   45 +++++++++----
 tooling/scripts/new.js                   |   27 +++-----
 tooling/scripts/package.js               |   26 +++++---
 tooling/scripts/reversion.js             |   75 +++++++++++++++++-----
 tooling/scripts/win-zip.js               |    2 +-
 13 files changed, 313 insertions(+), 295 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/08196344/bin/create.js
----------------------------------------------------------------------
diff --git a/bin/create.js b/bin/create.js
index bc2f5d9..727eefd 100644
--- a/bin/create.js
+++ b/bin/create.js
@@ -28,7 +28,10 @@ var args = WScript.Arguments,
     // sub folder for full project
     FULL_PATH = TEMPLATES_PATH + '\\full',
     // default template to use when creating the project
-    CREATE_TEMPLATE = STANDALONE_PATH;
+    CREATE_TEMPLATE = STANDALONE_PATH,
+    PROJECT_PATH,
+    PACKAGE,
+    NAME;
 
 // working dir
 var ROOT = WScript.ScriptFullName.split('\\bin\\create.js').join('');
@@ -36,12 +39,13 @@ var ROOT = WScript.ScriptFullName.split('\\bin\\create.js').join('');
 function Usage()
 {
 
-    WScript.StdOut.WriteLine("Usage: create [ PathTONewProject ProjectName ]");
+    WScript.StdOut.WriteLine("Usage: create PathTONewProject [ PackageName AppName ]");
     WScript.StdOut.WriteLine("    PathTONewProject : The path to where you wish to create
the project");
-    WScript.StdOut.WriteLine("    ProjectName : The name of the project (default is CordovaAppProj)");
+    WScript.StdOut.WriteLine("    PackageName      : The namespace for the project (default
is CordovaAppProj)")
+    WScript.StdOut.WriteLine("    AppName          : The name of the application (default
is CordovaAppProj)");
     WScript.StdOut.WriteLine("examples:");
     WScript.StdOut.WriteLine("    create C:\\Users\\anonymous\\Desktop\\MyProject");
-    WScript.StdOut.WriteLine("    create C:\\Users\\anonymous\\Desktop\\MyProject AnApplication");
+    WScript.StdOut.WriteLine("    create C:\\Users\\anonymous\\Desktop\\MyProject io.Cordova.Example
AnApp");
 }
 
 var ForReading = 1, ForWriting = 2, ForAppending = 8;
@@ -98,11 +102,12 @@ function genGuid()
 }
 
 // creates a project from the standalone template
-function create(path, name)
+function create(path, namespace, name)
 {
     WScript.StdOut.WriteLine("Creating Cordova-WP7 Project:");
-    WScript.StdOut.WriteLine("\tName : " + name);
-    WScript.StdOut.WriteLine("\tDirectory : " + path);
+    WScript.StdOut.WriteLine("\tApp Name : " + name);
+    WScript.StdOut.WriteLine("\tNamespace : " + namespace);
+    WScript.StdOut.WriteLine("\tPath : " + path);
 
     fso.CreateFolder(path);
 
@@ -111,7 +116,7 @@ function create(path, name)
     var sourceItems = shell.NameSpace(ROOT + CREATE_TEMPLATE).items();
     if (dest != null)
     {
-        dest.CopyHere(sourceItems);
+        dest.CopyHere(sourceItems, 4|20);
         WScript.Sleep(1000);
     }
     else
@@ -136,49 +141,61 @@ function create(path, name)
     replaceInFile(path + "\\Properties\\WMAppManifest.xml", /\$guid1\$/, newProjGuid);
     // replace safe-project-name in all files
     replaceInFile(path + "\\Properties\\WMAppManifest.xml",/\$safeprojectname\$/g, name);
-    replaceInFile(path + "\\App.xaml",/\$safeprojectname\$/g, name);
-    replaceInFile(path + "\\App.xaml.cs",/\$safeprojectname\$/g, name);
-    replaceInFile(path + "\\CordovaAppProj.csproj",/\$safeprojectname\$/g, name);
-    replaceInFile(path + "\\MainPage.xaml",/\$safeprojectname\$/g, name);
-    replaceInFile(path + "\\MainPage.xaml.cs",/\$safeprojectname\$/g, name);
 
+    replaceInFile(path + "\\App.xaml",/\$safeprojectname\$/g, namespace);
+    replaceInFile(path + "\\App.xaml.cs",/\$safeprojectname\$/g, namespace);
+    replaceInFile(path + "\\CordovaAppProj.csproj",/\$safeprojectname\$/g, namespace);
+    replaceInFile(path + "\\MainPage.xaml",/\$safeprojectname\$/g, namespace);
+    replaceInFile(path + "\\MainPage.xaml.cs",/\$safeprojectname\$/g, namespace);
+
+    //set up debug + emulate paths
+    replaceInFile(path + "\\cordova\\debug.bat",/__PATH_TO_TOOLING_SCRIPTS__/g, ROOT + '\\tooling\\scripts');
+    replaceInFile(path + "\\cordova\\emulate.bat",/__PATH_TO_TOOLING_SCRIPTS__/g, ROOT +
'\\tooling\\scripts');
+    replaceInFile(path + "\\cordova\\debug.bat",/__PATH_TO_PROJ__/g, path);
+    replaceInFile(path + "\\cordova\\emulate.bat",/__PATH_TO_PROJ__/g, path);
     WScript.StdOut.WriteLine("CREATE SUCCESS.");
 
 }
 
 
-
 if(args.Count() > 0)
 {
     // support help flags
     if(args(0) == "--help" || args(0) == "/?" ||
-            args(0) == "help" || args(0) == "-help" || args(0) == "/help")
+            args(0) == "help" || args(0) == "-help" || args(0) == "/help" || args(0) == "-h")
     {
         Usage();
         WScript.Quit(1);
     }
+
+    PROJECT_PATH = args(0);
+    if(fso.FolderExists(PROJECT_PATH))
+    {
+        WScript.StdOut.WriteLine("Project directory already exists:");
+        WScript.StdOut.WriteLine("\t" + PROJECT_PATH);
+        WScript.StdOut.WriteLine("CREATE FAILED.");
+        WScript.Quit(1);
+    }
+
+    if(args.Count() > 1)
+    {
+        PACKAGE = args(1);
+    }
     else
     {
-        PROJECT_PATH = args(0);
-        if(fso.FolderExists(PROJECT_PATH))
-        {
-            WScript.StdOut.WriteLine("Project directory already exists:");
-            WScript.StdOut.WriteLine("\t" + PROJECT_PATH);
-            Wscript.StdOut.WriteLine("BUILD FAILED.");
-            Wscript.Quit(1);
-        }
-        else
-        {
-            if(args.Count() > 1)
-            {
-                create(PROJECT_PATH, args(1));
-            }
-            else
-            {
-                create(PROJECT_PATH, "CordovaAppProj");
-            }
-        }
+        PACKAGE = "CordovaAppProj";
+    }
+
+    if(args.Count() > 2)
+    {
+        NAME = args(2);
     }
+    else
+    {
+        NAME = "CordovaAppProj";
+    }
+
+    create(PROJECT_PATH, PACKAGE, NAME);
 }
 else
 {

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/08196344/framework/WPCordovaClassLib.csproj
----------------------------------------------------------------------
diff --git a/framework/WPCordovaClassLib.csproj b/framework/WPCordovaClassLib.csproj
index 85ec759..846bfdf 100644
--- a/framework/WPCordovaClassLib.csproj
+++ b/framework/WPCordovaClassLib.csproj
@@ -287,8 +287,8 @@
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">
     <AssemblyInfo
-      AssemblyVersion="  "
-      AssemblyFileVersion="$(VersionNumber)"
+      AssemblyVersion="$(BaseVersion)"
+      AssemblyFileVersion="$(BaseVersion)"
       AssemblyDescription="$(VersionNumber)"
     >
     </AssemblyInfo>

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/08196344/templates/full/cordova/debug.bat
----------------------------------------------------------------------
diff --git a/templates/full/cordova/debug.bat b/templates/full/cordova/debug.bat
index 4efc80c..649e515 100644
--- a/templates/full/cordova/debug.bat
+++ b/templates/full/cordova/debug.bat
@@ -1,68 +1,18 @@
-
-@echo off
-goto start
-
-
-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.
-
-:start
-
-
-if /i "%1"=="help" goto usage
-if /i "%1"=="-help" goto usage
-if /i "%1"=="--help" goto usage
-if /i "%1"=="/help" goto usage
-if /i "%1"=="/?" goto usage
-
-
-if defined VCINSTALLDIR goto start-msbuild
-if not defined VS100COMNTOOLS goto msbuild-missing
-if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-missing
-call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat"
-if not defined VCINSTALLDIR goto msbuild-missing
-goto start-msbuild
-
-
-:builderror
-echo Error level 1
-goto exit
-
-:msbuild-missing
-echo Error! Cannot run msbuild from this command prompt.  Try running a VS Command prompt.
-goto exit
-
-
-:start-msbuild
-cd ..
-msbuild /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo /p:Configuration=Debug
-cd cordova
-if errorlevel 1 goto builderror
-goto deploy
-
-:usage
-echo "Usage: %0"
-echo "solution file is expected to be in the parent folder."
-goto exit
-
-:deploy
-CordovaDeploy ../Bin/Debug -d:1
-
-
-:exit
-
-
+:: 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
+cscript "__PATH_TO_TOOLING_SCRIPTS__\deploy.js" __PATH_TO_PROJ__ -debug //nologo
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/08196344/templates/full/cordova/emulate.bat
----------------------------------------------------------------------
diff --git a/templates/full/cordova/emulate.bat b/templates/full/cordova/emulate.bat
index b3375fe..fbf9da2 100644
--- a/templates/full/cordova/emulate.bat
+++ b/templates/full/cordova/emulate.bat
@@ -1,24 +1,18 @@
-
-@echo off
-goto start
-
-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.
-
-
-:start
-CordovaDeploy ../Bin/Debug -d:1
\ No newline at end of file
+:: 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
+cscript "__PATH_TO_TOOLING_SCRIPTS__\deploy.js" __PATH_TO_PROJ__ -emulate //nologo
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/08196344/templates/standalone/cordova/debug.bat
----------------------------------------------------------------------
diff --git a/templates/standalone/cordova/debug.bat b/templates/standalone/cordova/debug.bat
index 4efc80c..649e515 100644
--- a/templates/standalone/cordova/debug.bat
+++ b/templates/standalone/cordova/debug.bat
@@ -1,68 +1,18 @@
-
-@echo off
-goto start
-
-
-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.
-
-:start
-
-
-if /i "%1"=="help" goto usage
-if /i "%1"=="-help" goto usage
-if /i "%1"=="--help" goto usage
-if /i "%1"=="/help" goto usage
-if /i "%1"=="/?" goto usage
-
-
-if defined VCINSTALLDIR goto start-msbuild
-if not defined VS100COMNTOOLS goto msbuild-missing
-if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-missing
-call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat"
-if not defined VCINSTALLDIR goto msbuild-missing
-goto start-msbuild
-
-
-:builderror
-echo Error level 1
-goto exit
-
-:msbuild-missing
-echo Error! Cannot run msbuild from this command prompt.  Try running a VS Command prompt.
-goto exit
-
-
-:start-msbuild
-cd ..
-msbuild /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo /p:Configuration=Debug
-cd cordova
-if errorlevel 1 goto builderror
-goto deploy
-
-:usage
-echo "Usage: %0"
-echo "solution file is expected to be in the parent folder."
-goto exit
-
-:deploy
-CordovaDeploy ../Bin/Debug -d:1
-
-
-:exit
-
-
+:: 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
+cscript "__PATH_TO_TOOLING_SCRIPTS__\deploy.js" __PATH_TO_PROJ__ -debug //nologo
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/08196344/templates/standalone/cordova/emulate.bat
----------------------------------------------------------------------
diff --git a/templates/standalone/cordova/emulate.bat b/templates/standalone/cordova/emulate.bat
index b3375fe..fbf9da2 100644
--- a/templates/standalone/cordova/emulate.bat
+++ b/templates/standalone/cordova/emulate.bat
@@ -1,24 +1,18 @@
-
-@echo off
-goto start
-
-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.
-
-
-:start
-CordovaDeploy ../Bin/Debug -d:1
\ No newline at end of file
+:: 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
+cscript "__PATH_TO_TOOLING_SCRIPTS__\deploy.js" __PATH_TO_PROJ__ -emulate //nologo
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/08196344/tooling/scripts/buildjs.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/buildjs.js b/tooling/scripts/buildjs.js
index 8d50e2c..d425e15 100644
--- a/tooling/scripts/buildjs.js
+++ b/tooling/scripts/buildjs.js
@@ -37,7 +37,8 @@ var args = WScript.Arguments,
     //Git Repositories
     CORDOVA_JS = "git://github.com/apache/cordova-js.git",
     // get version
-    VERSION = read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,'');
+    VERSION = read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,''),
+    BUILD_DESTINATION;
 
 
 // help function
@@ -52,6 +53,7 @@ function Usage()
     WScript.StdOut.WriteLine("examples:");
     WScript.StdOut.WriteLine("    buildjs 2.5.0rc1  //Puts cordova-2.5.0rc1 as the cordova.js
in the current working directory");
     WScript.StdOut.WriteLine("    buildjs 2.4.0 C:\\Users\\anonymous\\Desktop\\cordova-wp7
 //Puts cordova-2.4.0.js in the given directory");
+    WScript.StdOut.WriteLine("    buildjs //Builds the version of cordova.js from the root
folder and adds it to the working directory repo");
     WScript.StdOut.WriteLine("");
 }
 
@@ -77,18 +79,34 @@ function read(filename) {
 function exec(command) {
     var oShell=wscript_shell.Exec(command);
     while (oShell.Status == 0) {
+        WScript.sleep(100);
+    }
+}
+
+// executes a commmand in the shell
+function exec_verbose(command) {
+    //WScript.StdOut.WriteLine("Command: " + command);
+    var oShell=wscript_shell.Exec(command);
+    while (oShell.Status == 0) {
+        //Wait a little bit so we're not super looping
+        WScript.sleep(100);
+        //Print any stdout output from the script
         if(!oShell.StdOut.AtEndOfStream) {
             var line = oShell.StdOut.ReadLine();
-            // XXX: Change to verbose mode
-            // WScript.StdOut.WriteLine(line);
+            WScript.StdOut.WriteLine(line);
         }
-        WScript.sleep(100);
+    }
+    //Check to make sure our scripts did not encounter an error
+    if(!oShell.StdErr.AtEndOfStream)
+    {
+        var line = oShell.StdErr.ReadAll();
+        WScript.StdErr.WriteLine(line);
+        WScript.Quit(1);
     }
 }
 
 function build_js(path)
 {
-    WScript.StdOut.WriteLine("Creating cordova.js...");
     if(fso.FolderExists(path + '\\temp'))
     {
         fso.DeleteFolder(path + '\\temp', true);
@@ -97,12 +115,23 @@ function build_js(path)
     wscript_shell.CurrentDirectory = path + '\\temp';
 
     WScript.StdOut.WriteLine('\tCloning js tagged with ' + VERSION + '...');
-    exec('%comspec% /c git clone ' + CORDOVA_JS + ' && cd cordova-js && git
fetch --tags && git checkout ' + VERSION );
-
-    // build and copy over cordova.js
-    WScript.StdOut.WriteLine("\tBuilding Cordova.js...");
+    exec('%comspec% /c git clone ' + CORDOVA_JS + ' && cd cordova-js && git
fetch && git checkout ' + VERSION );
+    if(!fso.FolderExists(path + '\\temp\\cordova-js'))
+    {
+        WScript.StdErr.WriteLine("ERROR: Failed to clone cordova-js. Aborting...");
+        WScript.Quit(1);
+    }
     wscript_shell.CurrentDirectory = path + '\\temp\\cordova-js';
-    exec('%comspec% /c jake build');
+    WScript.StdOut.WriteLine("Building Cordova.js...");
+
+    exec_verbose('%comspec% /c jake build');
+    if(!fso.FolderExists(path + '\\temp\\cordova-js\\pkg'))
+    {
+        WScript.StdErr.WriteLine("ERROR: Failed to build cordova-js. Aborting...");
+        WScript.Quit(1);
+    }
+
+    //copy the javascript wherever it needs to go.
     wscript_shell.CurrentDirectory = path + '\\temp\\cordova-js\\pkg';
     exec('%comspec% /c copy cordova.windowsphone.js ' + path + STANDALONE_PATH + '\\www\\cordova-'
+ VERSION + '.js');
     exec('%comspec% /c copy cordova.windowsphone.js ' + path + FULL_PATH + '\\www\\cordova-'
+ VERSION + '.js');
@@ -110,7 +139,7 @@ function build_js(path)
 
     //TODO: Delete old cordova.js
 
-    WScript.StdOut.WriteLine("DONE.");
+    WScript.StdOut.WriteLine("SUCESS");
 }
 
 function set_path(some_arg)
@@ -156,6 +185,10 @@ if(args.Count() > 0)
     if(args(0).match(/(\d+)[.](\d+)[.](\d+)(rc\d)?/))
     {
         VERSION = args(0);
+        if(args.Count()  == 1)
+        {
+            BUILD_DESTINATION = ROOT;
+        }
     }
     else if(set_path(arg(0))) {} //do nothing
     else
@@ -172,4 +205,5 @@ else
 }
 
 //If we haven't quit by here, build the damn javascript!
+WScript.StdOut.WriteLine("Creating js for " + BUILD_DESTINATION);
 build_js(BUILD_DESTINATION);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/08196344/tooling/scripts/deploy.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/deploy.js b/tooling/scripts/deploy.js
index 6318ada..dd5492e 100644
--- a/tooling/scripts/deploy.js
+++ b/tooling/scripts/deploy.js
@@ -48,16 +48,32 @@ var TristateUseDefault = 2, TristateTrue = 1, TristateFalse = 0;
 
 
 // executes a commmand in the shell
-function exec(command, output) {
+function exec(command) {
     var oShell=wscript_shell.Exec(command);
     while (oShell.Status == 0) {
+        WScript.sleep(100);
+    }
+}
+
+// executes a commmand in the shell
+function exec_verbose(command) {
+    //WScript.StdOut.WriteLine("Command: " + command);
+    var oShell=wscript_shell.Exec(command);
+    while (oShell.Status == 0) {
+        //Wait a little bit so we're not super looping
+        WScript.sleep(100);
+        //Print any stdout output from the script
         if(!oShell.StdOut.AtEndOfStream) {
             var line = oShell.StdOut.ReadLine();
-            // XXX: Change to verbose mode
-            if(output)
-                WScript.StdOut.WriteLine(line);
+            WScript.StdOut.WriteLine(line);
         }
-        WScript.sleep(100);
+    }
+    //Check to make sure our scripts did not encounter an error
+    if(!oShell.StdErr.AtEndOfStream)
+    {
+        var line = oShell.StdErr.ReadAll();
+        WScript.StdErr.WriteLine(line);
+        WScript.Quit(1);
     }
 }
 
@@ -78,7 +94,7 @@ function build(path)
     }
     
     wscript_shell.CurrentDirectory = path;
-    exec('msbuild CordovaAppProj.csproj');
+    exec_verbose('msbuild CordovaAppProj.csproj');
 
     WScript.StdOut.WriteLine("BUILD SUCCESS.");
 }
@@ -116,7 +132,7 @@ function debug(path)
     {
         build(path);
         WScript.StdOut.WriteLine('Deploying to device ...');
-        exec('%comspec% /c ' + ROOT + CORDOVA_DEPLOY_EXE + ' ' + path + ' -d:0', true);
+        exec_verbose('%comspec% /c ' + ROOT + CORDOVA_DEPLOY_EXE + ' ' + path + ' -d:0');
     }
     else
     {
@@ -133,7 +149,7 @@ function emulate(path)
     {
         build(path);
         WScript.StdOut.WriteLine('Deploying to emulator ...');
-        exec('%comspec% /c ' + ROOT + CORDOVA_DEPLOY_EXE + ' ' + path + ' -d:1', true);
+        exec_verbose('%comspec% /c ' + ROOT + CORDOVA_DEPLOY_EXE + ' ' + path + ' -d:1');
     }
     else
     {

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/08196344/tooling/scripts/dist.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/dist.js b/tooling/scripts/dist.js
index 6560bed..8278c77 100644
--- a/tooling/scripts/dist.js
+++ b/tooling/scripts/dist.js
@@ -52,6 +52,8 @@ var args = WScript.Arguments,
 
 //Destination to build to
 var BUILD_DESTINATION;
+//current script that is running
+var current_script = "dist";
 
 
 /*************************************************/
@@ -93,14 +95,30 @@ function read(filename) {
 function exec(command) {
     //WScript.StdOut.WriteLine("Command: " + command);
     var oShell=wscript_shell.Exec(command);
-    while (oShell.Status != 1) {
-        while(!oShell.StdOut.AtEndOfStream) {
+    while (oShell.Status == 0) {
+        //Wait a little bit so we're not super looping
+        WScript.sleep(100);
+        //Print any stdout output from the script
+        if(!oShell.StdOut.AtEndOfStream) {
             var line = oShell.StdOut.ReadLine();
-            // XXX: Change to verbose mode
             WScript.StdOut.WriteLine(line);
         }
-        WScript.sleep(100);
     }
+    //Check to make sure our scripts did not encounter an error
+    if(!oShell.StdErr.AtEndOfStream)
+    {
+        var line = oShell.StdErr.ReadAll();
+        WScript.StdErr.WriteLine(line);
+        WScript.StdErr.WriteLine("ERROR: Could not complete distribution, failed while running:
" + current_script);
+        WScript.Quit(1);
+    }
+}
+
+function space()
+{
+    WScript.StdOut.WriteLine("");
+    WScript.StdOut.WriteLine("*****************************************************");
+    WScript.StdOut.WriteLine("");
 }
 
 
@@ -122,7 +140,6 @@ else if(args.Count() > 0)
         Usage();
         WScript.Quit(1);
     }
-
 }
 else
 {
@@ -136,9 +153,9 @@ else
 /*************************************************/
 /** - Copy source code to new directory         **/
 /*************************************************/
-
+current_script = "new.js";
 exec('cscript ' + ROOT + SCRIPTS + '\\new.js ' + BUILD_DESTINATION + ' //nologo');
-
+space();
 
 /*************************************************/
 /******************  Step 2  *********************/
@@ -147,9 +164,9 @@ exec('cscript ' + ROOT + SCRIPTS + '\\new.js ' + BUILD_DESTINATION + '
//nologo'
 /** - Delete any generated files and cordova.js **/
 /** - Rebuild dll                               **/
 /*************************************************/
-
+current_script = "reversion.js";
 exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\reversion.js ' + VERSION + ' //nologo');
-
+space();
 
 /*************************************************/
 /******************  Step 3  *********************/
@@ -158,9 +175,9 @@ exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\reversion.js ' + VERSION
+ '
 /** - build cordova.js                          **/
 /** - windows.cordova.js -> templates + example **/
 /*************************************************/
-
+current_script = "buildjs.js";
 exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\buildjs.js //nologo');
-
+space();
 
 /*************************************************/
 /******************  Step 5  *********************/
@@ -169,5 +186,7 @@ exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\buildjs.js //nologo');
 /** - Zip templates                             **/
 /** - inject into Visual Studio                 **/
 /*************************************************/
-
-exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\package.js //nologo');
\ No newline at end of file
+current_script = "package.js";
+exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\package.js //nologo');
+space();
+WScript.StdOut.WriteLine("Distribution Complete.");
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/08196344/tooling/scripts/new.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/new.js b/tooling/scripts/new.js
index d04f977..324d8a7 100644
--- a/tooling/scripts/new.js
+++ b/tooling/scripts/new.js
@@ -75,11 +75,6 @@ function read(filename) {
 function exec(command) {
     var oShell=wscript_shell.Exec(command);
     while (oShell.Status == 0) {
-        if(!oShell.StdOut.AtEndOfStream) {
-            var line = oShell.StdOut.ReadLine();
-            // XXX: Change to verbose mode
-            // WScript.StdOut.WriteLine(line);
-        }
         WScript.sleep(100);
     }
 }
@@ -91,17 +86,17 @@ function copy_to(path)
     WScript.StdOut.WriteLine("Copying files to build directory...");
 
     /** copy by file instead? (just what we need)**/
-    dest.CopyHere(ROOT + "\\bin");
-    dest.CopyHere(ROOT + EXAMPLE_PATH);      //Should mostly be copied from standalone
-    dest.CopyHere(ROOT + FRAMEWORK_PATH);
-    dest.CopyHere(ROOT + TEMPLATES_PATH);
-    dest.CopyHere(ROOT + "\\tests");
-    dest.CopyHere(ROOT + "\\tooling");
-    dest.CopyHere(ROOT + "\\.gitignore");
-    dest.CopyHere(ROOT + "\\LICENSE");
-    dest.CopyHere(ROOT + "\\NOTICE");
-    dest.CopyHere(ROOT + "\\README.md");
-    dest.CopyHere(ROOT + "\\VERSION");
+    dest.CopyHere(ROOT + "\\bin", 4|20);
+    dest.CopyHere(ROOT + EXAMPLE_PATH, 4|20);      //Should mostly be copied from standalone
+    dest.CopyHere(ROOT + FRAMEWORK_PATH, 4|20);
+    dest.CopyHere(ROOT + TEMPLATES_PATH, 4|20);
+    dest.CopyHere(ROOT + "\\tests", 4|20);
+    dest.CopyHere(ROOT + "\\tooling", 4|20);
+    dest.CopyHere(ROOT + "\\.gitignore", 4|20);
+    dest.CopyHere(ROOT + "\\LICENSE", 4|20);
+    dest.CopyHere(ROOT + "\\NOTICE", 4|20);
+    dest.CopyHere(ROOT + "\\README.md", 4|20);
+    dest.CopyHere(ROOT + "\\VERSION", 4|20);
 }
 
 WScript.StdOut.WriteLine("");

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/08196344/tooling/scripts/package.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/package.js b/tooling/scripts/package.js
index fe418d0..812c78d 100644
--- a/tooling/scripts/package.js
+++ b/tooling/scripts/package.js
@@ -77,11 +77,6 @@ function read(filename) {
 function exec(command) {
     var oShell=wscript_shell.Exec(command);
     while (oShell.Status == 0) {
-        if(!oShell.StdOut.AtEndOfStream) {
-            var line = oShell.StdOut.ReadLine();
-            // XXX: Change to verbose mode
-            // WScript.StdOut.WriteLine(line);
-        }
         WScript.sleep(100);
     }
 }
@@ -132,8 +127,8 @@ function package_templates()
         if(fso.FolderExists(template_dir ))
         {
             dest = shell.NameSpace(template_dir);
-            dest.CopyHere(standalone_zip, 20);
-            dest.CopyHere(full_zip, 20);
+            dest.CopyHere(standalone_zip, 4|20);
+            dest.CopyHere(full_zip, 4|20);
         }
         else
         {
@@ -142,19 +137,28 @@ function package_templates()
 	}
 }
 
-// builds the cordova dll and copys it to the full template
+// builds the new cordova dll and copys it to the full template (only done because of the
version referance in Device.cs)
 function build_dll()
 {
     WScript.StdOut.WriteLine("Packaging .dll ...");
     // move to framework directory
     wscript_shell.CurrentDirectory = BUILD_DESTINATION + FRAMEWORK_PATH;
     // build .dll in Release
-    exec('msbuild /p:Configuration=Release;VersionNumber=' + VERSION + ';BaseVersionNumber='
+ BASE_VERSION);
+    exec_verbose('msbuild /p:Configuration=Release;VersionNumber=' + VERSION + ';BaseVersionNumber='
+ BASE_VERSION);
+    //Check if file dll was created
+    if(!fso.FileExists(BUILD_DESTINATION + FRAMEWORK_PATH + '\\Bin\\Release\\WPCordovaClassLib.dll'))
+    {
+        WScript.StdErr.WriteLine('ERROR: MSBuild failed to create .dll when reversioning
cordova-wp7.');
+        WScript.Quit(1);
+    }
+
     if(!fso.FolderExists(BUILD_DESTINATION + FULL_PATH + '\\CordovaLib'))
     {
         fso.CreateFolder(BUILD_DESTINATION + FULL_PATH + '\\CordovaLib');
     }
     exec('%comspec% /c copy Bin\\Release\\WPCordovaClassLib.dll ' + BUILD_DESTINATION + FULL_PATH
+ '\\CordovaLib');
+
+    WScript.StdOut.WriteLine("SUCESS");
 }
 
 // delete any unnessisary files when finished
@@ -216,4 +220,6 @@ else
 // build/package the templates
 package_templates(BUILD_DESTINATION);
 
-cleanUp();
\ No newline at end of file
+cleanUp();
+
+WScript.StdOut.WriteLine("SUCESS");
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/08196344/tooling/scripts/reversion.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/reversion.js b/tooling/scripts/reversion.js
index 696f9e2..cbed71b 100644
--- a/tooling/scripts/reversion.js
+++ b/tooling/scripts/reversion.js
@@ -79,7 +79,7 @@ function read(filename) {
     }
     else
     {
-        WScript.StdOut.WriteLine('Cannot read non-existant file : ' + filename);
+        WScript.StdErr.WriteLine('Cannot read non-existant file : ' + filename);
         WScript.Quit(1);
     }
     return null;
@@ -104,12 +104,29 @@ function replaceInFile(filename, regexp, replacement) {
 function exec(command) {
     var oShell=wscript_shell.Exec(command);
     while (oShell.Status == 0) {
+        WScript.sleep(100);
+    }
+}
+
+// executes a commmand in the shell
+function exec_verbose(command) {
+    //WScript.StdOut.WriteLine("Command: " + command);
+    var oShell=wscript_shell.Exec(command);
+    while (oShell.Status == 0) {
+        //Wait a little bit so we're not super looping
+        WScript.sleep(100);
+        //Print any stdout output from the script
         if(!oShell.StdOut.AtEndOfStream) {
             var line = oShell.StdOut.ReadLine();
-            // XXX: Change to verbose mode
-            // WScript.StdOut.WriteLine(line);
+            WScript.StdOut.WriteLine(line);
         }
-        WScript.sleep(100);
+    }
+    //Check to make sure our scripts did not encounter an error
+    if(!oShell.StdErr.AtEndOfStream)
+    {
+        var line = oShell.StdErr.ReadAll();
+        WScript.StdErr.WriteLine(line);
+        WScript.Quit(1);
     }
 }
 
@@ -117,13 +134,20 @@ function updateVersionNumbers() {
     WScript.StdOut.WriteLine("Updating version numbers....");
     var version_regex = /(\d+)[.](\d+)[.](\d+)(rc\d)?/
     replaceInFile(BUILD_DESTINATION + '\\VERSION', version_regex,  VERSION);
-    // replace assembaly versions in framework
-    var framework_regex = /\(\"(\d+)[.](\d+)[.](\d+)(rc\d)?\"\)\]/g; //Will match ("x.x.x[rcx]")]
-    replaceInFile(BUILD_DESTINATION + FRAMEWORK_PATH + "\\Properties\\AssemblyInfo.cs", framework_regex,
"(\"" + VERSION + "\")]");
-    framework_regex = /\(\"(\d+)[.](\d+)[.](\d+)[.](\d+)"\)\]/;
-    replaceInFile(BUILD_DESTINATION + FRAMEWORK_PATH + "\\Properties\\AssemblyInfo.cs", framework_regex,
"(\"" + BASE_VERSION + "\")]");
+    // update version number in the framwork
+    // AssemblyDescription
+    var framework_regex = /Description\(\"(\d+)[.](\d+)[.](\d+)(rc\d)?\"\)\]/; //Will match
("x.x.x[rcx]")]
+    replaceInFile(BUILD_DESTINATION + FRAMEWORK_PATH + "\\Properties\\AssemblyInfo.cs", framework_regex,
"Description(\"" + VERSION + "\")]");
+    // AssemblyFileVersion
+    framework_regex = /Version\(\"(\d+)[.](\d+)[.](\d+)\"\)\]/g;
+    replaceInFile(BUILD_DESTINATION + FRAMEWORK_PATH + "\\Properties\\AssemblyInfo.cs", framework_regex,
"Version(\"" + VERSION + "\")]");
+    // AssemblyVersion
+    framework_regex = /Version\(\"(\d+)[.](\d+)[.](\d+)[.](\d+)\"\)\]/g;
+    replaceInFile(BUILD_DESTINATION + FRAMEWORK_PATH + "\\Properties\\AssemblyInfo.cs", framework_regex,
"Version(\"" + BASE_VERSION + "\")]");
 
     // update standalone project
+    var dest = shell.NameSpace(BUILD_DESTINATION + STANDALONE_PATH);
+    dest.CopyHere(BUILD_DESTINATION + "\\VERSION", 4|20);
     var cordova_regex = /cordova-(\d+)[.](\d+)[.](\d+)(rc\d)?/g; //Matches *first* cordova-x.x.x[rcx]
(just ad g at end to make global)
     replaceInFile(BUILD_DESTINATION + STANDALONE_PATH + '\\CordovaAppProj.csproj', cordova_regex,
 "cordova-" + VERSION);
     replaceInFile(BUILD_DESTINATION + STANDALONE_PATH + '\\CordovaSourceDictionary.xml',
cordova_regex,  "cordova-" + VERSION);
@@ -133,7 +157,7 @@ function updateVersionNumbers() {
 
     // update full project
     dest = shell.NameSpace(BUILD_DESTINATION + FULL_PATH);
-    dest.CopyHere(BUILD_DESTINATION + "\\VERSION", 20);
+    dest.CopyHere(BUILD_DESTINATION + "\\VERSION", 4|20);
     replaceInFile(BUILD_DESTINATION + FULL_PATH + '\\CordovaAppProj.csproj', cordova_regex,
 "cordova-" + VERSION);
     replaceInFile(BUILD_DESTINATION + FULL_PATH + '\\CordovaSourceDictionary.xml', cordova_regex,
 "cordova-" + VERSION);
     replaceInFile(BUILD_DESTINATION + FULL_PATH + '\\www\\index.html', cordova_regex,  "cordova-"
+ VERSION);
@@ -194,6 +218,16 @@ function cleanup()
     {
         fso.DeleteFolder(BUILD_DESTINATION + 'tooling\\CordovaDeploy\\CordovaDeploy\\obj');
     }
+    //remove old template .zip files
+    WScript.Echo(BUILD_DESTINATION);
+    var root_folder = shell.NameSpace(BUILD_DESTINATION + '\\').Items();
+    for(var i = 0; i < root_folder.Count; i++)
+    {
+        if(root_folder.Item(i).Name.match(/CordovaWP7[_](\d+)[_](\d+)[_](\d+)(rc\d)?[_]/))
+        {
+            fso.DeleteFile(BUILD_DESTINATION + '\\' + root_folder.Item(i).Name);
+        }
+    }
     // remove old cordova.js
     var example_www = shell.NameSpace(BUILD_DESTINATION + EXAMPLE_PATH + '\\www').Items();
     for(var i = 0; i < example_www.Count; i++)
@@ -228,12 +262,21 @@ function build_dll()
     // move to framework directory
     wscript_shell.CurrentDirectory = BUILD_DESTINATION + FRAMEWORK_PATH;
     // build .dll in Release
-    exec('msbuild /p:Configuration=Release;VersionNumber=' + VERSION + ';BaseVersionNumber='
+ BASE_VERSION);
+    exec_verbose('msbuild /p:Configuration=Release;VersionNumber=' + VERSION + ';BaseVersionNumber='
+ BASE_VERSION);
+    //Check if file dll was created
+    if(!fso.FileExists(BUILD_DESTINATION + FRAMEWORK_PATH + '\\Bin\\Release\\WPCordovaClassLib.dll'))
+    {
+        WScript.StdErr.WriteLine('ERROR: MSBuild failed to create .dll when reversioning
cordova-wp7.');
+        WScript.Quit(1);
+    }
+
     if(!fso.FolderExists(BUILD_DESTINATION + FULL_PATH + '\\CordovaLib'))
     {
         fso.CreateFolder(BUILD_DESTINATION + FULL_PATH + '\\CordovaLib');
     }
     exec('%comspec% /c copy Bin\\Release\\WPCordovaClassLib.dll ' + BUILD_DESTINATION + FULL_PATH
+ '\\CordovaLib');
+
+    WScript.StdOut.WriteLine("SUCESS");
 }
 
 
@@ -247,9 +290,9 @@ if(args.Count() > 1)
     }
     else
     {
-        WScript.StdOut.WriteLine("The given path is not a cordova-wp7 repo, if");
-        WScript.StdOut.WriteLine(" your trying to reversion a cordova-wp7 repo");
-        WScript.StdOut.WriteLine(" other then this one, please provide its path.");
+        WScript.StdErr.WriteLine("The given path is not a cordova-wp7 repo, if");
+        WScript.StdErr.WriteLine(" your trying to reversion a cordova-wp7 repo");
+        WScript.StdErr.WriteLine(" other then this one, please provide its path.");
         Usage();
         WScript.Quit(1);
     }
@@ -283,8 +326,8 @@ if(args.Count() > 0)
     }
     else
     {
-        WScript.StdOut.WriteLine("The  version number is invalid, please provide");
-        WScript.StdOut.WriteLine(" a version number in the format Major.Minor.Fix[rc#]")
+        WScript.StdErr.WriteLine("ERROR: The  version number provided is invalid, please
provide");
+        WScript.StdErr.WriteLine(" a version number in the format Major.Minor.Fix[rc#]")
         Usage();
         WScript.Quit(1);
     }

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/08196344/tooling/scripts/win-zip.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/win-zip.js b/tooling/scripts/win-zip.js
index 22190ec..8455a54 100644
--- a/tooling/scripts/win-zip.js
+++ b/tooling/scripts/win-zip.js
@@ -25,7 +25,7 @@ var zipFolder = objShell.NameSpace(zipPath);
 var sourceItems = objShell.NameSpace(sourcePath).items();
 if (zipFolder != null)
 {
-    zipFolder.CopyHere(sourceItems);
+    zipFolder.CopyHere(sourceItems, 4|20);
     WScript.Sleep(1000);
 }
 else {


Mime
View raw message