From d783f2073430492e59d99009b30411fb8e8e897a Mon Sep 17 00:00:00 2001 From: daserge Date: Wed, 3 Feb 2016 10:52:05 +0300 Subject: [PATCH 1/3] CB-10480 Remove Windows 8 template from cordova-windows Adds a friendly error message for windows-target-version = 8.0 --- bin/lib/create.js | 4 +- cordova-js-src/platform.js | 7 +- ...dovaApp.Windows_0.0.1.0_anycpu_debug.appx} | 0 template/CordovaApp.Windows80.jsproj | 83 ---------- template/CordovaApp.vs2012.sln | 64 -------- template/cordova/lib/build.js | 149 +++++++----------- template/cordova/lib/package.js | 2 +- template/cordova/lib/prepare.js | 28 ++-- template/package.windows80.appxmanifest | 50 ------ template/www/cordova.js | 11 +- 10 files changed, 75 insertions(+), 323 deletions(-) rename spec/unit/fixtures/EmptyProject/AppPackages/{CordovaApp.Windows80_0.0.1.0_anycpu_debug_Test/CordovaApp.Windows80_0.0.1.0_anycpu_debug.appx => CordovaApp.Windows_0.0.1.0_anycpu_debug_Test/CordovaApp.Windows_0.0.1.0_anycpu_debug.appx} (100%) delete mode 100644 template/CordovaApp.Windows80.jsproj delete mode 100644 template/CordovaApp.vs2012.sln delete mode 100644 template/package.windows80.appxmanifest diff --git a/bin/lib/create.js b/bin/lib/create.js index 22e713a6..9663db9d 100644 --- a/bin/lib/create.js +++ b/bin/lib/create.js @@ -89,8 +89,8 @@ module.exports.create = function (destinationDir, config, options, events) { // replace specific values in manifests' templates events.emit('verbose', 'Updating manifest files with project configuration.'); - [ 'package.windows.appxmanifest', 'package.windows80.appxmanifest', - 'package.phone.appxmanifest', 'package.windows10.appxmanifest' ] + [ 'package.windows.appxmanifest', 'package.phone.appxmanifest', + 'package.windows10.appxmanifest' ] .forEach(function (item) { var manifest = AppxManifest.get(path.join(projectPath, item)); if (manifest.hasPhoneIdentity) { diff --git a/cordova-js-src/platform.js b/cordova-js-src/platform.js index 002017f9..4350c147 100644 --- a/cordova-js-src/platform.js +++ b/cordova-js-src/platform.js @@ -20,9 +20,7 @@ */ module.exports = { - // for backward compatibility we report 'windows8' when run on Windows 8.0 and - // 'windows' for Windows 8.1 and Windows Phone 8.1 - id: (navigator.appVersion.indexOf("MSAppHost/1.0") !== -1) ? 'windows8' : 'windows', + id: 'windows', bootstrap:function() { var cordova = require('cordova'), exec = require('cordova/exec'), @@ -80,9 +78,6 @@ module.exports = { } else if (navigator.appVersion.indexOf("MSAppHost/2.0;") !== -1) { // windows 8.1 + IE 11 scriptElem.src = "//Microsoft.WinJS.2.0/js/base.js"; - } else { - // windows 8.0 + IE 10 - scriptElem.src = "//Microsoft.WinJS.1.0/js/base.js"; } scriptElem.addEventListener("load", onWinJSReady); document.head.appendChild(scriptElem); diff --git a/spec/unit/fixtures/EmptyProject/AppPackages/CordovaApp.Windows80_0.0.1.0_anycpu_debug_Test/CordovaApp.Windows80_0.0.1.0_anycpu_debug.appx b/spec/unit/fixtures/EmptyProject/AppPackages/CordovaApp.Windows_0.0.1.0_anycpu_debug_Test/CordovaApp.Windows_0.0.1.0_anycpu_debug.appx similarity index 100% rename from spec/unit/fixtures/EmptyProject/AppPackages/CordovaApp.Windows80_0.0.1.0_anycpu_debug_Test/CordovaApp.Windows80_0.0.1.0_anycpu_debug.appx rename to spec/unit/fixtures/EmptyProject/AppPackages/CordovaApp.Windows_0.0.1.0_anycpu_debug_Test/CordovaApp.Windows_0.0.1.0_anycpu_debug.appx diff --git a/template/CordovaApp.Windows80.jsproj b/template/CordovaApp.Windows80.jsproj deleted file mode 100644 index 5b84ae69..00000000 --- a/template/CordovaApp.Windows80.jsproj +++ /dev/null @@ -1,83 +0,0 @@ - - - - - build\windows80\$(Configuration)\$(Platform)\ - build\windows80\bld\ - - - - Debug - AnyCPU - - - Debug - ARM - - - Debug - x64 - - - Debug - x86 - - - Release - AnyCPU - - - Release - ARM - - - Release - x64 - - - Release - x86 - - - - efffab2f-bfc5-4eda-b545-45ef4995f55a - - - 11.0 - - - - - - Windows - 8.0 - - - - Designer - - - - - - - - - diff --git a/template/CordovaApp.vs2012.sln b/template/CordovaApp.vs2012.sln deleted file mode 100644 index b08ca942..00000000 --- a/template/CordovaApp.vs2012.sln +++ /dev/null @@ -1,64 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -# -# 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. -# -Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "CordovaApp.Windows8.0", "CordovaApp.Windows80.jsproj", "{EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|AnyCPU = Debug|AnyCPU - Debug|ARM = Debug|ARM - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|AnyCPU = Release|AnyCPU - Release|ARM = Release|ARM - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|AnyCPU.Build.0 = Debug|Any CPU - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|AnyCPU.Deploy.0 = Debug|Any CPU - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|ARM.ActiveCfg = Debug|ARM - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|ARM.Build.0 = Debug|ARM - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|ARM.Deploy.0 = Debug|ARM - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x64.ActiveCfg = Debug|x64 - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x64.Build.0 = Debug|x64 - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x64.Deploy.0 = Debug|x64 - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x86.ActiveCfg = Debug|x86 - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x86.Build.0 = Debug|x86 - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Debug|x86.Deploy.0 = Debug|x86 - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|AnyCPU.ActiveCfg = Release|Any CPU - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|AnyCPU.Build.0 = Release|Any CPU - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|AnyCPU.Deploy.0 = Release|Any CPU - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|ARM.ActiveCfg = Release|ARM - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|ARM.Build.0 = Release|ARM - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|ARM.Deploy.0 = Release|ARM - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x64.ActiveCfg = Release|x64 - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x64.Build.0 = Release|x64 - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x64.Deploy.0 = Release|x64 - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x86.ActiveCfg = Release|x86 - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x86.Build.0 = Release|x86 - {EFFFAB2F-BFC5-4EDA-B545-45EF4995F55A}.Release|x86.Deploy.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/template/cordova/lib/build.js b/template/cordova/lib/build.js index 93352231..d9246276 100644 --- a/template/cordova/lib/build.js +++ b/template/cordova/lib/build.js @@ -35,13 +35,11 @@ var CordovaError = require('cordova-common').CordovaError; var projFiles = { phone: 'CordovaApp.Phone.jsproj', win: 'CordovaApp.Windows.jsproj', - win80: 'CordovaApp.Windows80.jsproj', win10: 'CordovaApp.Windows10.jsproj' }; var projFilesToManifests = { 'CordovaApp.Phone.jsproj': 'package.phone.appxmanifest', 'CordovaApp.Windows.jsproj': 'package.windows.appxmanifest', - 'CordovaApp.Windows80.jsproj': 'package.windows80.appxmanifest', 'CordovaApp.Windows10.jsproj': 'package.windows10.appxmanifest' }; @@ -71,8 +69,7 @@ module.exports.run = function run (buildOptions) { if (buildConfig.publisherId) { updateManifestWithPublisher(msbuildTools, buildConfig); } - // bug: Windows 8 build fails on a system with MSBuild 14 on it. - // Don't regress, make sure MSBuild 4 is selected for a Windows 8 build. + cleanIntermediates(); return buildTargets(msbuildTools, buildConfig).then(function(pkg) { events.emit('verbose', ' BUILD OUTPUT: ' + pkg.appx); @@ -107,19 +104,18 @@ module.exports.getBuildTargets = function(isWinSwitch, isPhoneSwitch, projOverr if (isWinSwitch || noSwitches) { // if --win or no arg var windowsTargetVersion = configXML.getWindowsTargetVersion(); switch(windowsTargetVersion.toLowerCase()) { - case '8': - case '8.0': - targets.push(projFiles.win80); - break; - case '8.1': - targets.push(projFiles.win); - break; - case '10.0': - case 'uap': - targets.push(projFiles.win10); - break; - default: - throw new CordovaError('Unsupported windows-target-version value: ' + windowsTargetVersion); + case '8': + case '8.0': + throw new CordovaError('windows8 platform is deprecated. To use windows-target-version=8.0 you may downgrade to cordova-windows@4.'); + case '8.1': + targets.push(projFiles.win); + break; + case '10.0': + case 'uap': + targets.push(projFiles.win10); + break; + default: + throw new CordovaError('Unsupported windows-target-version value: ' + windowsTargetVersion); } } @@ -127,20 +123,20 @@ module.exports.getBuildTargets = function(isWinSwitch, isPhoneSwitch, projOverr if (isPhoneSwitch || noSwitches) { // if --phone or no arg var windowsPhoneTargetVersion = configXML.getWindowsPhoneTargetVersion(); switch(windowsPhoneTargetVersion.toLowerCase()) { - case '8.1': - targets.push(projFiles.phone); - break; - case '10.0': - case 'uap': - if (targets.indexOf(projFiles.win10) < 0) { - // Already built due to --win or no switches - // and since the same thing can be run on Phone as Windows, - // we can skip this one. - targets.push(projFiles.win10); - } - break; - default: - throw new Error('Unsupported windows-phone-target-version value: ' + windowsPhoneTargetVersion); + case '8.1': + targets.push(projFiles.phone); + break; + case '10.0': + case 'uap': + if (targets.indexOf(projFiles.win10) < 0) { + // Already built due to --win or no switches + // and since the same thing can be run on Phone as Windows, + // we can skip this one. + targets.push(projFiles.win10); + } + break; + default: + throw new Error('Unsupported windows-phone-target-version value: ' + windowsPhoneTargetVersion); } } @@ -301,12 +297,6 @@ function buildTargets(allMsBuildVersions, config) { var bundleTerms = ''; var hasAnyCpu = false; var shouldBundle = !!config.bundle; - if (myBuildTargets.indexOf(projFiles.win80) > -1) { - if (shouldBundle) { - events.emit('warn', 'Bundling is disabled because a Windows 8 project was detected.'); - } - shouldBundle = false; - } // collect all build configurations (pairs of project to build and target architecture) myBuildTargets.forEach(function(buildTarget) { @@ -337,10 +327,6 @@ function buildTargets(allMsBuildVersions, config) { if (build.arch == 'any cpu') { build.arch = 'anycpu'; } - // msbuild 4.0 requires .sln file, we can't build jsproj - if (msbuild.version == '4.0' && build.target == projFiles.win80) { - build.target = 'CordovaApp.vs2012.sln'; - } var otherProperties = { }; // Only add the CordovaBundlePlatforms argument when on the last build step @@ -416,19 +402,18 @@ function getBuildTargets(buildConfig) { if (buildConfig.win || noSwitches) { // if --win or no arg var windowsTargetVersion = configXML.getWindowsTargetVersion(); switch(windowsTargetVersion) { - case '8': - case '8.0': - targets.push(projFiles.win80); - break; - case '8.1': - targets.push(projFiles.win); - break; - case '10.0': - case 'UAP': - targets.push(projFiles.win10); - break; - default: - throw new Error('Unsupported windows-target-version value: ' + windowsTargetVersion); + case '8': + case '8.0': + throw new CordovaError('windows8 platform is deprecated. To use windows-target-version=8.0 you may downgrade to cordova-windows@4.'); + case '8.1': + targets.push(projFiles.win); + break; + case '10.0': + case 'UAP': + targets.push(projFiles.win10); + break; + default: + throw new Error('Unsupported windows-target-version value: ' + windowsTargetVersion); } } @@ -436,20 +421,20 @@ function getBuildTargets(buildConfig) { if (buildConfig.phone || noSwitches) { // if --phone or no arg var windowsPhoneTargetVersion = configXML.getWindowsPhoneTargetVersion(); switch(windowsPhoneTargetVersion) { - case '8.1': - targets.push(projFiles.phone); - break; - case '10.0': - case 'UAP': - if (!buildConfig.win && !noSwitches) { - // Already built due to --win or no switches - // and since the same thing can be run on Phone as Windows, - // we can skip this one. - targets.push(projFiles.win10); - } - break; - default: - throw new Error('Unsupported windows-phone-target-version value: ' + windowsPhoneTargetVersion); + case '8.1': + targets.push(projFiles.phone); + break; + case '10.0': + case 'UAP': + if (!buildConfig.win && !noSwitches) { + // Already built due to --win or no switches + // and since the same thing can be run on Phone as Windows, + // we can skip this one. + targets.push(projFiles.win10); + } + break; + default: + throw new Error('Unsupported windows-phone-target-version value: ' + windowsPhoneTargetVersion); } } @@ -475,9 +460,6 @@ function getBuildTargets(buildConfig) { // as part of build configuration. This will be used for determining the binary to 'run' after build is done. if (targets.length > 0) { switch (targets[0]) { - case projFiles.win80: - buildConfig.targetProject = 'windows80'; - break; case projFiles.phone: buildConfig.targetProject = 'phone'; break; @@ -502,30 +484,14 @@ function getMsBuildForTargets(selectedTargets, buildConfig, allMsBuildVersions) return obj; }, {}); - var result = null; - - if (selectedTargets.indexOf(projFiles.win80) > -1) { - // building Windows 8; prefer 4.0, unless phone is also present, in which case prefer 12 - // prefer 12. If not present, can't build this; error in the filterSupportedTargets function - result = availableVersions['12.0'] || availableVersions['4.0']; - } else { - // 15 and 14 can build Windows 10, Windows 8.1, and Windows Phone 8.1, so resolve to those if available, else 12 - result = (availableVersions['15.0'] || availableVersions['14.0'] || availableVersions['12.0']); - } - - return result; + return availableVersions['15.0'] || availableVersions['14.0'] || availableVersions['12.0']; } // TODO: Fix this so that it outlines supported versions based on version criteria: // - v14: Windows 8.1, Windows 10 -// - v12: Windows 8.1, Windows 8.0 -// - v4: Windows 8.0 -function msBuild4TargetsFilter(target) { - return target === projFiles.win80; -} - +// - v12: Windows 8.1 function msBuild12TargetsFilter(target) { - return target === projFiles.win80 || target === projFiles.win || target === projFiles.phone; + return target === projFiles.win || target === projFiles.phone; } function msBuild14TargetsFilter(target) { @@ -543,7 +509,6 @@ function filterSupportedTargets (targets, msbuild) { } var targetFilters = { - '4.0': msBuild4TargetsFilter, '12.0': msBuild12TargetsFilter, '14.0': msBuild14TargetsFilter, '15.0': msBuild15TargetsFilter @@ -560,7 +525,7 @@ function filterSupportedTargets (targets, msbuild) { if (supportedTargets.length !== targets.length) { events.emit('warn', 'Not all desired build targets are compatible with the current build environment. ' + 'Please install Visual Studio 2015 for Windows 8.1 and Windows 10, ' + - 'or Visual Studio 2013 Update 2 for Windows 8 and 8.1.'); + 'or Visual Studio 2013 Update 2 for Windows 8.1.'); } return supportedTargets; } diff --git a/template/cordova/lib/package.js b/template/cordova/lib/package.js index cd3de0ee..5bd17e1a 100644 --- a/template/cordova/lib/package.js +++ b/template/cordova/lib/package.js @@ -81,7 +81,7 @@ module.exports.getPackageFileInfo = function (packageFile) { // CordovaApp.Phone_0.0.1.0_x86_debug.appxbundle // CordovaApp.Windows10_0.0.1.0_x64_x86_arm.appxbundle - var props = /.*\.(Phone|Windows|Windows80|Windows10)_((?:\d*\.)*\d*)*((?:_(AnyCPU|x86|x64|ARM)){1,4})(?:(_Debug))?.(appx|appxbundle)$/i.exec(pkgName); + var props = /.*\.(Phone|Windows|Windows10)_((?:\d*\.)*\d*)*((?:_(AnyCPU|x86|x64|ARM)){1,4})(?:(_Debug))?.(appx|appxbundle)$/i.exec(pkgName); if (props) { return { type : props[1].toLowerCase(), diff --git a/template/cordova/lib/prepare.js b/template/cordova/lib/prepare.js index 699e379c..e8a33555 100644 --- a/template/cordova/lib/prepare.js +++ b/template/cordova/lib/prepare.js @@ -30,7 +30,6 @@ var events = require('cordova-common').events; var xmlHelpers = require('cordova-common').xmlHelpers; var PROJECT_WINDOWS10 = 'CordovaApp.Windows10.jsproj', - MANIFEST_WINDOWS8 = 'package.windows80.appxmanifest', MANIFEST_WINDOWS = 'package.windows.appxmanifest', MANIFEST_PHONE = 'package.phone.appxmanifest', MANIFEST_WINDOWS10 = 'package.windows10.appxmanifest'; @@ -492,10 +491,6 @@ function updateConfigFilesFrom(sourceConfig, configMunger, locations) { var config = new ConfigParser(ownConfig); xmlHelpers.mergeXml(sourceConfig.doc.getroot(), config.doc.getroot(), 'windows', /*clobber=*/true); - // CB-6976 Windows Universal Apps. For smooth transition and to prevent mass api failures - // we allow using windows8 tag for new windows platform - xmlHelpers.mergeXml(sourceConfig.doc.getroot(), - config.doc.getroot(), 'windows8', /*clobber=*/true); config.write(); return config; @@ -520,17 +515,16 @@ function updateWwwFrom(cordovaProject, destinations) { shell.cp('-rf', path.join(destinations.platformWww, '*'), destinations.www); // If project contains 'merges' for our platform, use them as another overrides - // CB-6976 Windows Universal Apps. For smooth transition from 'windows8' platform - // we allow using 'windows8' merges for new 'windows' platform - ['windows8', 'windows'].forEach(function (platform) { - var mergesPath = path.join(cordovaProject.root, 'merges', platform); - // if no 'merges' directory found, no further actions needed - if (!fs.existsSync(mergesPath)) return; - - events.emit('verbose', 'Found "merges" for ' + platform + ' platform. Copying over existing "www" files.'); - var overrides = path.join(mergesPath, '*'); - shell.cp('-rf', overrides, destinations.www); - }); + var platform = 'windows'; + var mergesPath = path.join(cordovaProject.root, 'merges', platform); + // if no 'merges' directory found, no further actions needed + if (!fs.existsSync(mergesPath)) { + return; + } + + events.emit('verbose', 'Found "merges" for ' + platform + ' platform. Copying over existing "www" files.'); + var overrides = path.join(mergesPath, '*'); + shell.cp('-rf', overrides, destinations.www); } /** @@ -542,7 +536,7 @@ function updateWwwFrom(cordovaProject, destinations) { */ function updateProjectAccordingTo(projectConfig, locations) { // Apply appxmanifest changes - [MANIFEST_WINDOWS, MANIFEST_WINDOWS8, MANIFEST_WINDOWS10, MANIFEST_PHONE] + [MANIFEST_WINDOWS, MANIFEST_WINDOWS10, MANIFEST_PHONE] .forEach(function(manifestFile) { updateManifestFile(projectConfig, path.join(locations.root, manifestFile)); }); diff --git a/template/package.windows80.appxmanifest b/template/package.windows80.appxmanifest deleted file mode 100644 index c964a4b6..00000000 --- a/template/package.windows80.appxmanifest +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - $projectname$ - $username$ - images\storelogo.png - - - 6.2.1 - 6.2.1 - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/template/www/cordova.js b/template/www/cordova.js index 2929c569..e27887a3 100644 --- a/template/www/cordova.js +++ b/template/www/cordova.js @@ -817,7 +817,7 @@ module.exports = channel; }); -// file: e:/cordova/cordova-windows/cordova-js-src/exec.js +// file: d:/coho/cordova-windows/cordova-js-src/exec.js define("cordova/exec", function(require, exports, module) { /*jslint sloppy:true, plusplus:true*/ @@ -1394,13 +1394,11 @@ exports.reset(); }); -// file: e:/cordova/cordova-windows/cordova-js-src/platform.js +// file: d:/coho/cordova-windows/cordova-js-src/platform.js define("cordova/platform", function(require, exports, module) { module.exports = { - // for backward compatibility we report 'windows8' when run on Windows 8.0 and - // 'windows' for Windows 8.1 and Windows Phone 8.1 - id: (navigator.appVersion.indexOf("MSAppHost/1.0") !== -1) ? 'windows8' : 'windows', + id: 'windows', bootstrap:function() { var cordova = require('cordova'), exec = require('cordova/exec'), @@ -1458,9 +1456,6 @@ module.exports = { } else if (navigator.appVersion.indexOf("MSAppHost/2.0;") !== -1) { // windows 8.1 + IE 11 scriptElem.src = "//Microsoft.WinJS.2.0/js/base.js"; - } else { - // windows 8.0 + IE 10 - scriptElem.src = "//Microsoft.WinJS.1.0/js/base.js"; } scriptElem.addEventListener("load", onWinJSReady); document.head.appendChild(scriptElem); From 5f15c5eb0fc07cb3a37aaa2f436d03208b1cb80a Mon Sep 17 00:00:00 2001 From: daserge Date: Wed, 3 Feb 2016 10:53:28 +0300 Subject: [PATCH 2/3] CB-10480 Remove Windows 8 template from cordova-windows Updated check_reqs Updated the docs --- README.md | 6 ------ bin/lib/check_reqs.js | 17 ++++++++++------- cordova-windows10.md | 6 ++---- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index d2ae3c25..fa2a5101 100644 --- a/README.md +++ b/README.md @@ -43,12 +43,6 @@ Host OS: Windows 8.1 Install the tools: [Visual Studio 2013 Express](http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-8). -### Windows 8 only (deprecated) - -Host OS: Windows 8 or 8.1 - -Install the tools: [Visual Studio 2012 Express](http://www.visualstudio.com/downloads). - #Getting started The best way to use this is to install the [Cordova CLI](https://www.npmjs.com/package/cordova), create a project, add the windows platform, and run the app: diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js index 7ba036d8..42f67e73 100644 --- a/bin/lib/check_reqs.js +++ b/bin/lib/check_reqs.js @@ -43,12 +43,6 @@ try { // reference: https://msdn.microsoft.com/en-us/library/bb164659(v=vs.120).aspx var VS2013_UPDATE2_RC = new Version(12, 0, 30324); var REQUIRED_VERSIONS = { - '8.0': { - os: '6.2', - msbuild: '11.0', - visualstudio: '11.0', - windowssdk: '8.0' - }, '8.1': { os: '6.3', msbuild: '12.0', @@ -83,6 +77,15 @@ function getMinimalRequiredVersionFor (requirement) { var config = getConfig(); var windowsTargetVersion = config.getWindowsTargetVersion(); var windowsPhoneTargetVersion = config.getWindowsPhoneTargetVersion(); + + if (windowsTargetVersion === '8' || windowsTargetVersion === '8.0') { + throw new CordovaError('windows8 platform is deprecated. To use windows-target-version=8.0 you may downgrade to cordova-windows@4.'); + } + + if (windowsPhoneTargetVersion === '8' || windowsPhoneTargetVersion === '8.0') { + throw new CordovaError('8.0 is not a valid version for windows-phone-target-version (use the wp8 Cordova platform instead)'); + } + var windowsReqVersion = Version.tryParse(REQUIRED_VERSIONS[windowsTargetVersion][requirement]); var phoneReqVersion = Version.tryParse(REQUIRED_VERSIONS[windowsPhoneTargetVersion][requirement]); @@ -128,7 +131,7 @@ function getWindowsVersion() { } /** - * Lists all Visual Studio versions insalled. For VS 2013 if it present, alao + * Lists all Visual Studio versions insalled. For VS 2013 if it present, also * checks if Update 2 is installed. * * @return {String[]} List of installed Visual Studio versions. diff --git a/cordova-windows10.md b/cordova-windows10.md index f8927158..f1481841 100644 --- a/cordova-windows10.md +++ b/cordova-windows10.md @@ -41,7 +41,7 @@ To develop apps for Windows 10, you require: ### Web Context and Windows Runtime Access ### -In Windows 8 and 8.1, loading your app into the web context (using `ms-appx-web://`) would allow +In Windows 8.1, loading your app into the web context (using `ms-appx-web://`) would allow developers freedom of certain kinds of document manipulation (such as inline script) but would prevent Windows Runtime (WinRT) access. In Windows 10, many of these restrictions have been lifted; web applications have access to WinRT APIs as long as the page’s origin has been whitelisted in the @@ -106,8 +106,6 @@ package to target. * 10.0, UAP: Builds for Windows 10 Universal Windows Platform * 8.1: Builds for Windows 8.1 or Windows Phone 8.1 (the default) -* 8.0: Build for Windows 8.0. Not valid for Windows Phone (use the wp8 Cordova platform -instead) **Scenarios** @@ -128,7 +126,7 @@ restrictions, you must set this preference to `ms-appx://` and not declare any **Valid Values** -* `ms-appx://` (Default for Windows 8, 8.1): The start page runs in the local context +* `ms-appx://` (Default for Windows 8.1): The start page runs in the local context * `ms-appx-web://` (Default for Windows 10): The start page runs in the web context #### {SDK}-MinVersion, {SDK}-MaxVersionTested #### From 92a298a3189ce8ce9fe6973b49dbdc777835a62b Mon Sep 17 00:00:00 2001 From: daserge Date: Wed, 3 Feb 2016 10:53:36 +0300 Subject: [PATCH 3/3] CB-10480 Remove Windows 8 template from cordova-windows Updated the tests --- spec/unit/build.spec.js | 12 +++++++++--- spec/unit/package.spec.js | 35 +++++++++++++++++++---------------- spec/unit/run.spec.js | 6 +++--- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/spec/unit/build.spec.js b/spec/unit/build.spec.js index 28b4b2f8..31059063 100644 --- a/spec/unit/build.spec.js +++ b/spec/unit/build.spec.js @@ -249,8 +249,9 @@ describe('run method', function() { }); }); - it('spec.8 should call buildProject of MSBuildTools if built with MSBuildTools version 4.0', function(done) { - var buildSpy = jasmine.createSpy(); + it('spec.8 should fail buildProject if built with MSBuildTools version 4.0', function(done) { + var buildSpy = jasmine.createSpy(), + errorSpy = jasmine.createSpy(); build.__set__('utils.isCordovaProject', isCordovaProjectTrue); createFindAllAvailableVersionsMock([{version: '4.0', buildProject: buildSpy, path: testPath }]); @@ -258,8 +259,13 @@ describe('run method', function() { createConfigParserMock('8.0'); build.run({argv: ['--win']}) + .fail(function(error) { + errorSpy(); + expect(error).toBeDefined(); + }) .finally(function() { - expect(buildSpy).toHaveBeenCalled(); + expect(errorSpy).toHaveBeenCalled(); + expect(buildSpy).not.toHaveBeenCalled(); done(); }); }); diff --git a/spec/unit/package.spec.js b/spec/unit/package.spec.js index 6eeea4c1..ac604b2d 100644 --- a/spec/unit/package.spec.js +++ b/spec/unit/package.spec.js @@ -44,16 +44,19 @@ describe('getPackage method', function() { shell.cp('-R', testPkgPath, pkgRoot); }); - it('spec.1 should find windows 8.0 anycpu debug package', function(done) { + it('spec.1 should find windows anycpu debug package', function(done) { var rejected = jasmine.createSpy(); - pkg.getPackage('windows80', 'debug', 'anycpu') + pkg.getPackage('windows', 'debug', 'anycpu') .then(function(pkgInfo) { - expect(pkgInfo.type).toBe('windows80'); + expect(pkgInfo.type).toBe('windows'); expect(pkgInfo.buildtype).toBe('debug'); expect(pkgInfo.arch).toBe('anycpu'); expect(pkgInfo.script).toBeDefined(); - }, rejected) + }, function(err) { + console.error(err); + rejected(); + }) .finally(function() { expect(rejected).not.toHaveBeenCalled(); done(); @@ -76,10 +79,10 @@ describe('getPackage method', function() { }); }); - it('spec.3 should not find windows anycpu debug package', function(done) { + it('spec.3 should not find windows 10 anycpu debug package', function(done) { var resolved = jasmine.createSpy(); - pkg.getPackage('windows', 'debug', 'anycpu') + pkg.getPackage('windows10', 'debug', 'anycpu') .then(resolved) .finally(function() { expect(resolved).not.toHaveBeenCalled(); @@ -87,10 +90,10 @@ describe('getPackage method', function() { }); }); - it('spec.4 should not find windows 8.0 anycpu release package', function(done) { + it('spec.4 should not find windows anycpu release package', function(done) { var resolved = jasmine.createSpy(); - pkg.getPackage('windows80', 'release', 'anycpu') + pkg.getPackage('windows', 'release', 'anycpu') .then(resolved) .finally(function() { expect(resolved).not.toHaveBeenCalled(); @@ -98,10 +101,10 @@ describe('getPackage method', function() { }); }); - it('spec.5 should not find windows 8.0 x86 debug package', function(done) { + it('spec.5 should not find windows x86 debug package', function(done) { var resolved = jasmine.createSpy(); - pkg.getPackage('windows80', 'debug', 'x86') + pkg.getPackage('windows', 'debug', 'x86') .then(resolved) .finally(function() { expect(resolved).not.toHaveBeenCalled(); @@ -124,20 +127,20 @@ describe('getPackageFileInfo method', function() { expect(pkgInfo.buildtype).toBe('debug'); }); - it('spec.7 should get file info correctly for windows 8.0 anycpu debug package', function() { - var packageFile = path.join(pkgPath, 'CordovaApp.Windows80_0.0.1.0_anycpu_debug_Test', 'CordovaApp.Windows80_0.0.1.0_anycpu_debug.appx'); + it('spec.7 should get file info correctly for windows 8.1 anycpu debug package', function() { + var packageFile = path.join(pkgPath, 'CordovaApp.Windows_0.0.1.0_anycpu_debug_Test', 'CordovaApp.Windows_0.0.1.0_anycpu_debug.appx'); var pkgInfo = pkg.getPackageFileInfo(packageFile); - expect(pkgInfo.type).toBe('windows80'); + expect(pkgInfo.type).toBe('windows'); expect(pkgInfo.arch).toBe('anycpu'); expect(pkgInfo.buildtype).toBe('debug'); }); - it('spec.8 should get file info correctly for windows 8.0 x64 release package', function() { - var packageFile = path.join(pkgPath, 'CordovaApp.Windows80_0.0.1.0_x64_Test', 'CordovaApp.Windows80_0.0.1.0_x64.appx'); + it('spec.8 should get file info correctly for windows 8.1 x64 release package', function() { + var packageFile = path.join(pkgPath, 'CordovaApp.Windows_0.0.1.0_x64_Test', 'CordovaApp.Windows_0.0.1.0_x64.appx'); var pkgInfo = pkg.getPackageFileInfo(packageFile); - expect(pkgInfo.type).toBe('windows80'); + expect(pkgInfo.type).toBe('windows'); expect(pkgInfo.arch).toBe('x64'); expect(pkgInfo.buildtype).toBe('release'); }); diff --git a/spec/unit/run.spec.js b/spec/unit/run.spec.js index 179c4a7f..5a2cbd7f 100644 --- a/spec/unit/run.spec.js +++ b/spec/unit/run.spec.js @@ -183,7 +183,7 @@ describe('run method', function() { run.__set__('build.run', function () { build(); var buildResult = { - type : 'windows80', + type : 'windows', arch : 'anycpu', archs : ['anycpu'], buildtype : 'release', @@ -195,7 +195,7 @@ describe('run method', function() { }); run.__set__('packages.getPackage', function () { return Q({ - type: 'windows80', + type: 'windows', file: 'testfile' }); }); @@ -228,7 +228,7 @@ describe('run method', function() { }); run.__set__('packages.getPackage', function () { return Q({ - type: 'windows80', + type: 'windows', file: 'testfile' }); });