You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2013/02/27 03:34:56 UTC
[4/7] wp7 commit: Added development scripts
Added development scripts
Project: http://git-wip-us.apache.org/repos/asf/cordova-wp7/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp7/commit/2a0b1662
Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp7/tree/2a0b1662
Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp7/diff/2a0b1662
Branch: refs/heads/master
Commit: 2a0b166264f2ff3f1f2171218ee411607355d8fa
Parents: 2c2b582
Author: Benn Mapes <be...@gmail.com>
Authored: Fri Feb 22 18:13:31 2013 -0800
Committer: Benn Mapes <be...@gmail.com>
Committed: Mon Feb 25 19:42:06 2013 -0800
----------------------------------------------------------------------
bin/create.bat | 4 +-
bin/create.js | 200 ++++++----
templates/description.txt | 4 -
templates/full/__PreviewImage.jpg | Bin 25875 -> 0 bytes
templates/full/__TemplateIcon.png | Bin 6546 -> 0 bytes
templates/pg_templateIcon.png | Bin 6546 -> 0 bytes
templates/pg_templatePreview.jpg | Bin 25875 -> 0 bytes
templates/standalone/__PreviewImage.jpg | Bin 25875 -> 0 bytes
templates/standalone/__TemplateIcon.png | Bin 6546 -> 0 bytes
templates/vs/description.txt | 4 +
templates/vs/pg_templateIcon.png | Bin 0 -> 6546 bytes
templates/vs/pg_templatePreview.jpg | Bin 0 -> 25875 bytes
.../CordovaDeploy/CordovaDeploy.csproj | 2 +-
tooling/CordovaDeploy/CordovaDeploy/Program.cs | 4 +-
tooling/scripts/build.bat | 18 +
tooling/scripts/build.js | 101 +++++
tooling/scripts/buildjs.bat | 18 +
tooling/scripts/buildjs.js | 175 ++++++++
tooling/scripts/debug.bat | 86 +---
tooling/scripts/deploy.js | 196 +++++++++
tooling/scripts/dist.bat | 4 +-
tooling/scripts/dist.js | 325 ++-------------
tooling/scripts/emulate.bat | 42 +-
tooling/scripts/new.bat | 18 +
tooling/scripts/new.js | 163 ++++++++
tooling/scripts/package.bat | 18 +
tooling/scripts/package.js | 219 ++++++++++
tooling/scripts/reversion.bat | 18 +
tooling/scripts/reversion.js | 296 +++++++++++++
tooling/scripts/win-zip.js | 8 +-
30 files changed, 1462 insertions(+), 461 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/bin/create.bat
----------------------------------------------------------------------
diff --git a/bin/create.bat b/bin/create.bat
index 0865db1..92b7ed0 100644
--- a/bin/create.bat
+++ b/bin/create.bat
@@ -14,5 +14,5 @@
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License.
-
-cscript bin\\create.js $*
\ No newline at end of file
+@ECHO OFF
+cscript "%~dp0\create.js" %* //nologo
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/bin/create.js
----------------------------------------------------------------------
diff --git a/bin/create.js b/bin/create.js
index c5e0bcc..bc2f5d9 100644
--- a/bin/create.js
+++ b/bin/create.js
@@ -17,29 +17,51 @@
under the License.
*/
-/*
- * create a cordova/wp7 project
- *
- * USAGE
- * ./create [path package activity]
- */
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+ shell = WScript.CreateObject("shell.application"),
+ wscript_shell = WScript.CreateObject("WScript.Shell");
+
+var args = WScript.Arguments,
+ TEMPLATES_PATH = '\\templates',
+ // sub folder for standalone project
+ STANDALONE_PATH = TEMPLATES_PATH + '\\standalone',
+ // sub folder for full project
+ FULL_PATH = TEMPLATES_PATH + '\\full',
+ // default template to use when creating the project
+ CREATE_TEMPLATE = STANDALONE_PATH;
+
+// working dir
+var ROOT = WScript.ScriptFullName.split('\\bin\\create.js').join('');
function Usage()
{
- WScript.Echo("Usage: create [PATH]"); // [PACKAGE] [ACTIVITY]");
- WScript.Echo("Creates a new cordova/wp7 project.");
+
+ WScript.StdOut.WriteLine("Usage: create [ PathTONewProject ProjectName ]");
+ 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("examples:");
+ WScript.StdOut.WriteLine(" create C:\\Users\\anonymous\\Desktop\\MyProject");
+ WScript.StdOut.WriteLine(" create C:\\Users\\anonymous\\Desktop\\MyProject AnApplication");
}
var ForReading = 1, ForWriting = 2, ForAppending = 8;
var TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0;
function read(filename) {
- //WScript.Echo('Reading in ' + filename);
- var fso=WScript.CreateObject("Scripting.FileSystemObject");
- var f=fso.OpenTextFile(filename, 1,2);
- var s=f.ReadAll();
- f.Close();
- return s;
+ //WScript.StdOut.WriteLine('Reading in ' + filename);
+ if(fso.FileExists(filename))
+ {
+ var f=fso.OpenTextFile(filename, 1,2);
+ var s=f.ReadAll();
+ f.Close();
+ return s;
+ }
+ else
+ {
+ WScript.StdOut.WriteLine('Cannot read non-existant file : ' + filename);
+ WScript.Quit(1);
+ }
+ return null;
}
function write(filename, contents) {
@@ -48,89 +70,121 @@ function write(filename, contents) {
f.Write(contents);
f.Close();
}
+
function replaceInFile(filename, regexp, replacement) {
write(filename,read(filename).replace(regexp,replacement));
}
-function exec(s, output) {
- WScript.Echo('Executing::' + s);
- var o=shell.Exec(s);
- while (o.Status == 0) {
- WScript.Sleep(100);
- }
- WScript.Echo(o.StdErr.ReadAll());
- WScript.Echo("Command exited with code " + o.Status);
-}
-function fork(s) {
- WScript.Echo('Executing ' + s);
- var o=shell.Exec(s);
- while (o.Status != 1) {
- WScript.Sleep(100);
+// executes a commmand in the shell
+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);
}
- WScript.Echo(o.StdOut.ReadAll());
- WScript.Echo(o.StdErr.ReadAll());
- WScript.Echo("Command exited with code " + o.Status);
}
+// generate unique project GUID - Not needed unless building an actual project (example?)
function genGuid()
{
- var TypeLib = WScript.CreateObject("Scriptlet.TypeLib");
- strGuid = TypeLib.Guid.split("}")[0]; // there is extra crap after the } that is causing file streams to break, probably an EOF ...
- strGuid = strGuid.replace(/[\{\}]/g,"");
- return strGuid;
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
+ var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
+ return v.toString(16);
+ });
}
-var args = WScript.Arguments,
- PROJECT_PATH="..\\example\\",
- PACKAGE="org.apache.cordova.example",
- ACTIVITY="cordovaExample",
- shell=WScript.CreateObject("WScript.Shell");
-
-// working dir
-var ROOT = WScript.ScriptFullName.split('\\bin\\create.js').join('');
-
-if (args.Count() > 0)
+// creates a project from the standalone template
+function create(path, name)
{
- PROJECT_PATH = args(0);
- if(PROJECT_PATH.indexOf("--help") > -1 ||
- PROJECT_PATH.indexOf("/?") > -1 )
+ WScript.StdOut.WriteLine("Creating Cordova-WP7 Project:");
+ WScript.StdOut.WriteLine("\tName : " + name);
+ WScript.StdOut.WriteLine("\tDirectory : " + path);
+
+ fso.CreateFolder(path);
+
+ // copy everything from standalone to project directory
+ var dest = shell.NameSpace(path);
+ var sourceItems = shell.NameSpace(ROOT + CREATE_TEMPLATE).items();
+ if (dest != null)
{
- Usage();
- WScript.Quit(1);
+ dest.CopyHere(sourceItems);
+ WScript.Sleep(1000);
}
-
- if(args.Count() > 1)
+ else
{
- PACKAGE=args(1);
+ WScript.StdOut.WriteLine("Failed to create project directory.");
+ WScript.StdOut.WriteLine("CREATE FAILED.");
+ WScript.Quit(1);
}
- if(args.Count() > 2)
+ // delete any generated files that might have been in template
+ if(fso.FolderExists(path + "\\obj"))
{
- ACTIVITY=args(2);
+ fso.DeleteFolder(path + "\\obj");
+ }
+ if(fso.FolderExists(path + "\\Bin"))
+ {
+ fso.DeleteFolder(path + "\\Bin");
}
-}
+ // replace the guid in the AppManifest
+ var newProjGuid = genGuid();
+ 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);
+
+ WScript.StdOut.WriteLine("CREATE SUCCESS.");
-// WScript.Echo("ROOT = " + ROOT);
-// WScript.Echo('PROJECT_PATH ' + PROJECT_PATH);
-// WScript.Echo('PACKAGE ' + PACKAGE);
-// WScript.Echo('ACTIVITY ' + ACTIVITY);
+}
-var PACKAGE_AS_PATH=PACKAGE.replace(/\./g, '\\');
-WScript.Echo("Package as path: " + PACKAGE_AS_PATH);
-var newProjGuid = genGuid();
-// Copy the template source files to the new destination
-exec('cmd /c xcopy templates\\full ' + PROJECT_PATH + ' /S /Y');
-// replace the guid in the AppManifest
-replaceInFile(PROJECT_PATH + "\\Properties\\WMAppManifest.xml","$guid1$",newProjGuid);
-// replace safe-project-name in AppManifest
-replaceInFile(PROJECT_PATH + "\\Properties\\WMAppManifest.xml",/\$safeprojectname\$/g,ACTIVITY);
+if(args.Count() > 0)
+{
+ // support help flags
+ if(args(0) == "--help" || args(0) == "/?" ||
+ args(0) == "help" || args(0) == "-help" || args(0) == "/help")
+ {
+ Usage();
+ WScript.Quit(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");
+ }
+ }
+ }
+}
+else
+{
+ Usage();
+ WScript.Quit(1);
+}
-WScript.Echo("Generated project : " + PROJECT_PATH + ACTIVITY);
-// TODO: Name the project according to the arguments
-// update the solution to include the new project by name
-// version BS
// index.html title set to project name ?
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/templates/description.txt
----------------------------------------------------------------------
diff --git a/templates/description.txt b/templates/description.txt
deleted file mode 100644
index 289e163..0000000
--- a/templates/description.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CordovaStarter
-
-Starter project for building a Cordova app for Windows Phone version: 2.5.0
-
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/templates/full/__PreviewImage.jpg
----------------------------------------------------------------------
diff --git a/templates/full/__PreviewImage.jpg b/templates/full/__PreviewImage.jpg
deleted file mode 100644
index 1d72941..0000000
Binary files a/templates/full/__PreviewImage.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/templates/full/__TemplateIcon.png
----------------------------------------------------------------------
diff --git a/templates/full/__TemplateIcon.png b/templates/full/__TemplateIcon.png
deleted file mode 100644
index 75c17c7..0000000
Binary files a/templates/full/__TemplateIcon.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/templates/pg_templateIcon.png
----------------------------------------------------------------------
diff --git a/templates/pg_templateIcon.png b/templates/pg_templateIcon.png
deleted file mode 100644
index 75c17c7..0000000
Binary files a/templates/pg_templateIcon.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/templates/pg_templatePreview.jpg
----------------------------------------------------------------------
diff --git a/templates/pg_templatePreview.jpg b/templates/pg_templatePreview.jpg
deleted file mode 100644
index 1d72941..0000000
Binary files a/templates/pg_templatePreview.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/templates/standalone/__PreviewImage.jpg
----------------------------------------------------------------------
diff --git a/templates/standalone/__PreviewImage.jpg b/templates/standalone/__PreviewImage.jpg
deleted file mode 100644
index 1d72941..0000000
Binary files a/templates/standalone/__PreviewImage.jpg and /dev/null differ
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/templates/standalone/__TemplateIcon.png
----------------------------------------------------------------------
diff --git a/templates/standalone/__TemplateIcon.png b/templates/standalone/__TemplateIcon.png
deleted file mode 100644
index 75c17c7..0000000
Binary files a/templates/standalone/__TemplateIcon.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/templates/vs/description.txt
----------------------------------------------------------------------
diff --git a/templates/vs/description.txt b/templates/vs/description.txt
new file mode 100644
index 0000000..289e163
--- /dev/null
+++ b/templates/vs/description.txt
@@ -0,0 +1,4 @@
+CordovaStarter
+
+Starter project for building a Cordova app for Windows Phone version: 2.5.0
+
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/templates/vs/pg_templateIcon.png
----------------------------------------------------------------------
diff --git a/templates/vs/pg_templateIcon.png b/templates/vs/pg_templateIcon.png
new file mode 100644
index 0000000..75c17c7
Binary files /dev/null and b/templates/vs/pg_templateIcon.png differ
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/templates/vs/pg_templatePreview.jpg
----------------------------------------------------------------------
diff --git a/templates/vs/pg_templatePreview.jpg b/templates/vs/pg_templatePreview.jpg
new file mode 100644
index 0000000..1d72941
Binary files /dev/null and b/templates/vs/pg_templatePreview.jpg differ
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/CordovaDeploy/CordovaDeploy/CordovaDeploy.csproj
----------------------------------------------------------------------
diff --git a/tooling/CordovaDeploy/CordovaDeploy/CordovaDeploy.csproj b/tooling/CordovaDeploy/CordovaDeploy/CordovaDeploy.csproj
index 33da0da..fb9949f 100644
--- a/tooling/CordovaDeploy/CordovaDeploy/CordovaDeploy.csproj
+++ b/tooling/CordovaDeploy/CordovaDeploy/CordovaDeploy.csproj
@@ -54,7 +54,7 @@
<ItemGroup>
<Reference Include="Microsoft.Smartdevice.Connectivity, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\Program Files (x86)\Common Files\microsoft shared\Phone Tools\CoreCon\10.0\Bin\Microsoft.Smartdevice.Connectivity.dll</HintPath>
+ <HintPath>C:\Program Files (x86)\Common Files\microsoft shared\Phone Tools\CoreCon\10.0\Bin\Microsoft.Smartdevice.Connectivity.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/CordovaDeploy/CordovaDeploy/Program.cs
----------------------------------------------------------------------
diff --git a/tooling/CordovaDeploy/CordovaDeploy/Program.cs b/tooling/CordovaDeploy/CordovaDeploy/Program.cs
index 3414101..a862227 100644
--- a/tooling/CordovaDeploy/CordovaDeploy/Program.cs
+++ b/tooling/CordovaDeploy/CordovaDeploy/Program.cs
@@ -64,7 +64,7 @@ namespace CordovaDeploy
static Guid ReadAppId(string root)
{
Guid appID = Guid.Empty;
- string manifestFilePath = root + @"\WMAppManifest.xml";
+ string manifestFilePath = root + @"\Properties\WMAppManifest.xml";
if (File.Exists(manifestFilePath))
{
@@ -157,7 +157,7 @@ namespace CordovaDeploy
}
- xapFilePath = Directory.GetFiles(root, "*.xap").FirstOrDefault();
+ xapFilePath = Directory.GetFiles(root + @"\Bin\Debug", "*.xap").FirstOrDefault();
if (string.IsNullOrEmpty(xapFilePath))
{
Log(string.Format("Error: could not find application .xap in folder {0}", root));
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/scripts/build.bat
----------------------------------------------------------------------
diff --git a/tooling/scripts/build.bat b/tooling/scripts/build.bat
new file mode 100644
index 0000000..6cbdbdf
--- /dev/null
+++ b/tooling/scripts/build.bat
@@ -0,0 +1,18 @@
+:: 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 "%~dp0\build.js" %* //nologo
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/scripts/build.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/build.js b/tooling/scripts/build.js
new file mode 100644
index 0000000..c35e6b7
--- /dev/null
+++ b/tooling/scripts/build.js
@@ -0,0 +1,101 @@
+/*
+ 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.
+*/
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+ wscript_shell = WScript.CreateObject("WScript.Shell");
+
+
+function Usage()
+{
+ WScript.StdOut.WriteLine("");
+ WScript.StdOut.WriteLine("Usage: build [ PathTOProjectFolder ]");
+ WScript.StdOut.WriteLine(" PathTOProjectFolder : The path to the project being built");
+ WScript.StdOut.WriteLine("examples:");
+ WScript.StdOut.WriteLine(" build C:\\Users\\anonymous\\Desktop\\MyProject");
+ WScript.StdOut.WriteLine("");
+}
+
+// exicutes a commmand in the shell
+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);
+ }
+}
+
+// builds the project and .xap
+function build(path)
+{
+ WScript.StdOut.WriteLine("Building Cordova-WP7 Project:");
+ WScript.StdOut.WriteLine("\tDirectory : " + path);
+
+ // delete any previously generated files
+ if(fso.FolderExists(path + "\\obj"))
+ {
+ fso.DeleteFolder(path + "\\obj");
+ }
+ if(fso.FolderExists(path + "\\Bin"))
+ {
+ fso.DeleteFolder(path + "\\Bin");
+ }
+
+ wscript_shell.CurrentDirectory = path;
+ exec('msbuild CordovaAppProj.csproj');
+
+ WScript.StdOut.WriteLine("BUILD SUCCESS.");
+}
+
+var args = WScript.Arguments;
+
+WScript.StdOut.WriteLine("");
+
+if(args.Count() > 0)
+{
+ // support help flags
+ if(args(0) == "--help" || args(0) == "/?" ||
+ args(0) == "help" || args(0) == "-help" || args(0) == "/help")
+ {
+ Usage();
+ WScript.Quit(1);
+ }
+ else
+ {
+ if(fso.FolderExists(args(0)))
+ {
+ build(args(0));
+ }
+ else
+ {
+ WScript.StdOut.WriteLine("Could not find project directory.");
+ Usage();
+ WScript.StdOut.WriteLine("BUILD FAILED.");
+ WScript.Quit(1);
+ }
+ }
+}
+else
+{
+ Usage();
+ WScript.Quit(1);
+}
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/scripts/buildjs.bat
----------------------------------------------------------------------
diff --git a/tooling/scripts/buildjs.bat b/tooling/scripts/buildjs.bat
new file mode 100644
index 0000000..470fb7e
--- /dev/null
+++ b/tooling/scripts/buildjs.bat
@@ -0,0 +1,18 @@
+:: 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 "%~dp0\buildjs.js" %* //nologo
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/scripts/buildjs.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/buildjs.js b/tooling/scripts/buildjs.js
new file mode 100644
index 0000000..8d50e2c
--- /dev/null
+++ b/tooling/scripts/buildjs.js
@@ -0,0 +1,175 @@
+/*
+ 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.
+*/
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+ shell = WScript.CreateObject("shell.application"),
+ wscript_shell = WScript.CreateObject("WScript.Shell");
+
+var args = WScript.Arguments,
+ //Root folder of cordova-wp7 (i.e C:\Cordova\cordova-wp7)
+ ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+ //Sub folder containing templates
+ TEMPLATES_PATH = '\\templates',
+ //Sub folder for standalone project
+ STANDALONE_PATH = TEMPLATES_PATH + '\\standalone',
+ //Sub folder for full project
+ FULL_PATH = TEMPLATES_PATH + '\\full',
+ //Sub folder containing framework
+ FRAMEWORK_PATH = '\\framework',
+ //Subfolder containing example project
+ EXAMPLE_PATH = '\\example',
+ //Git Repositories
+ CORDOVA_JS = "git://github.com/apache/cordova-js.git",
+ // get version
+ VERSION = read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,'');
+
+
+// help function
+function Usage()
+{
+ WScript.StdOut.WriteLine("");
+ WScript.StdOut.WriteLine("This Script builds the given virsion of cordova.js and injects it into this or the given cordova-wp7 ")
+ WScript.StdOut.WriteLine("");
+ WScript.StdOut.WriteLine("Usage: buildjs [ Version PathTOCordovaWP7 ]");
+ WScript.StdOut.WriteLine(" Version : The version of cordova.js to build (must already be tagged)");
+ WScript.StdOut.WriteLine(" PathTOCordovaWP7 : The path to the cordova directory where the new cordova.js will go.");
+ 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("");
+}
+
+// returns the contents of a file
+function read(filename) {
+ //WScript.StdOut.WriteLine('Reading in ' + filename);
+ if(fso.FileExists(filename))
+ {
+ var f=fso.OpenTextFile(filename, 1,2);
+ var s=f.ReadAll();
+ f.Close();
+ return s;
+ }
+ else
+ {
+ WScript.StdOut.WriteLine('Cannot read non-existant file : ' + filename);
+ WScript.Quit(1);
+ }
+ return null;
+}
+
+// executes a commmand in the shell
+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);
+ }
+}
+
+function build_js(path)
+{
+ WScript.StdOut.WriteLine("Creating cordova.js...");
+ if(fso.FolderExists(path + '\\temp'))
+ {
+ fso.DeleteFolder(path + '\\temp', true);
+ }
+ fso.CreateFolder(path + '\\temp');
+ 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...");
+ wscript_shell.CurrentDirectory = path + '\\temp\\cordova-js';
+ exec('%comspec% /c jake build');
+ 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');
+ exec('%comspec% /c copy cordova.windowsphone.js ' + path + EXAMPLE_PATH + '\\www\\cordova-' + VERSION + '.js');
+
+ //TODO: Delete old cordova.js
+
+ WScript.StdOut.WriteLine("DONE.");
+}
+
+function set_path(some_arg)
+{
+ if(some_arg.indexOf('-p:')!= -1)
+ {
+ var path = some_arg.split('-p:')[1];
+ if(fso.FolderExists(path) && fso.FolderExists(path + '\\tooling'))
+ {
+ BUILD_DESTINATION = path;
+ return true;
+ }
+ else
+ {
+ WScript.StdOut.WriteLine("ERROR: The given path is not a cordova-wp7 repo, or");
+ WScript.StdOut.WriteLine(" does not exist. If your trying to reversion a");
+ WScript.StdOut.WriteLine(" cordova repo other then this one, please provide");
+ WScript.StdOut.WriteLine(" it's path in the form: -p:C:\\Path\\to\\repo");
+ WScript.Quit(1);
+ }
+
+ }
+ return false;
+}
+
+WScript.StdOut.WriteLine("");
+
+if(args.Count() > 1)
+{
+ set_path(args(1));
+}
+
+if(args.Count() > 0)
+{
+ //Support help flags
+ if(args(0).indexOf("--help") > -1 ||
+ args(0).indexOf("/?") > -1 )
+ {
+ Usage();
+ WScript.Quit(1);
+ }
+
+ if(args(0).match(/(\d+)[.](\d+)[.](\d+)(rc\d)?/))
+ {
+ VERSION = args(0);
+ }
+ else if(set_path(arg(0))) {} //do nothing
+ else
+ {
+ WScript.StdOut.WriteLine("The provided version number is invalid, please provide");
+ WScript.StdOut.WriteLine(" a version number in the format Major.Minor.Fix[rc#]")
+ Usage();
+ WScript.Quit(1);
+ }
+}
+else
+{
+ BUILD_DESTINATION = ROOT;
+}
+
+//If we haven't quit by here, build the damn javascript!
+build_js(BUILD_DESTINATION);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/scripts/debug.bat
----------------------------------------------------------------------
diff --git a/tooling/scripts/debug.bat b/tooling/scripts/debug.bat
index 4efc80c..a85493c 100644
--- a/tooling/scripts/debug.bat
+++ b/tooling/scripts/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 "%~dp0\deploy.js" %1 -debug //nologo
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/scripts/deploy.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/deploy.js b/tooling/scripts/deploy.js
new file mode 100644
index 0000000..6318ada
--- /dev/null
+++ b/tooling/scripts/deploy.js
@@ -0,0 +1,196 @@
+/*
+ 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.
+*/
+
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+ wscript_shell = WScript.CreateObject("WScript.Shell");
+
+var args = WScript.Arguments,
+ ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+ // path to CordovaDeploy.exe
+ CORDOVA_DEPLOY_EXE = '\\tooling\\CordovaDeploy\\CordovaDeploy\\bin\\Debug\\CordovaDeploy.exe',
+ // path to CordovaDeploy
+ CORDOVA_DEPLOY = '\\tooling\\CordovaDeploy';
+
+
+// help function
+function Usage()
+{
+ WScript.StdOut.WriteLine("");
+ WScript.StdOut.WriteLine("Usage: [ debug | emulate ] [ PathTOProjectFolder ]");
+ WScript.StdOut.WriteLine(" PathTOProjectFolder : The path to the project being launched.");
+ WScript.StdOut.WriteLine("examples:");
+ WScript.StdOut.WriteLine(" debug C:\\Users\\anonymous\\Desktop\\MyProject");
+ WScript.StdOut.WriteLine(" emulate C:\\Users\\anonymous\\Desktop\\MyBetterProject");
+ WScript.StdOut.WriteLine("");
+}
+
+
+
+var ForReading = 1, ForWriting = 2, ForAppending = 8;
+var TristateUseDefault = 2, TristateTrue = 1, TristateFalse = 0;
+
+
+// executes a commmand in the shell
+function exec(command, output) {
+ var oShell=wscript_shell.Exec(command);
+ while (oShell.Status == 0) {
+ if(!oShell.StdOut.AtEndOfStream) {
+ var line = oShell.StdOut.ReadLine();
+ // XXX: Change to verbose mode
+ if(output)
+ WScript.StdOut.WriteLine(line);
+ }
+ WScript.sleep(100);
+ }
+}
+
+// builds the project and .xap
+function build(path)
+{
+ WScript.StdOut.WriteLine("Building Cordova-WP7 Project:");
+ WScript.StdOut.WriteLine("\tDirectory : " + path);
+
+ // delete any previously generated files
+ if(fso.FolderExists(path + "\\obj"))
+ {
+ fso.DeleteFolder(path + "\\obj");
+ }
+ if(fso.FolderExists(path + "\\Bin"))
+ {
+ fso.DeleteFolder(path + "\\Bin");
+ }
+
+ wscript_shell.CurrentDirectory = path;
+ exec('msbuild CordovaAppProj.csproj');
+
+ WScript.StdOut.WriteLine("BUILD SUCCESS.");
+}
+
+// builds the CordovaDeploy.exe if it does not already exist
+function cordovaDeploy()
+{
+ if(fso.FileExists(ROOT + CORDOVA_DEPLOY_EXE))
+ {
+ return true;
+ }
+
+ WScript.StdOut.WriteLine("CordovaDeploy.exe not found, attempting to build CordovaDeploy.exe...");
+
+ //Build CordovaDeploy.exe
+ if(fso.FolderExists(ROOT + '\\tooling') && fso.FolderExists(ROOT + CORDOVA_DEPLOY) &&
+ fso.FileExists(ROOT + CORDOVA_DEPLOY + '\\CordovaDeploy.sln'))
+ {
+ exec('msbuild ' + ROOT + CORDOVA_DEPLOY + '\\CordovaDeploy.sln');
+ WScript.StdOut.WriteLine("MSBUILD COMPLETE.");
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+//TODO: Output errors from CordovaDeploy so user can troubleshoot problems
+
+// builds and launches project on device
+function debug(path)
+{
+ if(cordovaDeploy() && fso.FileExists(ROOT + CORDOVA_DEPLOY_EXE))
+ {
+ build(path);
+ WScript.StdOut.WriteLine('Deploying to device ...');
+ exec('%comspec% /c ' + ROOT + CORDOVA_DEPLOY_EXE + ' ' + path + ' -d:0', true);
+ }
+ else
+ {
+ WScript.StdOut.WriteLine("Error: Failed to find/build CordovaDeploy.exe");
+ WScript.StdOut.WriteLine("DEPLOY FAILED.");
+ WScript.Quit(1);
+ }
+}
+
+// builds and launches project on emulator
+function emulate(path)
+{
+ if(cordovaDeploy() && fso.FileExists(ROOT + CORDOVA_DEPLOY_EXE))
+ {
+ build(path);
+ WScript.StdOut.WriteLine('Deploying to emulator ...');
+ exec('%comspec% /c ' + ROOT + CORDOVA_DEPLOY_EXE + ' ' + path + ' -d:1', true);
+ }
+ else
+ {
+ WScript.StdOut.WriteLine("Error: Failed to find/build CordovaDeploy.exe");
+ WScript.StdOut.WriteLine("DEPLOY FAILED.");
+ WScript.Quit(1);
+ }
+}
+
+
+var project_path;
+WScript.StdOut.WriteLine("");
+
+if(args.Count() > 0)
+{
+ // support help flags
+ if(args(0) == "--help" || args(0) == "/?" ||
+ args(0) == "help" || args(0) == "-help" || args(0) == "/help")
+ {
+ Usage();
+ WScript.Quit(1);
+ }
+ else if(args.Count() > 2)
+ {
+ WScript.StdOut.WriteLine("Error: Too many arguments.");
+ Usage();
+ WScript.Quit(1);
+ }
+ else if(fso.FolderExists(args(0)))
+ {
+ if(args.Count() > 1)
+ {
+ if(args(1) == "-emulate" || args(1) == "-e")
+ {
+ emulate(args(0));
+ }
+ else if(args(1) == "-debug" || args(1) == "-d")
+ {
+ debug(args(0));
+ }
+ }
+ else
+ {
+ WScript.StdOut.WriteLine("Debug/Emulate not specified, defaulting to emulate...");
+ emulate(args(0));
+ }
+ }
+ else
+ {
+ WScript.StdOut.WriteLine("Error: Project directory not found,");
+ WScript.StdOut.WriteLine("please ensure you give the path to your project.");
+ Usage();
+ WScript.Quit(1);
+ }
+}
+else
+{
+ Usage();
+ WScript.Quit(1);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/scripts/dist.bat
----------------------------------------------------------------------
diff --git a/tooling/scripts/dist.bat b/tooling/scripts/dist.bat
index c4a8917..d353533 100644
--- a/tooling/scripts/dist.bat
+++ b/tooling/scripts/dist.bat
@@ -14,5 +14,5 @@
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License.
-
-cscript "%~dp0\dist.js" %*
\ No newline at end of file
+@ECHO OFF
+cscript "%~dp0\dist.js" %* //nologo
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/scripts/dist.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/dist.js b/tooling/scripts/dist.js
index d6654e4..6560bed 100644
--- a/tooling/scripts/dist.js
+++ b/tooling/scripts/dist.js
@@ -17,23 +17,6 @@
under the License.
*/
-/* What does this script do?
- * - creates a cordova-wp7 directory in the specified path with updated tags according to whats in the VERSION file at the root.
- * - clones and builds a new cordova.js for the windows platform
- * - packages the .dll for the full template
- * - injects both the full and standalone templates into the Visual Studio templates directory (if found).
- *
- * USAGE (command line)
- * -> dist <path_to_new_build_dir>
- */
-
- /*TODO's
- - Find the path to the users visual studio template directory (currently assumes install directory for VS2012)
- - Load mobile-spec into test version for testing
- - For example project (and full?), get WP app files from standalone (to keep them updated)
- * Replace safeprojectname and guid with values
- -
- */
/*************************************************/
/**************** REQUIREMENTS *****************/
@@ -50,38 +33,22 @@ Famework
/************ Globals ********/
var fso = WScript.CreateObject('Scripting.FileSystemObject'),
- shell = WScript.CreateObject("shell.application"),
wscript_shell = WScript.CreateObject("WScript.Shell");
//Replace root directory or create new directory?
var REPLACE = false;
-//Get new version from git or build off this version?
-var GET_NEW = false;
-//Add templates to visual studio?
-var ADD_TO_VS = true;
//Set up directory structure of current release
//arguments passed in
var args = WScript.Arguments,
//Root folder of cordova-wp7 (i.e C:\Cordova\cordova-wp7)
ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
- //Sub folder containing templates
- TEMPLATES_PATH = '\\templates',
- //Sub folder for standalone project
- STANDALONE_PATH = TEMPLATES_PATH + '\\standalone',
- //Sub folder for full project
- FULL_PATH = TEMPLATES_PATH + '\\full'
- //Sub folder containing framework
- FRAMEWORK_PATH = '\\framework',
- //Subfolder containing example project
- EXAMPLE_PATH = '\\example',
- //Path to cordovalib folder, containing source for .dll
- CORDOVA_LIB = STANDALONE_PATH + '\\cordovalib',
+ // tooling scripts
+ SCRIPTS = '\\tooling\\scripts';
//Get version number
- VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,'');
- BASE_VERSION = VERSION.split('rc', 1) + ".0";
+ VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,''),
//Git Repositories
- CORDOVA_JS = "git://github.com/apache/cordova-js.git"
+ CORDOVA_JS = "git://github.com/apache/cordova-js.git";
//Destination to build to
var BUILD_DESTINATION;
@@ -95,82 +62,47 @@ var BUILD_DESTINATION;
// help function
function Usage()
{
- WScript.Echo("");
- WScript.Echo("This is a command line tool for building new releases.")
- WScript.Echo("Usage: dist <NEW_PATH_FOR_BUILD>");
- WScript.Echo("Creates a new cordova/wp7 project with the version taken");
- WScript.Echo("from the VERSION file in the root directory");
- WScript.Echo("");
+ WScript.StdOut.WriteLine("");
+ WScript.StdOut.WriteLine("This is a command line tool for building new releases.")
+ WScript.StdOut.WriteLine("Usage: dist <NEW_PATH_FOR_BUILD>");
+ WScript.StdOut.WriteLine("Creates and packages a new cordova/wp7 project, reversioning");
+ WScript.StdOut.WriteLine("it to match the VERSION file in the root directory.");
+ WScript.StdOut.WriteLine("");
}
-// generate unique project GUID - Not needed unless building an actual project (example?)
-function genGuid()
-{
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
- var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
- return v.toString(16);
- });
-}
-var ForReading = 1, ForWriting = 2, ForAppending = 8;
-var TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0;
-
-//Returns the contents of a file
+// returns the contents of a file
function read(filename) {
//WScript.Echo('Reading in ' + filename);
- var f=fso.OpenTextFile(filename, 1,2);
- var s=f.ReadAll();
- f.Close();
- return s;
-}
-
-//writes the contents to the specified file
-function write(filename, contents) {
- var f=fso.OpenTextFile(filename, ForWriting, TristateTrue);
- f.Write(contents);
- f.Close();
-}
-
-//Replaces the matches of regexp with replacement
-function replaceInFile(filename, regexp, replacement) {
- //WScript.Echo("Replaceing with "+replacement+ " in:");
- var text = read(filename).replace(regexp,replacement);
- //WScript.Echo(text);
- write(filename,text);
+ if(fso.FileExists(filename))
+ {
+ var f=fso.OpenTextFile(filename, 1,2);
+ var s=f.ReadAll();
+ f.Close();
+ return s;
+ }
+ else
+ {
+ WScript.StdOut.WriteLine('Cannot read non-existant file : ' + filename);
+ WScript.Quit(1);
+ }
+ return null;
}
-// exicutes a commmand in the shell
+// executes a commmand in the shell
function exec(command) {
+ //WScript.StdOut.WriteLine("Command: " + command);
var oShell=wscript_shell.Exec(command);
- while (oShell.Status == 0) {
- if(!oShell.StdOut.AtEndOfStream) {
+ while (oShell.Status != 1) {
+ while(!oShell.StdOut.AtEndOfStream) {
var line = oShell.StdOut.ReadLine();
// XXX: Change to verbose mode
- // WScript.StdOut.WriteLine(line);
+ WScript.StdOut.WriteLine(line);
}
WScript.sleep(100);
}
}
-function cleanUp() {
- WScript.Echo("Cleanup...")
- if(fso.FolderExists(BUILD_DESTINATION + '\\temp'))
- {
- //exec('rd /s ' + BUILD_DESTINATION + '\\temp');
- fso.DeleteFolder(BUILD_DESTINATION + '\\temp', true);
- }
- if(fso.FileExists(BUILD_DESTINATION + FULL_PATH + '\\MyTemplate.vstemplate')) {
- fso.DeleteFile(BUILD_DESTINATION + FULL_PATH + '\\MyTemplate.vstemplate');
- }
- if(fso.FileExists(BUILD_DESTINATION + STANDALONE_PATH + '\\MyTemplate.vstemplate')) {
- fso.DeleteFile(BUILD_DESTINATION + STANDALONE_PATH + '\\MyTemplate.vstemplate');
- }
-
- //Add any other cleanup here
-
- WScript.Echo("DONE!");
-}
-
/*************************************************/
/************** MAIN SCRIPT ********************/
@@ -199,212 +131,43 @@ else
}
-//WScript.Echo("Root Folder : " + ROOT);
-//WScript.Echo("CordovaLib Folder : " + CORDOVA_LIB);
-//WScript.Echo("VERSION : " + VERSION);
-//WScript.Echo("BASE_VERSION : " + BASE_VERSION);
-//WScript.Echo("Generated GUID : " + newProjGuid);
-
-
-
/*************************************************/
/****************** Step 1 *********************/
/*************************************************/
-/****** Copy source code to new directory ********/
+/** - Copy source code to new directory **/
/*************************************************/
-
-if(!REPLACE)
-{
- if(!GET_NEW) {
-
- if(fso.FolderExists(BUILD_DESTINATION))
- {
- WScript.Echo("Build directory already exists!");
- WScript.Quit(1);
- }
-
- //Set up file structure
- //exec('%comspec% /c mkdir ' + BUILD_DESTINATION);
- fso.CreateFolder(BUILD_DESTINATION);
-
- //Copy everything over to BUILD_DESTINATION
- var dest = shell.NameSpace(BUILD_DESTINATION);
-
- WScript.Echo("Copying files to build directory...");
- //Should we copy everything in the directory or just what we need? (ROOT may have other generated files in it)
- /** FOR EVERYTHING **
- var sourceItems = shell.NameSpace(ROOT).items();
- dest.CopyHere(sourceItems); */
-
- /** FOR JUST WHAT WE NEED - should copy by file instead? **/
- 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");
- }
- else {
- var CORDOVA_WP7 = 'git://github.com/apache/cordova-wp7.git';
- //var CORDOVA_WP7 = 'https://github.com/bennmapes/cordova-wp7.git';
-
- wscript_shell.CurrentDirectory = BUILD_DESTINATION + '\\..';
- BUILD_DESTINATION = wscript_shell.CurrentDirectory + '\\cordova-wp7';
-
- WScript.Echo('Cloning cordova-wp7 from git, build destination now ' + BUILD_DESTINATION);
- exec('git clone ' + CORDOVA_WP7); //git fetch --tags && git checkout?
- //exec('git checkout CB-2403');
-
- }
-}
+exec('cscript ' + ROOT + SCRIPTS + '\\new.js ' + BUILD_DESTINATION + ' //nologo');
/*************************************************/
/****************** Step 2 *********************/
/*************************************************/
-/*** Retag everything with new version numbers ***/
+/** - Retag everything with new version numbers **/
+/** - Delete any generated files and cordova.js **/
+/** - Rebuild dll **/
/*************************************************/
-WScript.Echo("Updating version numbers....");
-// 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 standalone project
-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);
-replaceInFile(BUILD_DESTINATION + STANDALONE_PATH + '\\www\\index.html', cordova_regex, "cordova-" + VERSION);
-var version_regex = /return\s*\"(\d+)[.](\d+)[.](\d+)(rc\d)?/; //Matches return "x.x.x[rcx]
-replaceInFile(BUILD_DESTINATION + CORDOVA_LIB + '\\Commands\\Device.cs', version_regex, "return \"" + VERSION);
-
-//Update full project
-dest = shell.NameSpace(BUILD_DESTINATION + FULL_PATH);
-dest.CopyHere(BUILD_DESTINATION + "\\VERSION", 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);
-version_regex = /\"WPCordovaClassLib\,\s*Version\=(\d+)[.](\d+)[.](\d+)[.](\d+)/; //Matches "WPCordovaClassLib, Version=x.x.x.x
-replaceInFile(BUILD_DESTINATION + FULL_PATH + '\\CordovaAppProj.csproj', version_regex, "\"WPCordovaClassLib, Version=" + BASE_VERSION);
-
-//Update example proj
-replaceInFile(BUILD_DESTINATION + EXAMPLE_PATH + '\\CordovaExample.csproj', cordova_regex, "cordova-" + VERSION);
-replaceInFile(BUILD_DESTINATION + EXAMPLE_PATH + '\\CordovaSourceDictionary.xml', cordova_regex, "cordova-" + VERSION);
-version_regex = /VERSION\s*\=\s*\'(\d+)[.](\d+)[.](\d+)(rc\d)?/; //Matches VERSION = x.x.x[rcx]
-replaceInFile(BUILD_DESTINATION + EXAMPLE_PATH + '\\www\\cordova-current.js', version_regex, "VERSION = \'" + VERSION);
-
-//Update template discription
-version_regex = /version\:\s*(\d+)[.](\d+)[.](\d+)(rc\d)?/; //Matches version: x.x.x[rcx]
-replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\description.txt', version_regex, "version: " + VERSION);
-
-//update .vstemplate files for the template zips.
-var name_regex = /CordovaWP7[_](\d+)[_](\d+)[_](\d+)(rc\d)?/g
-var discript_regex = /Cordova\s*(\d+)[.](\d+)[.](\d+)(rc\d)?/
-replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateFull.vstemplate', name_regex, 'CordovaWP7_' + VERSION.replace(/\./g, '_'));
-replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateFull.vstemplate', discript_regex, "Cordova " + VERSION);
-replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateFull.vstemplate', cordova_regex, "cordova-" + VERSION);
-
-replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate', name_regex, 'CordovaWP7_' + VERSION.replace(/\./g, '_'));
-replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate', discript_regex, "Cordova " + VERSION);
-replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate', cordova_regex, "cordova-" + VERSION);
-/*************************************************/
-/****************** Step 3 *********************/
-/*************************************************/
-/*** Download and build cordova.js for windows ***/
-/*************************************************/
-
-WScript.Echo("Creating cordova.js...");
-if(fso.FolderExists(BUILD_DESTINATION + '\\temp'))
-{
- fso.DeleteFolder(BUILD_DESTINATION + '\\temp', true);
-}
-//exec('mkdir ' + BUILD_DESTINATION + '\\temp');
-fso.CreateFolder(BUILD_DESTINATION + '\\temp');
-wscript_shell.CurrentDirectory = BUILD_DESTINATION + '\\temp';
-
-WScript.Echo('\tCloning js tagged with ' + VERSION + '...');
-//Grab the js taged with the specified VERSION
-exec('%comspec% /c git clone ' + CORDOVA_JS + ' && cd cordova-js && git fetch --tags && git checkout ' + VERSION );
-//WScript.sleep(5000);
-// build and copy over cordova.js
-WScript.Echo("\tBuilding Cordova.js...");
-wscript_shell.CurrentDirectory = BUILD_DESTINATION + '\\temp\\cordova-js';
-exec('%comspec% /c jake build');
-wscript_shell.CurrentDirectory = BUILD_DESTINATION + '\\temp\\cordova-js\\pkg';
-exec('%comspec% /c copy cordova.windowsphone.js ' + BUILD_DESTINATION + STANDALONE_PATH + '\\www\\cordova-' + VERSION + '.js');
-exec('%comspec% /c copy cordova.windowsphone.js ' + BUILD_DESTINATION + FULL_PATH + '\\www\\cordova-' + VERSION + '.js');
-exec('%comspec% /c copy cordova.windowsphone.js ' + BUILD_DESTINATION + EXAMPLE_PATH + '\\www\\cordova-' + VERSION + '.js');
+exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\reversion.js ' + VERSION + ' //nologo');
/*************************************************/
-/****************** Step 4 *********************/
+/****************** Step 3 *********************/
/*************************************************/
-/** Package framework & core plugins into .dll **/
+/** - Download tagged version of cordova.js **/
+/** - build cordova.js **/
+/** - windows.cordova.js -> templates + example **/
/*************************************************/
-WScript.Echo("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);
-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');
+exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\buildjs.js //nologo');
/*************************************************/
/****************** Step 5 *********************/
/*************************************************/
-/** Zip templates and inject into Visual Studio **/
+/** - Build templates **/
+/** - Zip templates **/
+/** - inject into Visual Studio **/
/*************************************************/
-WScript.Echo("Creating template .zip files ...");
-
-var standalone_zip = BUILD_DESTINATION + '\\CordovaWP7_' + VERSION.replace(/\./g, '_') + '_StandAlone.zip';
-var full_zip = BUILD_DESTINATION + '\\CordovaWP7_' + VERSION.replace(/\./g, '_') + '_Full.zip';
-if(fso.FileExists(standalone_zip))
-{
- fso.DeleteFile(standalone_zip);
-}
-if(fso.FileExists(full_zip))
-{
- fso.DeleteFile(full_zip);
-}
-
-exec('%comspec% /c copy ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateFull.vstemplate ' + BUILD_DESTINATION + FULL_PATH + '\\MyTemplate.vstemplate');
-exec('%comspec% /c copy ' + BUILD_DESTINATION + '\\VERSION ' + BUILD_DESTINATION + FULL_PATH);
-exec('%comspec% /c copy Bin\\Release\\WPCordovaClassLib.dll ' + BUILD_DESTINATION + FULL_PATH + '\\CordovaLib');
-
-exec('%comspec% /c copy ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate ' + BUILD_DESTINATION + STANDALONE_PATH + '\\MyTemplate.vstemplate');
-exec('%comspec% /c copy ' + BUILD_DESTINATION + '\\VERSION ' + BUILD_DESTINATION + STANDALONE_PATH);
-
-exec('cscript ' + BUILD_DESTINATION + '\\tooling\\scripts\\win-zip.js ' + full_zip + ' ' + BUILD_DESTINATION + FULL_PATH + '\\');
-exec('cscript ' + BUILD_DESTINATION + '\\tooling\\scripts\\win-zip.js ' + standalone_zip + ' ' + BUILD_DESTINATION + STANDALONE_PATH + '\\');
-
-
-if(ADD_TO_VS)
-{
- var template_dir = wscript_shell.ExpandEnvironmentStrings("%USERPROFILE%") + '\\Documents\\Visual Studio 2012\\Templates\\ProjectTemplates';
- if(fso.FolderExists(template_dir ))
- {
- dest = shell.NameSpace(template_dir);
- dest.CopyHere(standalone_zip, 20);
- dest.CopyHere(full_zip, 20);
- }
- else
- {
- WScript.Echo("Could not find template directory in Visual Studio,\n you can manually copy over the template .zip files.")
- }
-}
-
-cleanUp();
\ No newline at end of file
+exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\package.js //nologo');
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/scripts/emulate.bat
----------------------------------------------------------------------
diff --git a/tooling/scripts/emulate.bat b/tooling/scripts/emulate.bat
index b3375fe..a4f8f1c 100644
--- a/tooling/scripts/emulate.bat
+++ b/tooling/scripts/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 "%~dp0\deploy.js" %1 -emulate //nologo
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/scripts/new.bat
----------------------------------------------------------------------
diff --git a/tooling/scripts/new.bat b/tooling/scripts/new.bat
new file mode 100644
index 0000000..be7fa40
--- /dev/null
+++ b/tooling/scripts/new.bat
@@ -0,0 +1,18 @@
+:: 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 "%~dp0\new.js" %* //nologo
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/scripts/new.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/new.js b/tooling/scripts/new.js
new file mode 100644
index 0000000..d04f977
--- /dev/null
+++ b/tooling/scripts/new.js
@@ -0,0 +1,163 @@
+/*
+ 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.
+*/
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+ shell = WScript.CreateObject("shell.application"),
+ wscript_shell = WScript.CreateObject("WScript.Shell");
+
+var args = WScript.Arguments,
+ //Root folder of cordova-wp7 (i.e C:\Cordova\cordova-wp7)
+ ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+ //Sub folder containing templates
+ TEMPLATES_PATH = '\\templates',
+ //Sub folder for standalone project
+ STANDALONE_PATH = TEMPLATES_PATH + '\\standalone',
+ //Sub folder for full project
+ FULL_PATH = TEMPLATES_PATH + '\\full',
+ //Sub folder containing framework
+ FRAMEWORK_PATH = '\\framework',
+ //Subfolder containing example project
+ EXAMPLE_PATH = '\\example';
+
+//Destination to build to
+var BUILD_DESTINATION;
+// pull the project down from github?
+var GET_NEW = false;
+//Add templates to visual studio?
+var ADD_TO_VS = false;
+
+// help function
+function Usage()
+{
+ WScript.StdOut.WriteLine("");
+ WScript.StdOut.WriteLine("Usage: new [ PathToDestinationFolder ]");
+ WScript.StdOut.WriteLine(" PathToDestinationFolder : Folder you wish to be created for a new cordova-wp7 repo");
+ WScript.StdOut.WriteLine("examples:");
+ WScript.StdOut.WriteLine(" new C:\\Users\\anonymous\\Desktop\\cordova-wp7");
+ WScript.StdOut.WriteLine("");
+}
+
+// returns the contents of a file
+function read(filename) {
+ //WScript.StdOut.WriteLine('Reading in ' + filename);
+ if(fso.FileExists(filename))
+ {
+ var f=fso.OpenTextFile(filename, 1,2);
+ var s=f.ReadAll();
+ f.Close();
+ return s;
+ }
+ else
+ {
+ WScript.StdOut.WriteLine('Cannot read non-existant file : ' + filename);
+ WScript.Quit(1);
+ }
+ return null;
+}
+
+// executes a commmand in the shell
+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);
+ }
+}
+
+function copy_to(path)
+{
+ //Copy everything over to BUILD_DESTINATION
+ var dest = shell.NameSpace(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");
+}
+
+WScript.StdOut.WriteLine("");
+
+if(args.Count() > 0)
+{
+ if(fso.FolderExists(args(0)))
+ {
+ WScript.StdOut.WriteLine("The given directory already exists!");
+ Usage();
+ WScript.Quit(1);
+ }
+ else
+ {
+ BUILD_DESTINATION = args(0);
+
+ }
+
+ if(!GET_NEW) {
+
+ if(fso.FolderExists(BUILD_DESTINATION))
+ {
+ WScript.StdOut.WriteLine("The given directory already exists!");
+ Usage();
+ WScript.Quit(1);
+ }
+ else
+ {
+ BUILD_DESTINATION = args(0);
+ }
+
+ // set up file structure
+ fso.CreateFolder(BUILD_DESTINATION);
+ // copy nessisary files
+ copy_to(BUILD_DESTINATION);
+ }
+ else
+ {
+ var CORDOVA_WP7 = 'git://github.com/apache/cordova-wp7.git';
+
+ wscript_shell.CurrentDirectory = arg(0) + '\\..';
+ BUILD_DESTINATION = wscript_shell.CurrentDirectory + '\\cordova-wp7';
+
+ WScript.StdOut.WriteLine('Cloning cordova-wp7 from git, build destination now ' + BUILD_DESTINATION);
+ if(fso.FolderExists(BUILD_DESTINATION))
+ {
+ WScript.StdOut.WriteLine("Could not clone cordova-wp7 from git because it's directory already exists!");
+ WScript.Quit(1);
+ }
+
+ exec('git clone ' + CORDOVA_WP7); //git fetch --tags && git checkout?
+
+ }
+}
+else
+{
+ Usage();
+ WScript.Quit(1);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/scripts/package.bat
----------------------------------------------------------------------
diff --git a/tooling/scripts/package.bat b/tooling/scripts/package.bat
new file mode 100644
index 0000000..0ecc9d4
--- /dev/null
+++ b/tooling/scripts/package.bat
@@ -0,0 +1,18 @@
+:: 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 "%~dp0\package.js" %* //nologo
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/scripts/package.js
----------------------------------------------------------------------
diff --git a/tooling/scripts/package.js b/tooling/scripts/package.js
new file mode 100644
index 0000000..fe418d0
--- /dev/null
+++ b/tooling/scripts/package.js
@@ -0,0 +1,219 @@
+/*
+ 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.
+*/
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject'),
+ shell = WScript.CreateObject("shell.application"),
+ wscript_shell = WScript.CreateObject("WScript.Shell");
+
+var args = WScript.Arguments,
+ // root folder of cordova-wp7 (i.e C:\Cordova\cordova-wp7)
+ ROOT = WScript.ScriptFullName.split('\\tooling\\', 1),
+ // sub folder containing templates
+ TEMPLATES_PATH = '\\templates',
+ // sub folder for standalone project
+ STANDALONE_PATH = TEMPLATES_PATH + '\\standalone',
+ // sub folder for full project
+ FULL_PATH = TEMPLATES_PATH + '\\full',
+ // sub folder containing framework
+ FRAMEWORK_PATH = '\\framework',
+ // subfolder containing example project
+ EXAMPLE_PATH = '\\example',
+ // get version number
+ VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,''),
+ BASE_VERSION = VERSION.split('rc', 1) + ".0";
+
+// destination directory to package
+var BUILD_DESTINATION;
+// add templates to visual studio?
+var ADD_TO_VS = false;
+
+// help function
+function Usage()
+{
+ WScript.StdOut.WriteLine("");
+ WScript.StdOut.WriteLine("Usage: package [ PathToCordovaWP7 ]");
+ WScript.StdOut.WriteLine(" PathToCordovaWP7 : Cordova-wp7 repo you wish to package for release");
+ WScript.StdOut.WriteLine("examples:");
+ WScript.StdOut.WriteLine(" package C:\\Users\\anonymous\\Desktop\\cordova-wp7");
+ WScript.StdOut.WriteLine(" package // packages current cordova directory");
+ WScript.StdOut.WriteLine("");
+}
+
+// returns the contents of a file
+function read(filename) {
+ //WScript.StdOut.WriteLine('Reading in ' + filename);
+ if(fso.FileExists(filename))
+ {
+ var f=fso.OpenTextFile(filename, 1,2);
+ var s=f.ReadAll();
+ f.Close();
+ return s;
+ }
+ else
+ {
+ WScript.StdOut.WriteLine('ERROR: Cannot read non-existant file : ' + filename);
+ WScript.Quit(1);
+ }
+ return null;
+}
+
+// executes a commmand in the shell
+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);
+ }
+}
+
+// packages templates into .zip
+function package_templates()
+{
+ WScript.StdOut.WriteLine("Creating template .zip files ...");
+
+ var standalone_zip = BUILD_DESTINATION + '\\CordovaWP7_' + VERSION.replace(/\./g, '_') + '_StandAlone.zip';
+ var full_zip = BUILD_DESTINATION + '\\CordovaWP7_' + VERSION.replace(/\./g, '_') + '_Full.zip';
+ if(fso.FileExists(standalone_zip))
+ {
+ fso.DeleteFile(standalone_zip);
+ }
+ if(fso.FileExists(full_zip))
+ {
+ fso.DeleteFile(full_zip);
+ }
+
+ exec('%comspec% /c copy ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateFull.vstemplate ' + BUILD_DESTINATION + FULL_PATH + '\\MyTemplate.vstemplate');
+ exec('%comspec% /c copy ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\pg_templateIcon.png ' + BUILD_DESTINATION + FULL_PATH + '\\__TemplateIcon.png');
+ exec('%comspec% /c copy ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\pg_templatePreview.jpg ' + BUILD_DESTINATION + FULL_PATH + '\\__PreviewImage.jpg');
+ exec('%comspec% /c copy ' + BUILD_DESTINATION + '\\VERSION ' + BUILD_DESTINATION + FULL_PATH);
+ if(fso.FileExists(BUILD_DESTINATION + FRAMEWORK_PATH + '\\Bin\\Release\\WPCordovaClassLib.dll'))
+ {
+ exec('%comspec% /c copy Bin\\Release\\WPCordovaClassLib.dll ' + BUILD_DESTINATION + FULL_PATH + '\\CordovaLib');
+ }
+ else
+ {
+ WScript.StdOut.WriteLine("ERROR: WPCordovaClassLib.dll No found! Unable to fully package cordova.");
+ WScript.StdOut.WriteLine("PACKAGE FAILED.");
+ WScript.Quit(1);
+ }
+
+ exec('%comspec% /c copy ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\MyTemplateStandAlone.vstemplate ' + BUILD_DESTINATION + STANDALONE_PATH + '\\MyTemplate.vstemplate');
+ exec('%comspec% /c copy ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\pg_templateIcon.png ' + BUILD_DESTINATION + STANDALONE_PATH + '\\__TemplateIcon.png');
+ exec('%comspec% /c copy ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\pg_templatePreview.jpg ' + BUILD_DESTINATION + STANDALONE_PATH + '\\__PreviewImage.jpg');
+ exec('%comspec% /c copy ' + BUILD_DESTINATION + '\\VERSION ' + BUILD_DESTINATION + STANDALONE_PATH);
+
+ exec('cscript ' + BUILD_DESTINATION + '\\tooling\\scripts\\win-zip.js ' + full_zip + ' ' + BUILD_DESTINATION + FULL_PATH + '\\');
+ exec('cscript ' + BUILD_DESTINATION + '\\tooling\\scripts\\win-zip.js ' + standalone_zip + ' ' + BUILD_DESTINATION + STANDALONE_PATH + '\\');
+
+
+ if(ADD_TO_VS)
+ {
+ var template_dir = wscript_shell.ExpandEnvironmentStrings("%USERPROFILE%") + '\\Documents\\Visual Studio 2012\\Templates\\ProjectTemplates';
+ if(fso.FolderExists(template_dir ))
+ {
+ dest = shell.NameSpace(template_dir);
+ dest.CopyHere(standalone_zip, 20);
+ dest.CopyHere(full_zip, 20);
+ }
+ else
+ {
+ WScript.StdOut.WriteLine("WARNING: Could not find template directory in Visual Studio,\n you can manually copy over the template .zip files.")
+ }
+ }
+}
+
+// builds the cordova dll and copys it to the full template
+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);
+ 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');
+}
+
+// delete any unnessisary files when finished
+function cleanUp() {
+
+ if(fso.FileExists(BUILD_DESTINATION + FULL_PATH + '\\MyTemplate.vstemplate')) {
+ fso.DeleteFile(BUILD_DESTINATION + FULL_PATH + '\\MyTemplate.vstemplate');
+ }
+ if(fso.FileExists(BUILD_DESTINATION + STANDALONE_PATH + '\\MyTemplate.vstemplate')) {
+ fso.DeleteFile(BUILD_DESTINATION + STANDALONE_PATH + '\\MyTemplate.vstemplate');
+ }
+ if(fso.FileExists(BUILD_DESTINATION + FULL_PATH + '\\__PreviewImage.jpg')) {
+ fso.DeleteFile(BUILD_DESTINATION + FULL_PATH + '\\__PreviewImage.jpg');
+ }
+ if(fso.FileExists(BUILD_DESTINATION + FULL_PATH + '\\__TemplateIcon.png')) {
+ fso.DeleteFile(BUILD_DESTINATION + FULL_PATH + '\\__TemplateIcon.png');
+ }
+ if(fso.FileExists(BUILD_DESTINATION + STANDALONE_PATH + '\\__PreviewImage.jpg')) {
+ fso.DeleteFile(BUILD_DESTINATION + STANDALONE_PATH + '\\__PreviewImage.jpg');
+ }
+ if(fso.FileExists(BUILD_DESTINATION + STANDALONE_PATH + '\\__TemplateIcon.png')) {
+ fso.DeleteFile(BUILD_DESTINATION + STANDALONE_PATH + '\\__TemplateIcon.png');
+ }
+ //Add any other cleanup here
+}
+
+
+WScript.StdOut.WriteLine("");
+
+if(args.Count() > 0)
+{
+ //Support help flags
+ if(args(0).indexOf("--help") > -1 ||
+ args(0).indexOf("/?") > -1 )
+ {
+ Usage();
+ WScript.Quit(1);
+ }
+
+ if(fso.FolderExists(args(0)) && fso.FolderExists(args(0) + '\\tooling'))
+ {
+ BUILD_DESTINATION = args(0);
+ }
+ else
+ {
+ WScript.StdOut.WriteLine("ERROR: The given directory is not a cordova-wp7 repo.");
+ Usage();
+ WScript.Quit(1);
+
+ }
+}
+else
+{
+ BUILD_DESTINATION = ROOT;
+}
+
+// build dll for full template
+//build_dll();
+// build/package the templates
+package_templates(BUILD_DESTINATION);
+
+cleanUp();
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/2a0b1662/tooling/scripts/reversion.bat
----------------------------------------------------------------------
diff --git a/tooling/scripts/reversion.bat b/tooling/scripts/reversion.bat
new file mode 100644
index 0000000..09900a4
--- /dev/null
+++ b/tooling/scripts/reversion.bat
@@ -0,0 +1,18 @@
+:: 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 "%~dp0\reversion.js" %* //nologo
\ No newline at end of file