You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by vladimir-kotikov <gi...@git.apache.org> on 2016/04/18 16:52:10 UTC

[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

GitHub user vladimir-kotikov opened a pull request:

    https://github.com/apache/cordova-windows/pull/168

    CB-11066 Remove uap prefixed capabilities when plugin has added regular ones

    This fixes a problem when some of capabilities, added by plugin are being modified at 'prepare' stage due to special Windows logic and then aren't removed when uninstalling plugin. For details see [CB-11066](https://issues.apache.org/jira/browse/CB-11066)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MSOpenTech/cordova-windows CB-11066

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-windows/pull/168.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #168
    
----
commit 3300b14cb59d16d0dd60aadae2608401c6f635a0
Author: Vladimir Kotikov <ko...@gmail.com>
Date:   2016-04-18T09:00:51Z

    CB-11066 Remove uap prefixed capabilities along with regular ones

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/168#discussion_r60375328
  
    --- Diff: template/cordova/lib/ConfigChanges.js ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed 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.
    + *
    +*/
    +
    +var util = require('util');
    +var CommonMunger = require('cordova-common').ConfigChanges.PlatformMunger;
    +
    +function PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider) {
    +    CommonMunger.apply(this, arguments);
    +}
    +
    +util.inherits(PlatformMunger, CommonMunger);
    +
    +/**
    + * This is an override of apply_file_munge method from cordova-common's PlatformMunger class.
    + * In addition to parent's method logic also removes capabilities with 'uap:' prefix that were
    + * added by AppxManifest class
    + *
    + * @param {String}  file   A file name to apply munge to
    + * @param {Object}  munge  Serialized changes that need to be applied to the file
    + * @param {Boolean} [remove=false] Flag that specifies whether the changes
    + *   need to be removed or added to the file
    + */
    +PlatformMunger.prototype.apply_file_munge = function (file, munge, remove) {
    +    // Call parent class' method
    +    PlatformMunger.super_.prototype.apply_file_munge.call(this, file, munge, remove);
    +
    +    // CB-11066 If this is a windows10 manifest and we're removing the changes
    +    // then we also need to check if there are <Capability> elements were previously
    +    // added and schedule removal of corresponding <uap:Capability> elements
    +    if (remove && file === 'package.windows10.appxmanifest') {
    +        var uapCapabilitiesMunge = generateUapCapabilities(munge);
    +        PlatformMunger.super_.prototype.apply_file_munge.call(this, file, uapCapabilitiesMunge, remove);
    --- End diff --
    
    No, we don't, but since parent's `apply_file_munge` [starts from iterating through munge](https://github.com/apache/cordova-lib/blob/master/cordova-common/src/ConfigChanges/ConfigChanges.js#L78-L79) it is basically a no-op in this case and hence there is no any risks in calling it. Just didn't want to add another check to complicate the code :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/168#discussion_r60442924
  
    --- Diff: template/cordova/lib/ConfigChanges.js ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed 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.
    + *
    +*/
    +
    +var util = require('util');
    +var CommonMunger = require('cordova-common').ConfigChanges.PlatformMunger;
    +
    +function PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider) {
    +    CommonMunger.apply(this, arguments);
    +}
    +
    +util.inherits(PlatformMunger, CommonMunger);
    +
    +/**
    + * This is an override of apply_file_munge method from cordova-common's PlatformMunger class.
    + * In addition to parent's method logic also removes capabilities with 'uap:' prefix that were
    + * added by AppxManifest class
    + *
    + * @param {String}  file   A file name to apply munge to
    + * @param {Object}  munge  Serialized changes that need to be applied to the file
    + * @param {Boolean} [remove=false] Flag that specifies whether the changes
    + *   need to be removed or added to the file
    + */
    +PlatformMunger.prototype.apply_file_munge = function (file, munge, remove) {
    +    // Call parent class' method
    +    PlatformMunger.super_.prototype.apply_file_munge.call(this, file, munge, remove);
    +
    +    // CB-11066 If this is a windows10 manifest and we're removing the changes
    +    // then we also need to check if there are <Capability> elements were previously
    +    // added and schedule removal of corresponding <uap:Capability> elements
    +    if (remove && file === 'package.windows10.appxmanifest') {
    --- End diff --
    
    Makes sense. Thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/168#discussion_r60375540
  
    --- Diff: template/cordova/Api.js ---
    @@ -29,7 +29,7 @@ var ActionStack = require('cordova-common').ActionStack;
     var CordovaError = require('cordova-common').CordovaError;
     var CordovaLogger = require('cordova-common').CordovaLogger;
     var PlatformJson = require('cordova-common').PlatformJson;
    -var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger;
    +var PlatformMunger = require('./lib/ConfigChanges').PlatformMunger;
    --- End diff --
    
    Could you please clarify? I'm not sure how removing the `require` statement might affect required logic.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-windows/pull/168#issuecomment-212124345
  
    @rakatyal to help review


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/168#discussion_r60446380
  
    --- Diff: spec/unit/ConfigChanges.spec.js ---
    @@ -0,0 +1,77 @@
    +/**
    +    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.
    +*/
    +
    +var BaseMunger = require('cordova-common').ConfigChanges.PlatformMunger;
    +var PlatformMunger = require('../../template/cordova/lib/ConfigChanges').PlatformMunger;
    +
    +var os = require('os');
    +var path = require('path');
    +var shell = require('shelljs');
    +
    +var tempDir = path.join(os.tmpdir(), 'windows');
    +var WINDOWS_MANIFEST = 'package.windows.appxmanifest';
    +var WINDOWS10_MANIFEST = 'package.windows10.appxmanifest';
    +
    +describe('PlatformMunger', function () {
    +    var munge, munger;
    +
    +    beforeEach(function () {
    +        shell.mkdir('-p', tempDir);
    +        munge = { parents: { 'foo/bar': [
    +            { before: undefined, count: 1, xml: '<DummyElement name="Dummy" />'}
    +        ]}};
    +        munger = new PlatformMunger('windows', tempDir);
    +        spyOn(BaseMunger.prototype, 'apply_file_munge').andCallThrough();
    +    });
    +
    +    afterEach(function () {
    +        shell.rm('-rf', tempDir);
    +    });
    +
    +    describe('apply_file_munge method', function () {
    +
    +        it('should call parent\'s method with the same parameters', function () {
    +            munger.apply_file_munge(WINDOWS_MANIFEST, munge, false);
    +            expect(BaseMunger.prototype.apply_file_munge).toHaveBeenCalledWith(WINDOWS_MANIFEST, munge, false);
    +        });
    +
    +        it('should additionally call parent\'s method with another munge if removing changes from windows 10 appxmanifest', function () {
    +            munger.apply_file_munge('package.windows10.appxmanifest', munge, /*remove=*/true);
    +            expect(BaseMunger.prototype.apply_file_munge).toHaveBeenCalledWith(WINDOWS10_MANIFEST, munge, true);
    +            expect(BaseMunger.prototype.apply_file_munge).toHaveBeenCalledWith(WINDOWS10_MANIFEST, jasmine.any(Object), true);
    +        });
    +
    +        it('should remove uap: capabilities added by windows prepare step', function () {
    +            // Generate a munge that contain non-prefixed capabilities changes
    +            var baseMunge = { parents: { WINDOWS10_MANIFEST: [
    +                // Emulate capability that was initially added with uap prefix
    +                { before: undefined, count: 1, xml: '<uap:Capability Name=\"privateNetworkClientServer\">'},
    +                { before: undefined, count: 1, xml: '<Capability Name=\"enterpriseAuthentication\">'}
    +            ]}};
    +
    +            var capabilitesMunge = { parents: { WINDOWS10_MANIFEST: [
    --- End diff --
    
    Nitpick: capabilitiesMunge


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/168#discussion_r60444685
  
    --- Diff: template/cordova/lib/ConfigChanges.js ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed 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.
    + *
    +*/
    +
    +var util = require('util');
    +var CommonMunger = require('cordova-common').ConfigChanges.PlatformMunger;
    +
    +function PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider) {
    +    CommonMunger.apply(this, arguments);
    +}
    +
    +util.inherits(PlatformMunger, CommonMunger);
    +
    +/**
    + * This is an override of apply_file_munge method from cordova-common's PlatformMunger class.
    + * In addition to parent's method logic also removes capabilities with 'uap:' prefix that were
    + * added by AppxManifest class
    + *
    + * @param {String}  file   A file name to apply munge to
    + * @param {Object}  munge  Serialized changes that need to be applied to the file
    + * @param {Boolean} [remove=false] Flag that specifies whether the changes
    + *   need to be removed or added to the file
    + */
    +PlatformMunger.prototype.apply_file_munge = function (file, munge, remove) {
    +    // Call parent class' method
    +    PlatformMunger.super_.prototype.apply_file_munge.call(this, file, munge, remove);
    +
    +    // CB-11066 If this is a windows10 manifest and we're removing the changes
    +    // then we also need to check if there are <Capability> elements were previously
    +    // added and schedule removal of corresponding <uap:Capability> elements
    +    if (remove && file === 'package.windows10.appxmanifest') {
    +        var uapCapabilitiesMunge = generateUapCapabilities(munge);
    +        PlatformMunger.super_.prototype.apply_file_munge.call(this, file, uapCapabilitiesMunge, remove);
    +    }
    +};
    +
    +/**
    + * Generates a new munge that contains <uap:Capability> elements created based on
    + * corresponding <Capability> elements from base munge. If there is no such elements
    + * found in base munge, the empty munge is returned (selectors might present under
    --- End diff --
    
    If there *are* no such elements ..
    selectors might *be* present..


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/168#discussion_r60334412
  
    --- Diff: template/cordova/lib/ConfigChanges.js ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed 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.
    + *
    +*/
    +
    +var util = require('util');
    +var CommonMunger = require('cordova-common').ConfigChanges.PlatformMunger;
    +
    +function PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider) {
    +    CommonMunger.apply(this, arguments);
    +}
    +
    +util.inherits(PlatformMunger, CommonMunger);
    +
    +/**
    + * This is an override of apply_file_munge method from cordova-common's PlatformMunger class.
    + * In addition to parent's method logic also removes capabilities with 'uap:' prefix that were
    + * added by AppxManifest class
    + *
    + * @param {String}  file   A file name to apply munge to
    + * @param {Object}  munge  Serialized changes that need to be applied to the file
    + * @param {Boolean} [remove=false] Flag that specifies whether the changes
    + *   need to be removed or added to the file
    + */
    +PlatformMunger.prototype.apply_file_munge = function (file, munge, remove) {
    +    // Call parent class' method
    +    PlatformMunger.super_.prototype.apply_file_munge.call(this, file, munge, remove);
    +
    +    // CB-11066 If this is a windows10 manifest and we're removing the changes
    +    // then we also need to check if there are <Capability> elements were previously
    +    // added and schedule removal of corresponding <uap:Capability> elements
    +    if (remove && file === 'package.windows10.appxmanifest') {
    +        var uapCapabilitiesMunge = generateUapCapabilities(munge);
    +        PlatformMunger.super_.prototype.apply_file_munge.call(this, file, uapCapabilitiesMunge, remove);
    --- End diff --
    
    Do we need to call this if uapCapabilitiesMunge is empty?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/168#discussion_r60372887
  
    --- Diff: template/cordova/lib/ConfigChanges.js ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed 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.
    + *
    +*/
    +
    +var util = require('util');
    +var CommonMunger = require('cordova-common').ConfigChanges.PlatformMunger;
    +
    +function PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider) {
    +    CommonMunger.apply(this, arguments);
    +}
    +
    +util.inherits(PlatformMunger, CommonMunger);
    +
    +/**
    + * This is an override of apply_file_munge method from cordova-common's PlatformMunger class.
    + * In addition to parent's method logic also removes capabilities with 'uap:' prefix that were
    + * added by AppxManifest class
    + *
    + * @param {String}  file   A file name to apply munge to
    + * @param {Object}  munge  Serialized changes that need to be applied to the file
    + * @param {Boolean} [remove=false] Flag that specifies whether the changes
    + *   need to be removed or added to the file
    + */
    +PlatformMunger.prototype.apply_file_munge = function (file, munge, remove) {
    +    // Call parent class' method
    +    PlatformMunger.super_.prototype.apply_file_munge.call(this, file, munge, remove);
    +
    +    // CB-11066 If this is a windows10 manifest and we're removing the changes
    +    // then we also need to check if there are <Capability> elements were previously
    +    // added and schedule removal of corresponding <uap:Capability> elements
    +    if (remove && file === 'package.windows10.appxmanifest') {
    --- End diff --
    
    This is possible but IMO the idea of cordova-common was to contain a platform-agnostic code, which platforms might reuse in a way that they want to. The disadvantage of putting platform-specific code in common is that we'll need to release common first before releasing platform to make fix available in next version. Keeping platform-specific code directly inside of the platform allows us not to rely on `common` release cycle


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/168#discussion_r60331966
  
    --- Diff: template/cordova/Api.js ---
    @@ -29,7 +29,7 @@ var ActionStack = require('cordova-common').ActionStack;
     var CordovaError = require('cordova-common').CordovaError;
     var CordovaLogger = require('cordova-common').CordovaLogger;
     var PlatformJson = require('cordova-common').PlatformJson;
    -var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger;
    +var PlatformMunger = require('./lib/ConfigChanges').PlatformMunger;
    --- End diff --
    
    Won't removing this cause an issue for the other methods defined in the cordova-common's ConfigChanges class?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on the pull request:

    https://github.com/apache/cordova-windows/pull/168#issuecomment-212513093
  
    Minor comments. Otherwise LGTM.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on the pull request:

    https://github.com/apache/cordova-windows/pull/168#issuecomment-212840145
  
    Thanks for review, merged


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/168#discussion_r60332098
  
    --- Diff: template/cordova/lib/ConfigChanges.js ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed 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.
    + *
    +*/
    +
    +var util = require('util');
    +var CommonMunger = require('cordova-common').ConfigChanges.PlatformMunger;
    +
    +function PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider) {
    +    CommonMunger.apply(this, arguments);
    +}
    +
    +util.inherits(PlatformMunger, CommonMunger);
    +
    +/**
    + * This is an override of apply_file_munge method from cordova-common's PlatformMunger class.
    + * In addition to parent's method logic also removes capabilities with 'uap:' prefix that were
    + * added by AppxManifest class
    + *
    + * @param {String}  file   A file name to apply munge to
    + * @param {Object}  munge  Serialized changes that need to be applied to the file
    + * @param {Boolean} [remove=false] Flag that specifies whether the changes
    + *   need to be removed or added to the file
    + */
    +PlatformMunger.prototype.apply_file_munge = function (file, munge, remove) {
    +    // Call parent class' method
    +    PlatformMunger.super_.prototype.apply_file_munge.call(this, file, munge, remove);
    +
    +    // CB-11066 If this is a windows10 manifest and we're removing the changes
    +    // then we also need to check if there are <Capability> elements were previously
    +    // added and schedule removal of corresponding <uap:Capability> elements
    +    if (remove && file === 'package.windows10.appxmanifest') {
    --- End diff --
    
    Couldn't we have added this condition to the existing apply_file_munge instead of writing an override?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

Posted by rakatyal <gi...@git.apache.org>.
Github user rakatyal commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/168#discussion_r60445037
  
    --- Diff: template/cordova/lib/ConfigChanges.js ---
    @@ -0,0 +1,85 @@
    +/*
    + * Licensed 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.
    + *
    +*/
    +
    +var util = require('util');
    +var CommonMunger = require('cordova-common').ConfigChanges.PlatformMunger;
    +
    +function PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider) {
    +    CommonMunger.apply(this, arguments);
    +}
    +
    +util.inherits(PlatformMunger, CommonMunger);
    +
    +/**
    + * This is an override of apply_file_munge method from cordova-common's PlatformMunger class.
    + * In addition to parent's method logic also removes capabilities with 'uap:' prefix that were
    + * added by AppxManifest class
    + *
    + * @param {String}  file   A file name to apply munge to
    + * @param {Object}  munge  Serialized changes that need to be applied to the file
    + * @param {Boolean} [remove=false] Flag that specifies whether the changes
    + *   need to be removed or added to the file
    + */
    +PlatformMunger.prototype.apply_file_munge = function (file, munge, remove) {
    +    // Call parent class' method
    +    PlatformMunger.super_.prototype.apply_file_munge.call(this, file, munge, remove);
    +
    +    // CB-11066 If this is a windows10 manifest and we're removing the changes
    +    // then we also need to check if there are <Capability> elements were previously
    +    // added and schedule removal of corresponding <uap:Capability> elements
    +    if (remove && file === 'package.windows10.appxmanifest') {
    +        var uapCapabilitiesMunge = generateUapCapabilities(munge);
    +        PlatformMunger.super_.prototype.apply_file_munge.call(this, file, uapCapabilitiesMunge, remove);
    --- End diff --
    
    Sounds fair. Thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-windows pull request: CB-11066 Remove uap prefixed capabil...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-windows/pull/168


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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