cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktop <...@git.apache.org>
Subject [GitHub] cordova-windows pull request #213: CB-12163 Make resource-file copy files ag...
Date Wed, 14 Dec 2016 16:54:56 GMT
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


Mime
View raw message