You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2019/12/22 17:39:56 UTC

[cordova-windows] 08/21: [XXX TBD ...] remove --appx param

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

brodybits pushed a commit to branch brodybits-uwp-only-wip001
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit e1277f0b8b70db0a1c3feac50bed92230e52b061
Author: Christopher J. Brody <ch...@brody.consulting>
AuthorDate: Sun Dec 22 12:21:16 2019 -0500

    [XXX TBD ...] remove --appx param
    
    TODO: remove appx from: spec/e2e/endtoend.spec.js
---
 spec/unit/build.spec.js         | 16 +-------------
 template/cordova/build          |  6 +-----
 template/cordova/lib/build.js   | 46 ++++++-----------------------------------
 template/cordova/lib/package.js |  3 ++-
 template/cordova/lib/run.js     |  9 ++------
 template/cordova/run            |  6 ------
 6 files changed, 12 insertions(+), 74 deletions(-)

diff --git a/spec/unit/build.spec.js b/spec/unit/build.spec.js
index 3939b87..137dca8 100644
--- a/spec/unit/build.spec.js
+++ b/spec/unit/build.spec.js
@@ -378,21 +378,7 @@ describe('run method', function () {
         var buildTools151 = { version: '15.1', buildProject: jasmine.createSpy('buildTools151'), path: testPath };
 
         createFindAllAvailableVersionsMock([buildTools14, buildTools15, buildTools151]);
-        // explicitly specify Windows 10 as target
-        return build.run({ argv: ['--appx=uap'] })
-            .then(() => {
-                expect(buildTools151.buildProject).toHaveBeenCalled();
-            });
-    });
-
-    it('spec.15b should choose latest version if there are multiple versions available with minor version difference', function () {
-        var buildTools14 = { version: '14.0', buildProject: jasmine.createSpy('buildTools14'), path: testPath };
-        var buildTools15 = { version: '15.0', buildProject: jasmine.createSpy('buildTools15'), path: testPath };
-        var buildTools151 = { version: '15.1', buildProject: jasmine.createSpy('buildTools151'), path: testPath };
-
-        createFindAllAvailableVersionsMock([buildTools14, buildTools15, buildTools151]);
-        // explicitly specify Windows 10 as target
-        return build.run({ argv: ['--appx=uap'] })
+        return build.run({argv: ['']})
             .then(() => {
                 expect(buildTools151.buildProject).toHaveBeenCalled();
             });
diff --git a/template/cordova/build b/template/cordova/build
index 5ed8a3c..5602ffd 100644
--- a/template/cordova/build
+++ b/template/cordova/build
@@ -41,10 +41,6 @@ if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >=
     console.log('                                  architectures (`anycpu`, `arm`, `x86`, `x64`).');
     console.log('                                  Separate multiple choices with spaces and if');
     console.log('                                  passing multiple choices, enclose with " ".');
-    console.log('    --appx=<8.1-win|8.1-phone|uap|uwp>');
-    console.log('                                : Overrides windows-target-version to build');
-    console.log('                                  Windows 8.1, Windows Phone 8.1, or');
-    console.log('                                  Windows 10 Universal.');
     console.log('    --packageCertificateKeyFile : Builds the project using provided certificate.');
     console.log('    --packageThumbprint         : Thumbprint associated with the certificate.');
     console.log('    --publisherId               : Sets publisher id field in manifest.');
@@ -56,7 +52,7 @@ if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >=
     console.log('    build --debug');
     console.log('    build --release');
     console.log('    build --release --archs="arm x86" --bundle');
-    console.log('    build --appx=8.1-phone -r');
+    console.log('    build -r');
     console.log('    build --packageCertificateKeyFile="CordovaApp_TemporaryKey.pfx"');
     console.log('    build --publisherId="CN=FakeCorp, C=US"');
     console.log('    build --buildConfig="build.json"');
diff --git a/template/cordova/lib/build.js b/template/cordova/lib/build.js
index ee1072c..bc2f378 100644
--- a/template/cordova/lib/build.js
+++ b/template/cordova/lib/build.js
@@ -58,7 +58,7 @@ module.exports.run = function run (buildOptions) {
     var buildConfig = parseAndValidateArgs(buildOptions);
 
     // get build targets
-    var selectedBuildTargets = getBuildTargets(buildConfig.win, buildConfig.phone, buildConfig.projVerOverride, buildConfig);
+    var selectedBuildTargets = getBuildTargets(buildConfig.win, buildConfig.phone, buildConfig);
 
     return MSBuildTools.getLatestMatchingMSBuild(selectedBuildTargets) // get latest msbuild tools
         .then(function (result) {
@@ -84,8 +84,8 @@ module.exports.run = function run (buildOptions) {
         });
 };
 
-// returns list of projects to be built based on config.xml and additional parameters (-appx)
-function getBuildTargets (isWinSwitch, isPhoneSwitch, projOverride, buildConfig) {
+// returns list of projects to be built based on config.xml and additional parameters
+function getBuildTargets (isWinSwitch, isPhoneSwitch, buildConfig) {
     buildConfig = typeof buildConfig !== 'undefined' ? buildConfig : null;
 
     var configXML = new ConfigParser(path.join(ROOT, 'config.xml'));
@@ -130,39 +130,6 @@ function getBuildTargets (isWinSwitch, isPhoneSwitch, projOverride, buildConfig)
         }
     }
 
-    // apply build target override if one was specified
-    if (projOverride) {
-        switch (projOverride.toLowerCase()) {
-        case 'uap':
-        case 'uwp':
-            targets = [projFiles.win10];
-            break;
-        default:
-            events.emit('warn', 'Ignoring unrecognized --appx parameter passed to build: "' + projOverride + '"');
-            break;
-        }
-    }
-
-    if (buildConfig !== null) {
-        // As part of reworking how build and package determine the winning project, set the 'target type' project
-        // 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.phone:
-                buildConfig.targetProject = 'phone';
-                break;
-            case projFiles.win10:
-                buildConfig.targetProject = 'windows10';
-                break;
-            case projFiles.win:
-                /* falls through */
-            default:
-                buildConfig.targetProject = 'windows';
-                break;
-            }
-        }
-    }
-
     return targets;
 }
 module.exports.getBuildTargets = getBuildTargets;
@@ -180,7 +147,6 @@ function parseAndValidateArgs (options) {
     // parse and validate args
     var args = nopt({
         'archs': [String],
-        'appx': String,
         'phone': Boolean,
         'win': Boolean,
         'bundle': Boolean,
@@ -211,7 +177,7 @@ function parseAndValidateArgs (options) {
 
     config.phone = !!args.phone;
     config.win = !!args.win;
-    config.projVerOverride = args.appx;
+
     // only set config.bundle if architecture is not anycpu
     if (args.bundle) {
         if (config.buildArchs.length > 1 && (config.buildArchs.indexOf('anycpu') > -1 || config.buildArchs.indexOf('any cpu') > -1)) {
@@ -369,7 +335,7 @@ function buildTargets (config, myBuildTargets, msbuild) {
             }
 
             // https://issues.apache.org/jira/browse/CB-12298
-            if (config.targetProject === 'windows10' && config.buildType === 'release') {
+            if (config.buildType === 'release') {
                 otherProperties.push('/p:UapAppxPackageBuildMode=StoreUpload');
             }
 
@@ -383,7 +349,7 @@ function buildTargets (config, myBuildTargets, msbuild) {
         });
     } else {
         return buildsCompleted.then(function () {
-            return pckage.getPackage(config.targetProject, config.buildType, config.buildArchs[0]);
+            return pckage.getPackage(config.buildType, config.buildArchs[0]);
         });
     }
 }
diff --git a/template/cordova/lib/package.js b/template/cordova/lib/package.js
index 5386074..ef0dba4 100644
--- a/template/cordova/lib/package.js
+++ b/template/cordova/lib/package.js
@@ -28,7 +28,8 @@ var CordovaError = require('cordova-common').CordovaError;
 
 // returns folder that contains package with chip architecture,
 // build and project types specified by script parameters
-module.exports.getPackage = function (projectType, buildtype, buildArch) {
+module.exports.getPackage = function (buildtype, buildArch) {
+    var projectType = 'windows10'; // TODO remove below
     var appPackages = path.resolve(path.join(__dirname, '..', '..', 'AppPackages'));
     // reject promise if AppPackages folder doesn't exist
     if (!fs.existsSync(appPackages)) {
diff --git a/template/cordova/lib/run.js b/template/cordova/lib/run.js
index a0ac238..bb871e0 100644
--- a/template/cordova/lib/run.js
+++ b/template/cordova/lib/run.js
@@ -43,7 +43,6 @@ module.exports.run = function (options) {
         'archs': [String],
         'phone': Boolean,
         'win': Boolean,
-        'appx': String,
         'win10tools': Boolean
     }, { 'r': '--release' }, options.argv, 0);
 
@@ -68,18 +67,14 @@ module.exports.run = function (options) {
     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, args.appx);
+    var buildTargets = build.getBuildTargets(args.win, args.phone);
 
     if (!buildTargets || buildTargets.length <= 0) {
         return Q.reject(new CordovaError('Unable to determine deploy target.'));
     }
 
-    // we deploy the first build target so we use buildTargets[0] to determine
-    // what project type we should deploy
-    var projectType = projFileToType(buildTargets[0]);
-
     // if --nobuild isn't specified then build app first
-    var buildPackages = options.nobuild ? packages.getPackage(projectType, buildType, buildArchs[0]) : build.run.call(this, options);
+    var buildPackages = options.nobuild ? packages.getPackage(buildType, buildArchs[0]) : build.run.call(this, options);
 
     // buildPackages also deploys bundles
     return buildPackages
diff --git a/template/cordova/run b/template/cordova/run
index 704b37f..18b4947 100644
--- a/template/cordova/run
+++ b/template/cordova/run
@@ -41,11 +41,6 @@ if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[2]) > -1) {
     console.log('                    architectures are used.');
     console.log('    --phone, --win');
     console.log('                  : Specifies project type to deploy');
-    console.log('    --appx=<8.1-win|8.1-phone|uap|uwp>');
-    console.log('                  : Overrides windows-target-version to build Windows 8.1, ');
-    console.log('                              Windows Phone 8.1, or Windows 10.');
-    console.log('    --win10tools  : Uses Windows 10 deployment tools (used for a Windows 8.1 app when');
-    console.log('                         being deployed to a Windows 10 device)');
     console.log('Examples:');
     console.log('    run');
     console.log('    run --emulator');
@@ -54,7 +49,6 @@ if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[2]) > -1) {
     console.log('    run --device --release');
     console.log('    run --emulator --debug');
     console.log('    run --archs="x64 x86 arm" --no-bundle');
-    console.log('    run --device --appx=phone-8.1');
     console.log('    run --device --archs="x64 x86 arm"');
     console.log('');
 


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