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/15 23:52:48 UTC

[cordova-windows] 08/17: remove --appx param

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 2c1f8c086b470c5fddb8f34b4e0cd649d5c05ac9
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Feb 15 20:22:08 2018 +0100

    remove --appx param
---
 spec/e2e/endtoend.spec.js       | 12 -----------
 spec/unit/build.spec.js         | 20 +-----------------
 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 ------
 7 files changed, 12 insertions(+), 90 deletions(-)

diff --git a/spec/e2e/endtoend.spec.js b/spec/e2e/endtoend.spec.js
index be3deb8..e0153cb 100644
--- a/spec/e2e/endtoend.spec.js
+++ b/spec/e2e/endtoend.spec.js
@@ -81,18 +81,6 @@ describe('Cordova create and build', function () {
         _expectSubdirAndFileExist('CordovaApp.Windows10_1.0.0.0_anycpu_debug_Test', 'CordovaApp.Windows10_1.0.0.0_anycpu_debug.appx');
     });
 
-    // --appx
-
-    it('spec.2b should build uap (win10) project', function () {
-        shell.exec(buildScriptPath + ' --appx=uap', {silent: silent});
-        _expectSubdirAndFileExist('CordovaApp.Windows10_1.0.0.0_anycpu_debug_Test', 'CordovaApp.Windows10_1.0.0.0_anycpu_debug.appx');
-    });
-
-    it('spec.2c should build uwp (win10) project', function () {
-        shell.exec(buildScriptPath + ' --appx=uwp', {silent: silent});
-        _expectSubdirAndFileExist('CordovaApp.Windows10_1.0.0.0_anycpu_debug_Test', 'CordovaApp.Windows10_1.0.0.0_anycpu_debug.appx');
-    });
-
     // --archs
 
     it('spec.3a should build project for particular CPU', function () {
diff --git a/spec/unit/build.spec.js b/spec/unit/build.spec.js
index e6bb97b..d5470ae 100644
--- a/spec/unit/build.spec.js
+++ b/spec/unit/build.spec.js
@@ -375,25 +375,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
-        build.run({argv: ['--appx=uap']})
-            .fail(fail)
-            .finally(function () {
-                expect(fail).not.toHaveBeenCalled();
-                expect(buildTools151.buildProject).toHaveBeenCalled();
-                done();
-            });
-    });
-
-    it('spec.15b should choose latest version if there are multiple versions available with minor version difference', function (done) {
-        var fail = jasmine.createSpy('fail');
-        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
-        build.run({argv: ['--appx=uwp']})
+        build.run({argv: ['']})
             .fail(fail)
             .finally(function () {
                 expect(fail).not.toHaveBeenCalled();
diff --git a/template/cordova/build b/template/cordova/build
index 2f8a771..a0f1c09 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 90ad2df..e1a95fb 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)) {
@@ -365,7 +331,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');
             }
 
@@ -379,7 +345,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 cbf46e0..715a635 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 0c544e8..0eccbd6 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 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