You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by ktop <gi...@git.apache.org> on 2016/12/06 21:12:51 UTC

[GitHub] cordova-windows pull request #213: CB-12163 Make resource-file copy files ag...

GitHub user ktop opened a pull request:

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

    CB-12163 Make resource-file copy files again

    <!--
    Please make sure the checklist boxes are all checked before submitting the PR. The checklist
    is intended as a quick reference, for complete details please see our Contributor Guidelines:
    
    http://cordova.apache.org/contribute/contribute_guidelines.html
    
    Thanks!
    -->
    
    ### Platforms affected
    - Windows
    
    ### What does this PR do?
    - Revert the functionality of resource-file in plugin.xml. It will now copy files again instead of using the references. 
    
    ### What testing has been done on this change?
    - Updated the spec tests and ran them
    - Created a new app with the updated resource-file and check to see if it copies files. 
    
    ### Checklist
    - [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
    - [X] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
    - [X] Added automated test coverage as appropriate for this change.
    


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

    $ git pull https://github.com/ktop/cordova-windows cb12163

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

    https://github.com/apache/cordova-windows/pull/213.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 #213
    
----
commit d00e0c33d388f410d6444920d72b7ac1e86df3ef
Author: ktop <kt...@gmail.com>
Date:   2016-12-06T20:58:42Z

    CB-12163 Make resource-file copy files again

----


---
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 issue #213: CB-12163 Make resource-file copy files again

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

    https://github.com/apache/cordova-windows/pull/213
  
    Looks good \U0001f44d 


---
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 issue #213: CB-12163 Make resource-file copy files again

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on the issue:

    https://github.com/apache/cordova-windows/pull/213
  
    @ktop what is the status of this PR? Is it ready for merge?


---
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 #213: CB-12163 Make resource-file copy files ag...

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/213#discussion_r92344993
  
    --- Diff: template/cordova/lib/PluginHandler.js ---
    @@ -53,18 +53,37 @@ var handlers = {
         },
         'resource-file':{
             install:function(obj, plugin, project, options) {
    -            // do not copy, but reference the file in the plugin folder. This allows to
    -            // have multiple source files map to the same target and select the appropriate
    -            // one based on the current build settings, e.g. architecture.
    -            // also, we don't check for existence. This allows to insert build variables
    -            // into the source file name, e.g.
    -            // <resource-file src="$(Platform)/My.dll" target="My.dll" />
    -            var relativeSrcPath = getPluginFilePath(plugin, obj.src, project.projectFolder);
    -            project.addResourceFileToProject(relativeSrcPath, obj.target, getTargetConditions(obj));
    +            var targetConditions = getTargetConditions(obj);
    +            if (targetConditions.reference) {
    --- End diff --
    
    I think that the object that `getTargetConditions` returns was originally meant to hold details about target platform (Win8.1, WP8.1, Win10) and architecture to create a `condition` attribute, so `reference` field  doesn't really fit here - you might just check `if (obj.reference) ...`


---
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 issue #213: CB-12163 Make resource-file copy files again

Posted by ktop <gi...@git.apache.org>.
Github user ktop commented on the issue:

    https://github.com/apache/cordova-windows/pull/213
  
    @daserge 
    Now that there has been a cordova-common release, can we refresh cordova-common in cordova-windows and get this 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 issue #213: CB-12163 Make resource-file copy files again

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on the issue:

    https://github.com/apache/cordova-windows/pull/213
  
    @ktop, could you please comment on @timbarham message?
    http://markmail.org/message/2fproqgmbrc2gxpz
    Is this a breaking change?


---
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 #213: CB-12163 Make resource-file copy files ag...

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/213#discussion_r92344562
  
    --- Diff: template/cordova/lib/JsprojManager.js ---
    @@ -121,7 +121,12 @@ jsprojManager.prototype = {
             copyToOutputDirectory.text = 'Always';
             children.push(copyToOutputDirectory);
     
    -        var item = createItemGroupElement('ItemGroup/Content', sourcePath, targetConditions, children);
    +        var item;
    --- End diff --
    
    IMO it'd be better to calculate path for `content` element outside this method (in `'resource-file'.install`) - this way you will avoid checking the same condition (`if (targetConditions.reference) ...`) twice and won't need to modify this method at all.


---
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 #213: CB-12163 Make resource-file copy files ag...

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

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


---
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 #213: CB-12163 Make resource-file copy files ag...

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

    https://github.com/apache/cordova-windows/pull/213#discussion_r92438038
  
    --- Diff: template/cordova/lib/PluginHandler.js ---
    @@ -53,18 +53,37 @@ var handlers = {
         },
         'resource-file':{
             install:function(obj, plugin, project, options) {
    -            // do not copy, but reference the file in the plugin folder. This allows to
    -            // have multiple source files map to the same target and select the appropriate
    -            // one based on the current build settings, e.g. architecture.
    -            // also, we don't check for existence. This allows to insert build variables
    -            // into the source file name, e.g.
    -            // <resource-file src="$(Platform)/My.dll" target="My.dll" />
    -            var relativeSrcPath = getPluginFilePath(plugin, obj.src, project.projectFolder);
    -            project.addResourceFileToProject(relativeSrcPath, obj.target, getTargetConditions(obj));
    +            var targetConditions = getTargetConditions(obj);
    +            if (targetConditions.reference) {
    +                // do not copy, but reference the file in the plugin folder. This allows to
    +                // have multiple source files map to the same target and select the appropriate
    +                // one based on the current build settings, e.g. architecture.
    +                // also, we don't check for existence. This allows to insert build variables
    +                // into the source file name, e.g.
    +                // <resource-file src="$(Platform)/My.dll" target="My.dll" />
    +                var relativeSrcPath = getPluginFilePath(plugin, obj.src, project.projectFolder);
    +                project.addResourceFileToProject(relativeSrcPath, obj.target, targetConditions);
    +            } else {
    +                // if target already exists, emit warning to consider using a reference instead of copying
    +                if (fs.existsSync(path.resolve(project.root, obj.target))) {
    +                    events.emit('warn', '<resource-file> with target ' + obj.target + ' already exists and will be overwritten ' +
    +                    'by a <resource-file> with the same target. Consider using the attribute reference="true" in the ' +
    +                    '<resource-file> tag to avoid overwriting files with the same target. ');
    --- End diff --
    
    I agree it would make it clearer for users. 


---
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 issue #213: CB-12163 Make resource-file copy files again

Posted by codecov-io <gi...@git.apache.org>.
Github user codecov-io commented on the issue:

    https://github.com/apache/cordova-windows/pull/213
  
    ## [Current coverage](https://codecov.io/gh/apache/cordova-windows/pull/213?src=pr) is 76.10% (diff: 100%)
    > Merging [#213](https://codecov.io/gh/apache/cordova-windows/pull/213?src=pr) into [master](https://codecov.io/gh/apache/cordova-windows/branch/master?src=pr) will decrease coverage by **0.03%**
    
    ```diff
    @@             master       #213   diff @@
    ==========================================
      Files            16         16          
      Lines          2204       2201     -3   
      Methods         413        412     -1   
      Messages          0          0          
      Branches        430        430          
    ==========================================
    - Hits           1678       1675     -3   
      Misses          526        526          
      Partials          0          0          
    ```
    
    > Powered by [Codecov](https://codecov.io?src=pr). Last update [623ff18...d00e0c3](https://codecov.io/gh/apache/cordova-windows/compare/623ff181dbb780537c9a9b646db6f72bd59722e9...d00e0c33d388f410d6444920d72b7ac1e86df3ef?src=pr)


---
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 issue #213: CB-12163 Make resource-file copy files again

Posted by ktop <gi...@git.apache.org>.
Github user ktop commented on the issue:

    https://github.com/apache/cordova-windows/pull/213
  
    @vladimir-kotikov Can you review? This pr reverts resource-file to what it used to do so it will copy files. 


---
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 issue #213: CB-12163 Make resource-file copy files again

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

    https://github.com/apache/cordova-windows/pull/213
  
    @ktop, done!


---
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 #213: CB-12163 Make resource-file copy files ag...

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/213#discussion_r92344997
  
    --- Diff: template/cordova/lib/PluginHandler.js ---
    @@ -53,18 +53,37 @@ var handlers = {
         },
         'resource-file':{
             install:function(obj, plugin, project, options) {
    -            // do not copy, but reference the file in the plugin folder. This allows to
    -            // have multiple source files map to the same target and select the appropriate
    -            // one based on the current build settings, e.g. architecture.
    -            // also, we don't check for existence. This allows to insert build variables
    -            // into the source file name, e.g.
    -            // <resource-file src="$(Platform)/My.dll" target="My.dll" />
    -            var relativeSrcPath = getPluginFilePath(plugin, obj.src, project.projectFolder);
    -            project.addResourceFileToProject(relativeSrcPath, obj.target, getTargetConditions(obj));
    +            var targetConditions = getTargetConditions(obj);
    +            if (targetConditions.reference) {
    +                // do not copy, but reference the file in the plugin folder. This allows to
    +                // have multiple source files map to the same target and select the appropriate
    +                // one based on the current build settings, e.g. architecture.
    +                // also, we don't check for existence. This allows to insert build variables
    +                // into the source file name, e.g.
    +                // <resource-file src="$(Platform)/My.dll" target="My.dll" />
    +                var relativeSrcPath = getPluginFilePath(plugin, obj.src, project.projectFolder);
    +                project.addResourceFileToProject(relativeSrcPath, obj.target, targetConditions);
    +            } else {
    +                // if target already exists, emit warning to consider using a reference instead of copying
    +                if (fs.existsSync(path.resolve(project.root, obj.target))) {
    +                    events.emit('warn', '<resource-file> with target ' + obj.target + ' already exists and will be overwritten ' +
    +                    'by a <resource-file> with the same target. Consider using the attribute reference="true" in the ' +
    +                    '<resource-file> tag to avoid overwriting files with the same target. ');
    --- End diff --
    
    Might be also useful to add that adding `reference` will not copy user files to destination directory. WDYT?


---
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 issue #213: CB-12163 Make resource-file copy files again

Posted by ktop <gi...@git.apache.org>.
Github user ktop commented on the issue:

    https://github.com/apache/cordova-windows/pull/213
  
    @daserge Thanks for the bump, Tim's email was in my spam. Yes, this would be a breaking change as it is now. We should wait until we come to a final decision before proceeding with this pr. 


---
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 #213: CB-12163 Make resource-file copy files ag...

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/213#discussion_r92345318
  
    --- Diff: template/cordova/lib/PluginHandler.js ---
    @@ -188,7 +207,7 @@ module.exports.getUninstaller = function(type) {
     };
     
     function getTargetConditions(obj) {
    -    return { versions: obj.versions, deviceTarget: obj.deviceTarget, arch: obj.arch };
    +    return { versions: obj.versions, deviceTarget: obj.deviceTarget, arch: obj.arch, reference: obj.reference };
    --- End diff --
    
    As per comments above `reference` field is not really required - i's easier to use `obj.reference` directly


---
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 issue #213: CB-12163 Make resource-file copy files again

Posted by ktop <gi...@git.apache.org>.
Github user ktop commented on the issue:

    https://github.com/apache/cordova-windows/pull/213
  
    @daserge we need to wait for a cordova-common release since the commit I'm dependent on has been merged https://github.com/apache/cordova-lib/pull/509


---
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