Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/378#discussion_r51986491
  
    --- Diff: cordova-lib/src/cordova/metadata/windows_parser.js ---
    @@ -65,135 +53,13 @@ require('util').inherits(windows_parser, Parser);
     module.exports = windows_parser;
     
     windows_parser.prototype.update_from_config = function(config) {
    -
         //check config parser
         if (config instanceof ConfigParser) {
         } else throw new Error('update_from_config requires a ConfigParser 
object');
     
    -    if (!this.isOldProjectTemplate) {
    -        // If there is platform-defined prepare script, require and exec it
    -        var platformPrepare = require(path.join(this.projDir, 'cordova', 
'lib', 'prepare'));
    -        platformPrepare.applyPlatformConfig();
    -        return;
    -    }
    -
    -    // code below is required for compatibility reason. New template 
version is not required this anymore.
    -
    -    //Get manifest file
    -    var manifest = xml.parseElementtreeSync(this.manifestPath);
    -
    -    var version = this.fixConfigVersion(config.version());
    -    var name = config.name();
    -    var pkgName = config.packageName();
    -    var author = config.author();
    -
    -    var identityNode = manifest.find('.//Identity');
    -    if(identityNode) {
    -        // Update app name in identity
    -        var appIdName = identityNode['attrib']['Name'];
    -        if (appIdName != pkgName) {
    -            identityNode['attrib']['Name'] = pkgName;
    -        }
    -
    -        // Update app version
    -        var appVersion = identityNode['attrib']['Version'];
    -        if(appVersion != version) {
    -            identityNode['attrib']['Version'] = version;
    -        }
    -    }
    -
    -    // Update name (windows8 has it in the Application[@Id] and 
Application.VisualElements[@DisplayName])
    -    var app = manifest.find('.//Application');
    -    if(app) {
    -
    -        var appId = app['attrib']['Id'];
    -
    -        if (appId != pkgName) {
    -            app['attrib']['Id'] = pkgName;
    -        }
    -
    -        var visualElems = manifest.find('.//VisualElements') || 
manifest.find('.//m2:VisualElements');
    -
    -        if(visualElems) {
    -            var displayName = visualElems['attrib']['DisplayName'];
    -            if(displayName != name) {
    -                visualElems['attrib']['DisplayName'] = name;
    -            }
    -        }
    -        else {
    -            throw new Error('update_from_config expected a valid 
package.appxmanifest' +
    -                            ' with a <VisualElements> node');
    -        }
    -    }
    -    else {
    -        throw new Error('update_from_config expected a valid 
package.appxmanifest' +
    -                        ' with a <Application> node');
    -    }
    -
    -    // Update properties
    -    var properties = manifest.find('.//Properties');
    -    if (properties && properties.find) {
    -        var displayNameElement = properties.find('.//DisplayName');
    -        if (displayNameElement && displayNameElement.text != name) {
    -            displayNameElement.text = name;
    -        }
    -
    -        var publisherNameElement = 
properties.find('.//PublisherDisplayName');
    -        if (publisherNameElement && publisherNameElement.text != author) {
    -            publisherNameElement.text = author;
    -        }
    -    }
    -
    -    // sort Capability elements as per CB-5350 Windows8 build fails due to 
invalid 'Capabilities' definition
    -    // to sort elements we remove them and then add again in the 
appropriate order
    -    var capabilitiesRoot = manifest.find('.//Capabilities'),
    -        capabilities = capabilitiesRoot._children || [];
    -
    -    capabilities.forEach(function(elem){
    -        capabilitiesRoot.remove(elem);
    -    });
    -    capabilities.sort(function(a, b) {
    -        return (a.tag > b.tag)? 1: -1;
    -    });
    -    capabilities.forEach(function(elem){
    -        capabilitiesRoot.append(elem);
    -    });
    -
    -    //Write out manifest
    -    fs.writeFileSync(this.manifestPath, manifest.write({indent: 4}), 
'utf-8');
    -
    -    // Update icons
    -    var icons = config.getIcons('windows8');
    -    var platformRoot = this.projDir;
    -    var appRoot = util.isCordova(platformRoot);
    -
    -    // Icons, that should be added to platform
    -    var platformIcons = [
    -        {dest: 'images/logo.png', width: 150, height: 150},
    -        {dest: 'images/smalllogo.png', width: 30, height: 30},
    -        {dest: 'images/storelogo.png', width: 50, height: 50},
    -    ];
    -
    -    platformIcons.forEach(function (item) {
    -        var icon = icons.getBySize(item.width, item.height) || 
icons.getDefault();
    -        if (icon){
    -            var src = path.join(appRoot, icon.src),
    -                dest = path.join(platformRoot, item.dest);
    -            events.emit('verbose', 'Copying icon from ' + src + ' to ' + 
dest);
    -            shell.cp('-f', src, dest);
    -        }
    -    });
    -
    -    // Update splashscreen
    -    // Image size for Windows 8 should be 620 x 300 px
    -    // See 
http://msdn.microsoft.com/en-us/library/windows/apps/hh465338.aspx for reference
    -    var splash = config.getSplashScreens('windows8').getBySize(620, 300);
    -    if (splash){
    -        var src = path.join(appRoot, splash.src),
    -            dest = path.join(platformRoot, 'images/splashscreen.png');
    -        events.emit('verbose', 'Copying icon from ' + src + ' to ' + dest);
    -        shell.cp('-f', src, dest);
    -    }
    +    // If there is platform-defined prepare script, require and exec it
    +    var platformPrepare = require(path.join(this.projDir, 'cordova', 
'lib', 'prepare'));
    --- End diff --
    
    Also it might be better to wrap this into `try/catch` and throw 
`CordovaError` with appropriate message


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to