You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ja...@apache.org on 2018/02/16 12:57:19 UTC

[cordova-windows] 01/03: general comments and TODO

This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-win10only
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 52ce711911a851c6691fb582fc4d8be846717e9b
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Fri Feb 16 13:56:00 2018 +0100

    general comments and TODO
---
 bin/lib/check_reqs.js              |  2 +-
 template/cordova/lib/build.js      | 10 ++++++----
 template/cordova/lib/deployment.js |  2 ++
 template/cordova/lib/package.js    |  2 +-
 template/cordova/lib/run.js        |  3 ++-
 5 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index 46f8d6a..7c2798b 100644
--- a/bin/lib/check_reqs.js
+++ b/bin/lib/check_reqs.js
@@ -343,7 +343,7 @@ module.exports.isWinSDKPresent = function (target_platform) {
 
 // Checks if min SDK required to build Windows Phone 8.1 project is present
 module.exports.isPhoneSDKPresent = function () {
-    return checkPhoneSdk('8.1', '8.1');
+    return checkPhoneSdk('8.1', '8.1'); // TODO
 };
 
 /**
diff --git a/template/cordova/lib/build.js b/template/cordova/lib/build.js
index 52c0c28..37ead69 100644
--- a/template/cordova/lib/build.js
+++ b/template/cordova/lib/build.js
@@ -84,6 +84,8 @@ module.exports.run = function run (buildOptions) {
 function getBuildTargets (isWinSwitch, isPhoneSwitch, buildConfig) {
     buildConfig = typeof buildConfig !== 'undefined' ? buildConfig : null;
 
+    // TODO This whole method can be super simplified as there is only one target
+ 
     var configXML = new ConfigParser(path.join(ROOT, 'config.xml'));
     var targets = [];
     var noSwitches = !(isPhoneSwitch || isWinSwitch);
@@ -337,6 +339,10 @@ function buildTargets (config, myBuildTargets, msbuild) {
 
     if (shouldBundle) {
         return buildsCompleted.then(function () {
+            // msbuild isn't capable of generating bundles unless you enable bundling for each individual arch
+            // However, that generates intermediate bundles, like "CordovaApp.Windows10_0.0.1.0_x64.appxbundle"
+            // We need to clear the intermediate bundles, or else "cordova run" will fail because of too
+            // many .appxbundle files.
             return clearIntermediatesAndGetPackage(bundleTerms, config, hasAnyCpu);
         });
     } else {
@@ -347,10 +353,6 @@ function buildTargets (config, myBuildTargets, msbuild) {
 }
 
 function clearIntermediatesAndGetPackage (bundleTerms, config, hasAnyCpu) {
-    // msbuild isn't capable of generating bundles unless you enable bundling for each individual arch
-    // However, that generates intermediate bundles, like "CordovaApp.Windows10_0.0.1.0_x64.appxbundle"
-    // We need to clear the intermediate bundles, or else "cordova run" will fail because of too
-    // many .appxbundle files.
     events.emit('verbose', 'Clearing intermediates...');
     var appPackagesPath = path.join(ROOT, 'AppPackages');
     var childDirectories = shell.ls(path.join(appPackagesPath, '*')).map(function (pathName) {
diff --git a/template/cordova/lib/deployment.js b/template/cordova/lib/deployment.js
index 5394e74..0efebc0 100644
--- a/template/cordova/lib/deployment.js
+++ b/template/cordova/lib/deployment.js
@@ -110,6 +110,8 @@ DeviceInfo.prototype.toString = function () {
     return this.index + '. ' + this.name + ' (' + this.type + ')';
 };
 
+// Deploy to Phone
+
 function AppDeployCmdTool (targetOsVersion) {
     if (!(this instanceof AppDeployCmdTool)) { throw new ReferenceError('Only create an AppDeployCmdTool as an instance object.'); }
 
diff --git a/template/cordova/lib/package.js b/template/cordova/lib/package.js
index 84a1f6e..4cb6226 100644
--- a/template/cordova/lib/package.js
+++ b/template/cordova/lib/package.js
@@ -88,7 +88,7 @@ module.exports.getPackageFileInfo = function (packageFile) {
     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(),
+            type: props[1].toLowerCase(), // TODO remove as this can be phone, windows or windows10
             arch: props[3].toLowerCase().substring(1),
             archs: props[3].toLowerCase().substring(1).split('_'),
             buildtype: props[5] ? props[5].substring(1).toLowerCase() : 'release',
diff --git a/template/cordova/lib/run.js b/template/cordova/lib/run.js
index 2d7b869..98e69fc 100644
--- a/template/cordova/lib/run.js
+++ b/template/cordova/lib/run.js
@@ -58,12 +58,13 @@ module.exports.run = function (options) {
 
     // Get build/deploy options
     var buildType = options.release ? 'release' : 'debug';
+    
     // CB-11478 Allow to specify 'archs' parameter as either cli or platform
     // option i.e. 'cordova run --archs' vs. 'cordova run -- --archs'
     var archs = options.archs || args.archs || ['anycpu'];
     if (typeof archs === 'string') { archs = archs.split(' '); }
-
     var buildArchs = archs.map(function (arch) { return arch.toLowerCase(); });
+
     var deployTarget = options.target ? options.target : (options.emulator ? 'emulator' : 'device');
 
     var buildTargets = build.getBuildTargets(args.win, args.phone);

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org