cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vladimir-kotikov <...@git.apache.org>
Subject [GitHub] cordova-android pull request: CB-11117: Use FileUpdater to optimiz...
Date Thu, 28 Apr 2016 08:47:21 GMT
Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-android/pull/295#discussion_r61392785
  
    --- Diff: bin/templates/cordova/lib/prepare.js ---
    @@ -26,26 +26,43 @@ var AndroidManifest = require('./AndroidManifest');
     var xmlHelpers = require('cordova-common').xmlHelpers;
     var CordovaError = require('cordova-common').CordovaError;
     var ConfigParser = require('cordova-common').ConfigParser;
    +var FileUpdater = require('cordova-common').FileUpdater;
     
    -module.exports.prepare = function (cordovaProject) {
    +module.exports.prepare = function (cordovaProject, options) {
     
         var self = this;
    +    var platformResourcesDir = path.relative(cordovaProject.root, path.join(this.locations.root,
'res'));
     
         this._config = updateConfigFilesFrom(cordovaProject.projectConfig,
             this._munger, this.locations);
     
         // Update own www dir with project's www assets and plugins' assets and js-files
    -    return Q.when(updateWwwFrom(cordovaProject, this.locations))
    +    return Q.when(updateWww.call(self, cordovaProject))
         .then(function () {
             // update project according to config.xml changes.
             return updateProjectAccordingTo(self._config, self.locations);
         })
         .then(function () {
    -        handleIcons(cordovaProject.projectConfig, self.root);
    -        handleSplashes(cordovaProject.projectConfig, self.root);
    +        updateIcons.call(self, cordovaProject, platformResourcesDir);
    +        updateSplashes.call(self, cordovaProject, platformResourcesDir);
         })
         .then(function () {
    -        events.emit('verbose', 'updated project successfully');
    +        events.emit('verbose', 'Prepared project successfully');
    +    });
    +};
    +
    +module.exports.clean = function (options) {
    +    // Unfortunately the cordovaProject isn't passed into the clean() function,
    +    // but the project root dir and config can be resolved here easily.
    --- End diff --
    
    The `cordovaProject` is not passed here because the `clean` command is also accessible
in non-CLI workflow through shell script (as opposed to `prepare`, which is intended to be
called from CLI only). In this case resolving project's root is a bad idea, as there might
not be any project at all.
    
    Also, calling this in non-CLI project would destroy the project, as these files are not
copied from the root project but were added by developer manually. IMO this functionality
should be hidden behind the flag, so user would not wipe these files unintentionally.


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


Mime
View raw message