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

Vladimir Kotikov edited comment on CB-11082 at 4/19/16 8:31 AM:
----------------------------------------------------------------

[~andry-tino], it is supposed to work this way. The native files, declared in 
{{plugin.xml}} (including {{header-file}} and {{source-file}}) are get copied 
to platform directory only once, at the plugin installation step. The plugin 
source is persisted inside of the {{plugins}} directory for some other purposes 
than you expect, for example, to be able to install plugin to other platforms 
later.

If you're interested in developing custom plugin, you probably need to use the 
{{--link}} option for [{{cordova plugin 
add}}|http://cordova.apache.org/docs/en/latest/reference/cordova-cli/index.html#cordova-plugin-command]
 command, which creates a symlink for every native file so you can modify them 
in one place and get these changes in both platform and plugin directories.

So the suggested approach is:
  1. Create a plugin stub with native files (i see that you already have this 
one)
  2. Install it into your project using {{--link}} option - {{cordova plugin 
add /my/custom/plugin --link}}
  3. Add a platform to your project (if it is not yet added) - {{cordova 
platform add ios}}
  4. Open the project under {{platforms/ios}} directory with Xcode and start 
updating it

All the changes made to source files and headers then will be reflected to 
plugin files inside of {{plugins/com-myproj-myplugin}} and 
{{/my/custom/plugin}} directories



was (Author: vladimir.kotikov):
[~andry-tino], it is supposed to work this way. The native files, declared in 
{{plugin.xml}} (including {{header-file}} and {{source-file}}) are get copied 
to platform directory only once, at the plugin installation step. 

If you're interested in developing custom plugin, you probably need to use the 
{{--link}} option for [{{cordova plugin 
add}}|http://cordova.apache.org/docs/en/latest/reference/cordova-cli/index.html#cordova-plugin-command]
 command, which creates a symlink for every native file so you can modify them 
in one place and get these changes in both platform and plugin directories.

So the suggested approach is:
  1. Create a plugin stub with native files (i see that you already have this 
one)
  2. Install it into your project using {{--link}} option - {{cordova plugin 
add /my/custom/plugin --link}}
  3. Add a platform to your project (if it is not yet added) - {{cordova 
platform add ios}}
  4. Open the project under {{platforms/ios}} directory with Xcode and start 
updating it

All the changes made to source files and headers then will be reflected to 
plugin files inside of {{plugins/com-myproj-myplugin}} and 
{{/my/custom/plugin}} directories


> iOS plugins not copied from root plugins folder to platform specific plugin 
> folder
> ----------------------------------------------------------------------------------
>
>                 Key: CB-11082
>                 URL: https://issues.apache.org/jira/browse/CB-11082
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CLI, iOS
>    Affects Versions: 3.6.3, 6.1.0
>         Environment: Cordova 6.1 + App with iOS custom plugins
>            Reporter: Andrea Tino
>            Priority: Trivial
>              Labels: ios, plugins
>             Fix For: 6.1.0
>
>
> I do not understand how Cordova (latest version 6.1) deals with plugins. I 
> have the following project for my app:
> {code}
>     myapp (only relevant folders and files shown)
>     +-config.xml
>     +-platforms
>     | +-ios
>     |   +-CordovaLib
>     |   +-MyApp
>     |     +-Plugins
>     |       +-com-myproj-myplugin
>     |         |-myplugin.h
>     |         |-myplugin.m
>     +-plugins
>     | +-com-myproj-myplugin
>     |   |-plugin.xml
>     |   +-src
>     |     +-ios
>     |       |-myplugin.h
>     |       |-myplugin.m
>     +-www
> {code}
> As you can see, this project has a plugin {{myplugin}} which resides in 2 
> directories:
> - The root {{plugins}} folder - Here file 
> {{myapp\plugins\com-myproj-myplugin\src\ios\myplugin.m}} does not contain any 
> code implementation (just signatures and empty content in functions).
> - The iOS application specific {{Plugins}} folder - Here file 
> {{myapp\platforms\ios\MyApp\Plugins\com-myproj-myplugin\myplugin.m}} actually 
> contains the implementation.
> ## Where is the redundancy?
> I thought that the model was as follows:
> 1. I call `cordova build ios`.
> 2. Cordova will copy resources from {{myapp\plugins\}} into specific platform 
> plugin folders in {{myapp\platforms\...\Plugins\}}
> But turns out this is not the case. No copy is performed from the general 
> `plugins` folder into platform specific `Plugins` folders.
> **My question** How am I supposed to develop the plugin in order to avoid 
> this redundancy? Should the code be placed only in platform specific 
> {{Plugins}} folder? But how about {{plugin.xml}} which is placed in the 
> generic {{plugins}} folder?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to