[ 
https://issues.apache.org/jira/browse/CB-6699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14001421#comment-14001421
 ] 

Sergey Grebnov commented on CB-6699:
------------------------------------

I thinks that this change is important since removes logic which manually 
handles proj includes from different places, like below making code more clear 
and robust.
https://github.com/apache/cordova-lib/pull/10/files#diff-fd96837bdf3c48625671262c6b27c3e3L86

Jesse, could you please elaborate on  " however there are numerous issues with 
the way Visual Studio loads and detects changes to a project file." If I 
manually add additional file to www from VS it seems to work just fine. File is 
added, no additional reference to this file is added  - still have single 
www/** and all works.

Or we should wrap/move this logic to appropriate method inside windows specific 
class. It should not be directly handled by plugman/cli prepare.

Other notes.
1. Alternatively could be moved to pre-build script where we handles www/files 
references. Concern: results of prepare command
2 Alternately we can add www/** inside windows8_parser->update_jsproj method 
which is called during each prepare step.

// updates the jsproj file to explicitly list all www content.
    update_jsproj:function() {
        if (!this.oldProjectTemplate) {
            // requires for old Windows8 proj template only 
            return;
        }
        // remove all unnecessary references
        var jsproj_xml = xml.parseElementtreeSync(this.proj_path);
        // remove any previous references to the www files
        var item_groups = jsproj_xml.findall('ItemGroup');
        for (var i = 0, l = item_groups.length; i < l; i++) {
            var group = item_groups[i];
            var files = group.findall('Content');
            for (var j = 0, k = files.length; j < k; j++) {
                var file = files[j];
                if (file.attrib.Include.substr(0, 3) == 'www') {
                    // remove file reference
                    group.remove(0, file);
                    // remove ItemGroup if empty
                    var new_group = group.findall('Content');
                    if(new_group.length < 1) {
                        jsproj_xml.getroot().remove(0, group);
                    }
                }
            }
        }

        // now add single reference to www folder content and config.xml
        var item = new et.Element('ItemGroup');
        var content = new et.Element('Content');
        content.attrib.Include = 'www\\**';
        item.append(content);
        jsproj_xml.getroot().append(item);

        // save file
        fs.writeFileSync(this.proj_path, jsproj_xml.write({indent:4}), 'utf-8');
    },



> Cordova-cli / plugman add <Content> tag for each entry in www dir to windows8 
> / wp8 .jsproj files
> -------------------------------------------------------------------------------------------------
>
>                 Key: CB-6699
>                 URL: https://issues.apache.org/jira/browse/CB-6699
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: CLI, Plugman, Windows 8, WP8
>            Reporter: Vladimir Kotikov
>            Assignee: Jesse MacFadyen
>              Labels: cli, cordova-lib, windows8, wp8
>
> Every time, when you trigger `cordova prepare/build` or `plugman 
> install/uninstall/prepare` (this also `include cordova plugin add/rm`), 
> cordova removes all references to www/* files from .jsproj file and then adds 
> tags like {noformat}
>   <ItemGroup>
>     <Content Include="www\index.html" />
>   </ItemGroup>
> {noformat}
> to .jsproj file.
> *Proposal:* We can use one entry like {noformat}
>   <ItemGroup>
>     <Content Include="www\**" />
>   </ItemGroup>
> {noformat} for all files in www folder including static assets and plugins' 
> .js modules (like described 
> [here|http://msdn.microsoft.com/en-us/library/ms171454.aspx])



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to