http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp7/templates/standalone/www/index.html ---------------------------------------------------------------------- diff --git a/lib/cordova-wp7/templates/standalone/www/index.html b/lib/cordova-wp7/templates/standalone/www/index.html index 31f61f4..e8fb3e5 100644 --- a/lib/cordova-wp7/templates/standalone/www/index.html +++ b/lib/cordova-wp7/templates/standalone/www/index.html @@ -33,7 +33,7 @@ <p class="event received">Device is Ready</p> </div> </div> - <script type="text/javascript" src="cordova-2.7.0.js"></script> + <script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="js/index.js"></script> <script type="text/javascript"> app.initialize();
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp7/templates/vs/MyTemplateStandAlone.vstemplate ---------------------------------------------------------------------- diff --git a/lib/cordova-wp7/templates/vs/MyTemplateStandAlone.vstemplate b/lib/cordova-wp7/templates/vs/MyTemplateStandAlone.vstemplate index 34b949d..e6579f7 100644 --- a/lib/cordova-wp7/templates/vs/MyTemplateStandAlone.vstemplate +++ b/lib/cordova-wp7/templates/vs/MyTemplateStandAlone.vstemplate @@ -1,13 +1,13 @@ <VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project"> <TemplateData> - <Name>CordovaWP7_2_7_0</Name> - <Description>Cordova 2.7.0 for Windows Phone 7.5 using the Cordova source code directly.</Description> + <Name>CordovaWP7_2_8_0rc1</Name> + <Description>Cordova 2.8.0rc1 for Windows Phone 7.5 using the Cordova source code directly.</Description> <ProjectType>CSharp</ProjectType> <ProjectSubType> </ProjectSubType> <SortOrder>1000</SortOrder> <CreateNewFolder>true</CreateNewFolder> - <DefaultName>CordovaWP7_2_7_0</DefaultName> + <DefaultName>CordovaWP7_2_8_0rc1</DefaultName> <ProvideDefaultName>true</ProvideDefaultName> <LocationField>Enabled</LocationField> <EnableLocationBrowseButton>true</EnableLocationBrowseButton> @@ -98,7 +98,7 @@ <ProjectItem ReplaceParameters="false" TargetFileName="SplashScreenImage.jpg">SplashScreenImage.jpg</ProjectItem> <ProjectItem ReplaceParameters="false" TargetFileName="VERSION">VERSION</ProjectItem> <Folder Name="www" TargetFolderName="www"> - <ProjectItem ReplaceParameters="true" TargetFileName="cordova-2.7.0.js">cordova-2.7.0.js</ProjectItem> + <ProjectItem ReplaceParameters="true" TargetFileName="cordova.js">cordova.js</ProjectItem> <Folder Name="css" TargetFolderName="css"> <ProjectItem ReplaceParameters="true" TargetFileName="index.css">index.css</ProjectItem> </Folder> @@ -110,6 +110,36 @@ <ProjectItem ReplaceParameters="true" TargetFileName="index.js">index.js</ProjectItem> </Folder> </Folder> + <Folder Name="cordova" TargetFolderName="cordova"> + <ProjectItem ReplaceParameters="false" TargetFileName="build.bat">build.bat</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="clean.bat">clean.bat</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="log.bat">log.bat</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="run.bat">run.bat</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="version.bat">version.bat</ProjectItem> + <Folder Name="lib" TargetFolderName="lib"> + <ProjectItem ReplaceParameters="false" TargetFileName="build.js">build.js</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="clean.js">clean.js</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="deploy.js">deploy.js</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="install-device.bat">install-device.bat</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="install-emulator.bat">install-emulator.bat</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="list-devices.bat">list-devices.bat</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="list-emulator-images.bat">list-emulator-images.bat</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="list-started-emulators.bat">list-started-emulators.bat</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="log.js">log.js</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="start-emulator.bat">start-emulator.bat</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="target-list.js">target-list.js</ProjectItem> + <Folder Name="CordovaDeploy" TargetFolderName="CordovaDeploy"> + <ProjectItem ReplaceParameters="false" TargetFileName="CordovaDeploy.sln">CordovaDeploy.sln</ProjectItem> + <Folder Name="CordovaDeploy" TargetFolderName="CordovaDeploy"> + <ProjectItem ReplaceParameters="false" TargetFileName="CordovaDeploy.csproj">CordovaDeploy.csproj</ProjectItem> + <ProjectItem ReplaceParameters="false" TargetFileName="Program.cs">Program.cs</ProjectItem> + <Folder Name="Properties" TargetFolderName="Properties"> + <ProjectItem ReplaceParameters="false" TargetFileName="AssemblyInfo.cs">AssemblyInfo.cs</ProjectItem> + </Folder> + </Folder> + </Folder> + </Folder> + </Folder> </Project> </TemplateContent> </VSTemplate> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp7/tooling/scripts/buildjs.js ---------------------------------------------------------------------- diff --git a/lib/cordova-wp7/tooling/scripts/buildjs.js b/lib/cordova-wp7/tooling/scripts/buildjs.js index b5c51ad..4bfba53 100644 --- a/lib/cordova-wp7/tooling/scripts/buildjs.js +++ b/lib/cordova-wp7/tooling/scripts/buildjs.js @@ -38,9 +38,6 @@ var args = WScript.Arguments, VERSION = read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,''), BUILD_DESTINATION; -function Log(msg) { - WScript.StdOut.WriteLine(msg); -} // help function function Usage() @@ -58,6 +55,16 @@ function Usage() Log(""); } +// logs messaged to stdout and stderr +function Log(msg, error) { + if (error) { + WScript.StdErr.WriteLine(msg); + } + else { + WScript.StdOut.WriteLine(msg); + } +} + // returns the contents of a file function read(filename) { //Log('Reading in ' + filename); @@ -101,7 +108,7 @@ function exec_verbose(command) { if(!oShell.StdErr.AtEndOfStream) { var err_line = oShell.StdErr.ReadAll(); - WScript.StdErr.WriteLine(err_line); + Log(err_line, true); WScript.Quit(1); } } @@ -134,8 +141,8 @@ function build_js(path) //copy the javascript wherever it needs to go. wscript_shell.CurrentDirectory = path + '\\temp\\cordova-js\\pkg'; - exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + STANDALONE_PATH + '\\www\\cordova-' + VERSION + '.js'); - exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + EXAMPLE_PATH + '\\www\\cordova-' + VERSION + '.js'); + exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + STANDALONE_PATH + '\\www\\cordova.js'); + exec('%comspec% /c copy /Y cordova.windowsphone.js ' + path + EXAMPLE_PATH + '\\www\\cordova.js'); //TODO: Delete old cordova.js (done in reversion.js) @@ -154,10 +161,10 @@ function set_path(some_arg) } else { - Log("ERROR: The given path is not a cordova-wp7 repo, or"); - Log(" does not exist. If your trying to reversion a"); - Log(" cordova repo other then this one, please provide"); - Log(" it's path in the form: -p:C:\\Path\\to\\repo"); + Log("ERROR: The given path is not a cordova-wp7 repo, or", true); + Log(" does not exist. If your trying to reversion a", true); + Log(" cordova repo other then this one, please provide", true); + Log(" it's path in the form: -p:C:\\Path\\to\\repo", true); WScript.Quit(1); } @@ -193,8 +200,8 @@ if(args.Count() > 0) else if(set_path(arg(0))) {} //do nothing else { - Log("The provided version number is invalid, please provide"); - Log(" a version number in the format Major.Minor.Fix[rc#]"); + Log("The provided version number is invalid, please provide", true); + Log(" a version number in the format Major.Minor.Fix[rc#]", true); Usage(); WScript.Quit(1); } http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp7/tooling/scripts/dist.js ---------------------------------------------------------------------- diff --git a/lib/cordova-wp7/tooling/scripts/dist.js b/lib/cordova-wp7/tooling/scripts/dist.js index 4303202..bca8b11 100644 --- a/lib/cordova-wp7/tooling/scripts/dist.js +++ b/lib/cordova-wp7/tooling/scripts/dist.js @@ -35,6 +35,9 @@ Famework var fso = WScript.CreateObject('Scripting.FileSystemObject'), wscript_shell = WScript.CreateObject("WScript.Shell"); +//Replace root directory or create new directory? +var replace = false; + //Set up directory structure of current release //arguments passed in var args = WScript.Arguments, @@ -49,8 +52,6 @@ var args = WScript.Arguments, var BUILD_DESTINATION; //current script that is running var current_script = "dist"; -// replace the directory -var replace = false; /*************************************************/ @@ -59,13 +60,14 @@ var replace = false; // help function -function Usage() { +function Usage() +{ Log(""); Log("This is a command line tool for building new releases. It will package a new release"); Log(" of a cordova-wp7 project, reversioning it to match the VERSION file in the root directory."); - Log("Usage: dist [ <NEW_PATH_FOR_BUILD> | -f ] "); - Log(" -f : force tool to reversion the current repositoy."); - Log(" <NEW_PATH_FOR_BUILD> : path to create the new reversioned repositoy in."); + Log("Usage: dist [ <PATH_TO_NEW_REPO> | -f ] "); + Log(" -f : reversion the repositoy this script is in."); + Log(" <PATH_TO_NEW_REPO> : path to create the new reversioned repositoy in."); Log(""); } @@ -79,17 +81,20 @@ function Log(msg, error) { } } + // returns the contents of a file function read(filename) { //Log('Reading in ' + filename); - if(fso.FileExists(filename)) { + if(fso.FileExists(filename)) + { var f=fso.OpenTextFile(filename, 1,2); var s=f.ReadAll(); f.Close(); return s; } - else { - Log('Cannot read non-existant file : ' + filename, true); + else + { + Log('Cannot read non-existant file : ' + filename); WScript.Quit(1); } return null; @@ -109,7 +114,8 @@ function exec(command) { } } //Check to make sure our scripts did not encounter an error - if(!oShell.StdErr.AtEndOfStream) { + if(!oShell.StdErr.AtEndOfStream) + { var err_line = oShell.StdErr.ReadAll(); Log(err_line, true); Log("ERROR: Could not complete distribution, failed while running: " + current_script, true); @@ -117,7 +123,8 @@ function exec(command) { } } -function space() { +function space() +{ Log(""); Log("*****************************************************"); Log(""); @@ -163,7 +170,6 @@ if (args.Count() > 0) { Log("Error : too many arguments provided.", true); WScript.Quit(1); } - } else { Usage(); @@ -200,9 +206,10 @@ space(); /** - build cordova.js **/ /** - windows.cordova.js -> templates + example **/ /*************************************************/ -current_script = "buildjs.js"; -exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\buildjs.js //nologo'); -space(); +// New Workflow does not require building the new js, it should already be in place. +// current_script = "buildjs.js"; +// exec('cscript ' + BUILD_DESTINATION + SCRIPTS + '\\buildjs.js //nologo'); +// space(); /*************************************************/ /****************** Step 5 *********************/ http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp7/tooling/scripts/package.js ---------------------------------------------------------------------- diff --git a/lib/cordova-wp7/tooling/scripts/package.js b/lib/cordova-wp7/tooling/scripts/package.js index f3970a8..b5f882d 100644 --- a/lib/cordova-wp7/tooling/scripts/package.js +++ b/lib/cordova-wp7/tooling/scripts/package.js @@ -43,7 +43,6 @@ var ADD_TO_VS = false; // build the dll? var BUILD_DLL = false; -function Log(msg) { WScript.StdOut.WriteLine(msg); } // help function function Usage() @@ -57,6 +56,16 @@ function Usage() Log(""); } +// logs messaged to stdout and stderr +function Log(msg, error) { + if (error) { + WScript.StdErr.WriteLine(msg); + } + else { + WScript.StdOut.WriteLine(msg); + } +} + // returns the contents of a file function read(filename) { //Log('Reading in ' + filename); @@ -100,7 +109,7 @@ function exec_verbose(command) { if(!oShell.StdErr.AtEndOfStream) { var err_line = oShell.StdErr.ReadAll(); - WScript.StdErr.WriteLine(err_line); + Log(err_lin, true); WScript.Quit(1); } } @@ -121,7 +130,7 @@ function package_templates() exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\pg_templatePreview.jpg ' + BUILD_DESTINATION + STANDALONE_PATH + '\\__PreviewImage.jpg'); exec('%comspec% /c copy /Y ' + BUILD_DESTINATION + '\\VERSION ' + BUILD_DESTINATION + STANDALONE_PATH); - exec_verbose('cscript ' + BUILD_DESTINATION + '\\tooling\\scripts\\win-zip.js ' + template_path + ' ' + BUILD_DESTINATION + STANDALONE_PATH + '\\ //nologo'); + zip_project(template_path, BUILD_DESTINATION + STANDALONE_PATH); if(ADD_TO_VS) @@ -139,6 +148,41 @@ function package_templates() } } +function zip_project(zip_path, project_path) +{ + // create empty ZIP file and open for adding + var file = fso.CreateTextFile(zip_path, true); + + // create twenty-two byte "fingerprint" for .zip + file.write("PK"); + file.write(String.fromCharCode(5)); + file.write(String.fromCharCode(6)); + file.write('\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'); + file.Close(); + + // open .zip foder and copy contents of project_path to zip_path + var zipFolder = shell.NameSpace(zip_path); + var sourceItems = shell.NameSpace(project_path).items(); + if (zipFolder !== null) { + zipFolder.CopyHere(sourceItems, 4|20|16); + var maxTime = 5000; + while(zipFolder.items().Count < sourceItems.Count) + { + maxTime -= 100; + if(maxTime > 0 ) { + WScript.Sleep(100); + } + else { + Log('Failed to create .zip file.', true); + break; + } + } + } + else { + Log('Failed to create .zip file.', true); + } +} + // 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() { http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp7/tooling/scripts/reversion.js ---------------------------------------------------------------------- diff --git a/lib/cordova-wp7/tooling/scripts/reversion.js b/lib/cordova-wp7/tooling/scripts/reversion.js index 3b42fc4..8bf5ed1 100644 --- a/lib/cordova-wp7/tooling/scripts/reversion.js +++ b/lib/cordova-wp7/tooling/scripts/reversion.js @@ -24,6 +24,9 @@ var fso = WScript.CreateObject('Scripting.FileSystemObject'), shell = WScript.CreateObject("shell.application"), wscript_shell = WScript.CreateObject("WScript.Shell"); +//Get new version from git or build off this version? +var GET_NEW = false; + //Set up directory structure of current release //arguments passed in var args = WScript.Arguments, @@ -138,18 +141,9 @@ function updateVersionNumbers() { // update standalone project exec('%comspec% /c copy /Y /V ' + BUILD_DESTINATION + "\\VERSION " + BUILD_DESTINATION + STANDALONE_PATH + "\\VERSION"); 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 + '\\www\\index.html', cordova_regex, "cordova-" + VERSION); version_regex = /return\s*\"(\d+)[.](\d+)[.](\d+)(rc\d)?/; //Matches return "x.x.x[rcx] - - WScript.StdOut.WriteLine("path = " + BUILD_DESTINATION + CORDOVA_LIB + '\\Plugins\\Device.cs'); replaceInFile(BUILD_DESTINATION + CORDOVA_LIB + '\\..\\Plugins\\Device.cs', version_regex, "return \"" + VERSION); - // update example proj - replaceInFile(BUILD_DESTINATION + EXAMPLE_PATH + '\\CordovaExample.csproj', 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 = /Cordova\s*(\d+)[.](\d+)[.](\d+)(rc\d)?\s*Windows/g; //Matches version: x.x.x[rcx] replaceInFile(BUILD_DESTINATION + TEMPLATES_PATH + '\\vs\\description.txt', version_regex, "Cordova " + VERSION + " Windows"); @@ -160,7 +154,6 @@ function updateVersionNumbers() { 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); } // delete all cordova.js and generated files (templates) from old version numbers http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp7/tooling/scripts/win-zip.js ---------------------------------------------------------------------- diff --git a/lib/cordova-wp7/tooling/scripts/win-zip.js b/lib/cordova-wp7/tooling/scripts/win-zip.js deleted file mode 100644 index 3d8dc1a..0000000 --- a/lib/cordova-wp7/tooling/scripts/win-zip.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Script for zipping the contents of a directory. - */ - -// get commman line arguments -var objArgs = WScript.Arguments; -var zipPath = objArgs(0); -var sourcePath = objArgs(1); - - -// create empty ZIP file and open for adding -var fso = new ActiveXObject("Scripting.FileSystemObject"); -var file = fso.CreateTextFile(zipPath, true); - -// create twenty-two byte "fingerprint" for .zip -file.write("PK"); -file.write(String.fromCharCode(5)); -file.write(String.fromCharCode(6)); -file.write('\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'); -file.Close(); - -// open .zip foder and copy contents of sourcePath -var objShell = new ActiveXObject("shell.application"); -var zipFolder = objShell.NameSpace(zipPath); -var sourceItems = objShell.NameSpace(sourcePath).items(); -if (zipFolder !== null) { - zipFolder.CopyHere(sourceItems, 4|20|16); - WScript.Sleep(4000); -} -else { - WScript.StdErr.WriteLine('Failed to create .zip file.'); -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp8/VERSION ---------------------------------------------------------------------- diff --git a/lib/cordova-wp8/VERSION b/lib/cordova-wp8/VERSION index 9aa3464..1277c83 100644 --- a/lib/cordova-wp8/VERSION +++ b/lib/cordova-wp8/VERSION @@ -1 +1 @@ -2.7.0 \ No newline at end of file +2.8.0rc1 http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp8/bin/create.js ---------------------------------------------------------------------- diff --git a/lib/cordova-wp8/bin/create.js b/lib/cordova-wp8/bin/create.js index d5e7c46..c4c789e 100644 --- a/lib/cordova-wp8/bin/create.js +++ b/lib/cordova-wp8/bin/create.js @@ -210,6 +210,9 @@ function create(path, namespace, name, guid) { } } + //clean up any Bin/obj or other generated files + exec('cscript ' + path + '\\cordova\\lib\\clean.js //nologo'); + Log("CREATE SUCCESS : " + path); // TODO: Name the project according to the arguments http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp8/framework/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/lib/cordova-wp8/framework/Properties/AssemblyInfo.cs b/lib/cordova-wp8/framework/Properties/AssemblyInfo.cs index 4ed7003..4f2cdeb 100644 --- a/lib/cordova-wp8/framework/Properties/AssemblyInfo.cs +++ b/lib/cordova-wp8/framework/Properties/AssemblyInfo.cs @@ -6,7 +6,7 @@ using System.Runtime.InteropServices; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("WPCordovaClassLib")] -[assembly: AssemblyDescription("2.7.0")] +[assembly: AssemblyDescription("2.8.0rc1")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Apache Cordova")] [assembly: AssemblyProduct("WPCordovaClassLib")] @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("2.7.0.0")] -[assembly: AssemblyFileVersion("2.7.0.0")] +[assembly: AssemblyVersion("2.8.0.0")] +[assembly: AssemblyFileVersion("2.8.0.0")] http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp8/templates/standalone/CordovaAppProj.csproj ---------------------------------------------------------------------- diff --git a/lib/cordova-wp8/templates/standalone/CordovaAppProj.csproj b/lib/cordova-wp8/templates/standalone/CordovaAppProj.csproj index 23e4eef..7db5dd3 100644 --- a/lib/cordova-wp8/templates/standalone/CordovaAppProj.csproj +++ b/lib/cordova-wp8/templates/standalone/CordovaAppProj.csproj @@ -137,7 +137,6 @@ <Compile Include="cordovalib\OrientationHelper.cs" /> <Compile Include="cordovalib\PluginResult.cs" /> <Compile Include="cordovalib\ScriptCallback.cs" /> - <Compile Include="MainPage.xaml.cs"> <DependentUpon>MainPage.xaml</DependentUpon> </Compile> @@ -152,37 +151,33 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> - - <Page Include="Plugins\UI\AudioRecorder.xaml"> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </Page> - <Page Include="Plugins\UI\ImageCapture.xaml"> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </Page> - <Page Include="Plugins\UI\NotificationBox.xaml"> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </Page> - <Page Include="Plugins\UI\VideoRecorder.xaml"> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </Page> <Page Include="MainPage.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> </ItemGroup> - <ItemGroup> <Content Include="www\**" /> + <None Include="cordova\lib\build.js" /> + <None Include="cordova\lib\clean.js" /> + <None Include="cordova\lib\deploy.js" /> + <None Include="cordova\lib\log.js" /> + <None Include="cordova\lib\target-list.js" /> <Content Include="config.xml" /> <Content Include="Images\**" /> - <Content Include="resources\notification-beep.wav" /> + <None Include="cordova\build.bat" /> + <None Include="cordova\clean.bat" /> + <None Include="cordova\lib\install-device.bat" /> + <None Include="cordova\lib\install-emulator.bat" /> + <None Include="cordova\lib\list-devices.bat" /> + <None Include="cordova\lib\list-emulator-images.bat" /> + <None Include="cordova\lib\list-started-emulators.bat" /> + <None Include="cordova\lib\start-emulator.bat" /> + <None Include="cordova\log.bat" /> + <None Include="cordova\run.bat" /> + <None Include="cordova\version.bat" /> <None Include="VERSION" /> - <None Include="Properties\AppManifest.xml"> <SubType>Designer</SubType> </None> @@ -205,9 +200,59 @@ <ItemGroup> <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" /> </ItemGroup> +<ItemGroup> + <Compile Include="Plugins\Accelerometer.cs" /> + <Compile Include="Plugins\AudioFormatsHelper.cs" /> + <Compile Include="Plugins\AudioPlayer.cs" /> + <Compile Include="Plugins\Battery.cs" /> + <Compile Include="Plugins\Camera.cs" /> + <Compile Include="Plugins\Capture.cs" /> + <Compile Include="Plugins\Compass.cs" /> + <Compile Include="Plugins\Contacts.cs" /> + <Compile Include="Plugins\DebugConsole.cs" /> + <Compile Include="Plugins\Device.cs" /> + <Compile Include="Plugins\File.cs" /> + <Compile Include="Plugins\FileTransfer.cs" /> + <Compile Include="Plugins\GeoLocation.cs" /> + <Compile Include="Plugins\Globalization.cs" /> + <Compile Include="Plugins\ImageExifHelper.cs" /> + <Compile Include="Plugins\InAppBrowser.cs" /> + <Compile Include="Plugins\Media.cs" /> + <Compile Include="Plugins\MimeTypeMapper.cs" /> + <Compile Include="Plugins\NetworkStatus.cs" /> + <Compile Include="Plugins\Notification.cs" /> + <Compile Include="Plugins\UI\AudioCaptureTask.cs" /> + <Compile Include="Plugins\UI\AudioRecorder.xaml.cs" > + <DependentUpon>AudioRecorder.xaml</DependentUpon> + </Compile> + <Compile Include="Plugins\UI\ImageCapture.xaml.cs" > + <DependentUpon>ImageCapture.xaml</DependentUpon> + </Compile> + <Compile Include="Plugins\UI\NotificationBox.xaml.cs" > + <DependentUpon>NotificationBox.xaml</DependentUpon> + </Compile> + <Compile Include="Plugins\UI\VideoCaptureTask.cs" /> + <Compile Include="Plugins\UI\VideoRecorder.xaml.cs" > + <DependentUpon>VideoRecorder.xaml</DependentUpon> + </Compile> + </ItemGroup> <ItemGroup> - <Compile Include="Plugins\*" /> - <Compile Include="Plugins\UI\*.cs" /> + <Page Include="Plugins\UI\AudioRecorder.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Plugins\UI\ImageCapture.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Plugins\UI\NotificationBox.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Plugins\UI\VideoRecorder.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> </ItemGroup> <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" /> http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp8/templates/standalone/Plugins/Device.cs ---------------------------------------------------------------------- diff --git a/lib/cordova-wp8/templates/standalone/Plugins/Device.cs b/lib/cordova-wp8/templates/standalone/Plugins/Device.cs index 07100ae..52b124e 100644 --- a/lib/cordova-wp8/templates/standalone/Plugins/Device.cs +++ b/lib/cordova-wp8/templates/standalone/Plugins/Device.cs @@ -73,7 +73,7 @@ namespace WPCordovaClassLib.Cordova.Commands get { // TODO: should be able to dynamically read the Cordova version from somewhere... - return "2.7.0"; + return "2.8.0rc1"; } } http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp8/templates/standalone/VERSION ---------------------------------------------------------------------- diff --git a/lib/cordova-wp8/templates/standalone/VERSION b/lib/cordova-wp8/templates/standalone/VERSION index 9aa3464..1277c83 100644 --- a/lib/cordova-wp8/templates/standalone/VERSION +++ b/lib/cordova-wp8/templates/standalone/VERSION @@ -1 +1 @@ -2.7.0 \ No newline at end of file +2.8.0rc1 http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp8/templates/standalone/cordova/lib/clean.js ---------------------------------------------------------------------- diff --git a/lib/cordova-wp8/templates/standalone/cordova/lib/clean.js b/lib/cordova-wp8/templates/standalone/cordova/lib/clean.js index 3a8c871..b091425 100644 --- a/lib/cordova-wp8/templates/standalone/cordova/lib/clean.js +++ b/lib/cordova-wp8/templates/standalone/cordova/lib/clean.js @@ -50,32 +50,43 @@ function Log(msg, error) { // cleans any generated files in the cordova project function clean_project(path) { - if (fso.FolderExists(path + "\\obj")) { - fso.DeleteFolder(path + "\\obj"); - } - if (fso.FolderExists(path + "\\Bin")) { - fso.DeleteFolder(path + "\\Bin"); + delete_if_exists(path + "\\obj"); + delete_if_exists(path + "\\Bin"); + + // checks to see if a .csproj file exists in the project root + if (fso.FolderExists(path)) { + var proj_folder = fso.GetFolder(path); + var proj_files = new Enumerator(proj_folder.Files); + for (;!proj_files.atEnd(); proj_files.moveNext()) { + if (fso.GetExtensionName(proj_files.item()) == 'user') { + delete_if_exists(proj_files.item()) + } else if (fso.GetExtensionName(proj_files.item()) == 'sou') { + delete_if_exists(proj_files.item()) + } + } } - //TODO: delete CordovaAppProj.csproj.user as well? Service References? + //TODO: delete Service References? } // cleans any files generated by build --debug function clean_debug(path) { - if (fso.FolderExists(path + "\\obj\\Debug")) { - fso.DeleteFolder(path + "\\obj\\Debug"); - } - if (fso.FolderExists(path + "\\Bin\\Debug")) { - fso.DeleteFolder(path + "\\Bin\\Debug"); - } + delete_if_exists(path + "\\obj\\Debug"); + delete_if_exists(path + "\\Bin\\Debug"); } // cleans any files generated by build --release function clean_release(path) { - if (fso.FolderExists(path + "\\obj\\Release")) { - fso.DeleteFolder(path + "\\obj\\Release"); + delete_if_exists(path + "\\obj\\Release"); + delete_if_exists(path + "\\Bin\\Release"); +} + +// deletes the path element if it exists +function delete_if_exists(path) { + if (fso.FolderExists(path)) { + fso.DeleteFolder(path); } - if (fso.FolderExists(path + "\\Bin\\Release")) { - fso.DeleteFolder(path + "\\Bin\\Release"); + else if (fso.FileExists(path)) { + fso.DeleteFile(path); } } http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp8/templates/standalone/cordova/version.bat ---------------------------------------------------------------------- diff --git a/lib/cordova-wp8/templates/standalone/cordova/version.bat b/lib/cordova-wp8/templates/standalone/cordova/version.bat new file mode 100644 index 0000000..714e876 --- /dev/null +++ b/lib/cordova-wp8/templates/standalone/cordova/version.bat @@ -0,0 +1,9 @@ +@ECHO OFF +SET full_path=%~dp0 +IF EXIST "%full_path%..\VERSION" ( + type "%full_path%..\VERSION" +) ELSE ( + ECHO. + ECHO ERROR: Could not find file VERSION in project folder + EXIT /B 1 +) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp8/templates/standalone/cordovalib/ConfigHandler.cs ---------------------------------------------------------------------- diff --git a/lib/cordova-wp8/templates/standalone/cordovalib/ConfigHandler.cs b/lib/cordova-wp8/templates/standalone/cordovalib/ConfigHandler.cs index 06806d3..de57471 100644 --- a/lib/cordova-wp8/templates/standalone/cordovalib/ConfigHandler.cs +++ b/lib/cordova-wp8/templates/standalone/cordovalib/ConfigHandler.cs @@ -5,7 +5,6 @@ using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; -using System.Threading.Tasks; using System.Windows; using System.Windows.Resources; using System.Xml.Linq; @@ -29,6 +28,8 @@ namespace WPCordovaClassLib.CordovaLib protected List<string> AllowedDomains; protected Dictionary<string, string> Preferences; + public string ContentSrc { get; private set; } + protected bool AllowAllDomains = false; protected bool AllowAllPlugins = false; @@ -108,7 +109,6 @@ namespace WPCordovaClassLib.CordovaLib public bool URLIsAllowed(string url) { - // Debug.WriteLine("Testing URLIsAllowed : " + url); // easy case first if (this.AllowAllDomains) { @@ -160,21 +160,60 @@ namespace WPCordovaClassLib.CordovaLib { get { + // TODO: var res = from results in AllowedPlugins.TakeWhile(p => p.Value.isAutoLoad) select results.Value.Name; - foreach (var s in res) + return new string[] { "", "asd" }; + } + } + + private void LoadPluginFeatures(XDocument document) + { + var plugins = from results in document.Descendants("plugin") + select new + { + name = (string)results.Attribute("name"), + autoLoad = results.Attribute("onload") + }; + + foreach (var plugin in plugins) + { + Debug.WriteLine("Warning: Deprecated use of <plugin> by plugin : " + plugin.name); + PluginConfig pConfig = new PluginConfig(plugin.name, plugin.autoLoad != null && plugin.autoLoad.Value == "true"); + if (pConfig.Name == "*") { - Debug.WriteLine(s); + AllowAllPlugins = true; + // break; wait, don't, some still could be autoload } - //string[] res = from results in (AllowedPlugins.Where(p => p.Value.isAutoLoad) ) - // select (string)results.Key; + else + { + AllowedPlugins[pConfig.Name] = pConfig; + } + } - return new string[] { "", "asd" }; + var features = document.Descendants("feature"); + + + foreach (var feature in features) + { + var name = feature.Attribute("name"); + var values = from results in feature.Descendants("param") + where ((string)results.Attribute("name") == "wp-package") + select results; + + var value = values.FirstOrDefault(); + if(value != null) + { + string key = (string)value.Attribute("value"); + Debug.WriteLine("Adding feature.value=" + key); + var onload = value.Attribute("onload"); + PluginConfig pConfig = new PluginConfig(key,onload != null && onload.Value == "true"); + AllowedPlugins[key] = pConfig; + } } } - public void LoadAppPackageConfig() { StreamResourceInfo streamInfo = Application.GetResourceStream(new Uri("config.xml", UriKind.Relative)); @@ -185,27 +224,7 @@ namespace WPCordovaClassLib.CordovaLib //This will Read Keys Collection for the xml file XDocument document = XDocument.Parse(sr.ReadToEnd()); - var plugins = from results in document.Descendants("plugin") - select new - { - name = (string)results.Attribute("name"), - autoLoad = results.Attribute("onload") - }; - - foreach (var plugin in plugins) - { - Debug.WriteLine("plugin " + plugin.name); - PluginConfig pConfig = new PluginConfig(plugin.name, plugin.autoLoad != null && plugin.autoLoad.Value == "true"); - if (pConfig.Name == "*") - { - AllowAllPlugins = true; - // break; wait, don't, some still could be autoload - } - else - { - AllowedPlugins.Add(pConfig.Name, pConfig); - } - } + LoadPluginFeatures(document); var preferences = from results in document.Descendants("preference") select new @@ -216,6 +235,7 @@ namespace WPCordovaClassLib.CordovaLib foreach (var pref in preferences) { + Preferences[pref.name] = pref.value; Debug.WriteLine("pref" + pref.name + ", " + pref.value); } @@ -230,6 +250,13 @@ namespace WPCordovaClassLib.CordovaLib { AddWhiteListEntry(accessElem.origin, accessElem.subdomains); } + + var contentsTag = document.Descendants("content").FirstOrDefault(); + if (contentsTag != null) + { + var src = contentsTag.Attribute("src"); + ContentSrc = (string)src.Value; + } } else { http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp8/templates/standalone/cordovalib/CordovaView.xaml ---------------------------------------------------------------------- diff --git a/lib/cordova-wp8/templates/standalone/cordovalib/CordovaView.xaml b/lib/cordova-wp8/templates/standalone/cordovalib/CordovaView.xaml index 41d7631..fce54bb 100644 --- a/lib/cordova-wp8/templates/standalone/cordovalib/CordovaView.xaml +++ b/lib/cordova-wp8/templates/standalone/cordovalib/CordovaView.xaml @@ -31,7 +31,7 @@ <Grid x:Name="LayoutRoot" Background="Transparent"> <phone:WebBrowser x:Name="CordovaBrowser" - Opacity="0" + Opacity="0.0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsScriptEnabled="True" @@ -45,15 +45,13 @@ Navigating="CordovaBrowser_Navigating" NavigationFailed="CordovaBrowser_NavigationFailed" IsGeolocationEnabled="True"> - <phone:WebBrowser.Projection> - <PlaneProjection x:Name="BrowserProjector" CenterOfRotationX="0" RotationY="-180"/> - </phone:WebBrowser.Projection> - <phone:WebBrowser.Resources> - <Storyboard x:Name="RotateIn" BeginTime="0:0:0.5"> - <DoubleAnimation - Storyboard.TargetName="BrowserProjector" - Storyboard.TargetProperty="RotationY" - To="0" Duration="0:0:0.6"/> + + <phone:WebBrowser.Resources> + <Storyboard x:Name="FadeIn"> + <DoubleAnimation Duration="0:0:0.6" + To="1.0" + Storyboard.TargetName="CordovaBrowser" + Storyboard.TargetProperty="Opacity"/> </Storyboard> </phone:WebBrowser.Resources> http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1309777e/lib/cordova-wp8/templates/standalone/cordovalib/CordovaView.xaml.cs ---------------------------------------------------------------------- diff --git a/lib/cordova-wp8/templates/standalone/cordovalib/CordovaView.xaml.cs b/lib/cordova-wp8/templates/standalone/cordovalib/CordovaView.xaml.cs index 7b92f65..e1ad8da 100644 --- a/lib/cordova-wp8/templates/standalone/cordovalib/CordovaView.xaml.cs +++ b/lib/cordova-wp8/templates/standalone/cordovalib/CordovaView.xaml.cs @@ -106,6 +106,7 @@ namespace WPCordovaClassLib if (_startPageUri == null) { // default + return new Uri(AppRoot + "www/index.html", UriKind.Relative); } else @@ -162,6 +163,18 @@ namespace WPCordovaClassLib configHandler = new ConfigHandler(); configHandler.LoadAppPackageConfig(); + if (configHandler.ContentSrc != null) + { + if (Uri.IsWellFormedUriString(configHandler.ContentSrc, UriKind.Absolute)) + { + this.StartPageUri = new Uri(configHandler.ContentSrc, UriKind.Absolute); + } + else + { + this.StartPageUri = new Uri(AppRoot + "www/" + configHandler.ContentSrc, UriKind.Relative); + } + } + nativeExecution = new NativeExecution(ref this.CordovaBrowser); bmHelper = new BrowserMouseHelper(ref this.CordovaBrowser); } @@ -382,7 +395,7 @@ namespace WPCordovaClassLib string[] autoloadPlugs = this.configHandler.AutoloadPlugins; foreach (string plugName in autoloadPlugs) { - // nativeExecution.ProcessCommand(commandCallParams); + //nativeExecution.ProcessCommand(commandCallParams); } string nativeReady = "(function(){ cordova.require('cordova/channel').onNativeReady.fire()})();"; @@ -398,8 +411,7 @@ namespace WPCordovaClassLib if (this.CordovaBrowser.Opacity < 1) { - this.CordovaBrowser.Opacity = 1; - RotateIn.Begin(); + FadeIn.Begin(); } }
