You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Axel Nennker <ig...@gmail.com> on 2013/10/23 13:57:01 UTC

endless recursion on phonegap local plugin add ../..

Hi,

the above phonegap command fails (name to long) and I think it applies to
cordova as well.

plugin add seems to copy the whole directory into the app's plugins
directory. Which is wrong.


I am developing a phonegap  plugin and inside the plugin's developement
folder I have a subfolder named examples. In this folder I created a
phonegap example project to show how the plugin might be used. I want to
add the my plugin into this example app but "plugin add" dies because it
tries to copy the whole plugin's folder into itself.

Why isn't "plugin add" just copying the plugin.xml and all the files
(assets, js-modules etc) into the plugins folder? This would prevent the
endless recursion and would just copy exactly those files that are needed.

Am I missing something?

cheers
Axel

Re: endless recursion on phonegap local plugin add ../..

Posted by Don Coleman <do...@gmail.com>.
That's an interesting idea to use a subdirectory now that we support
subdirs from git. I worry that it would not be standard and might confuse
users. I want to make sure my plugins are easy for users to use.

I appreciate that opening plugins.xml to copy files stinks, but so do
errors about recursive copies failing :)

For now my work around is to just tell people to copy the examples
somewhere else before adding platforms and plugins.




On Wed, Oct 23, 2013 at 2:38 PM, Braden Shepherdson <br...@chromium.org>wrote:

> That misses the point that we'd really rather avoid the complexity of
> having to open the plugin.xml in order to copy a plugin.
>
> If you want to package lots of things in with the plugin, including
> examples, then I propose structuring it thus:
>
> .git/
> docs/
> examples/
> plugin/
>     plugin.xml
>     js/
>     src/
>         android/
>         ios/
>     assets/
> README.md
>
> That is, keep the plugin in a subdirectory. We support subdirs now, so you
> can give this as a dependency thus:
> <dependency id="some.plugin" url="
> https://github.com/shepheb/MyPlugin.git#:plugin" />
> where the data after the # is: #gitref:sub/dir
>
> Then your examples can depend on ../plugin and no problem.
>
> Braden
>
>
>
>
> On Wed, Oct 23, 2013 at 2:13 PM, Don Coleman <do...@gmail.com>
> wrote:
>
> > It would be useful for plugin.xml to exclude a directory such as examples
> > when copying. I think examples are important, especially for 3rd party
> > plugins and it's convenient to keep examples in the same repo as the
> code.
> >
> >
> > On Wed, Oct 23, 2013 at 10:42 AM, Braden Shepherdson <
> braden@chromium.org
> > >wrote:
> >
> > > The common places to fetch the plugin are over the network, from the
> > plugin
> > > registry or from git. Therefore the tools are expecting to download
> > exactly
> > > the files that are needed by the plugin, plus or minus a README or
> > > whatever. They expect local plugins to be self-contained, in a
> directory
> > by
> > > themselves.
> > >
> > > If this is from an example plugin that is being published, maybe we
> > should
> > > pull the plugin's parts into a "src" or "plugin" directory, that's a
> > > sibling of "examples"? This flow is not supported, and I don't think
> it's
> > > worth the work involved to go from a dumb copy to a careful copying of
> > > exactly the member files of the plugin.
> > >
> > > Braden
> > >
> > >
> > > On Wed, Oct 23, 2013 at 9:24 AM, Don Coleman <do...@gmail.com>
> > > wrote:
> > >
> > > > I've seen this problem with cordova. My instructions for the examples
> > > have
> > > > people copy the example folder out of the project before installing
> the
> > > > plugin as a work around.
> > > >
> > > >
> > > >
> > > > > On Oct 23, 2013, at 7:57 AM, Axel Nennker <ig...@gmail.com>
> > > wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > the above phonegap command fails (name to long) and I think it
> > applies
> > > to
> > > > > cordova as well.
> > > > >
> > > > > plugin add seems to copy the whole directory into the app's plugins
> > > > > directory. Which is wrong.
> > > > >
> > > > >
> > > > > I am developing a phonegap  plugin and inside the plugin's
> > developement
> > > > > folder I have a subfolder named examples. In this folder I created
> a
> > > > > phonegap example project to show how the plugin might be used. I
> want
> > > to
> > > > > add the my plugin into this example app but "plugin add" dies
> because
> > > it
> > > > > tries to copy the whole plugin's folder into itself.
> > > > >
> > > > > Why isn't "plugin add" just copying the plugin.xml and all the
> files
> > > > > (assets, js-modules etc) into the plugins folder? This would
> prevent
> > > the
> > > > > endless recursion and would just copy exactly those files that are
> > > > needed.
> > > > >
> > > > > Am I missing something?
> > > > >
> > > > > cheers
> > > > > Axel
> > > >
> > >
> >
>

Re: endless recursion on phonegap local plugin add ../..

Posted by Braden Shepherdson <br...@chromium.org>.
That misses the point that we'd really rather avoid the complexity of
having to open the plugin.xml in order to copy a plugin.

If you want to package lots of things in with the plugin, including
examples, then I propose structuring it thus:

.git/
docs/
examples/
plugin/
    plugin.xml
    js/
    src/
        android/
        ios/
    assets/
README.md

That is, keep the plugin in a subdirectory. We support subdirs now, so you
can give this as a dependency thus:
<dependency id="some.plugin" url="
https://github.com/shepheb/MyPlugin.git#:plugin" />
where the data after the # is: #gitref:sub/dir

Then your examples can depend on ../plugin and no problem.

Braden




On Wed, Oct 23, 2013 at 2:13 PM, Don Coleman <do...@gmail.com> wrote:

> It would be useful for plugin.xml to exclude a directory such as examples
> when copying. I think examples are important, especially for 3rd party
> plugins and it's convenient to keep examples in the same repo as the code.
>
>
> On Wed, Oct 23, 2013 at 10:42 AM, Braden Shepherdson <braden@chromium.org
> >wrote:
>
> > The common places to fetch the plugin are over the network, from the
> plugin
> > registry or from git. Therefore the tools are expecting to download
> exactly
> > the files that are needed by the plugin, plus or minus a README or
> > whatever. They expect local plugins to be self-contained, in a directory
> by
> > themselves.
> >
> > If this is from an example plugin that is being published, maybe we
> should
> > pull the plugin's parts into a "src" or "plugin" directory, that's a
> > sibling of "examples"? This flow is not supported, and I don't think it's
> > worth the work involved to go from a dumb copy to a careful copying of
> > exactly the member files of the plugin.
> >
> > Braden
> >
> >
> > On Wed, Oct 23, 2013 at 9:24 AM, Don Coleman <do...@gmail.com>
> > wrote:
> >
> > > I've seen this problem with cordova. My instructions for the examples
> > have
> > > people copy the example folder out of the project before installing the
> > > plugin as a work around.
> > >
> > >
> > >
> > > > On Oct 23, 2013, at 7:57 AM, Axel Nennker <ig...@gmail.com>
> > wrote:
> > > >
> > > > Hi,
> > > >
> > > > the above phonegap command fails (name to long) and I think it
> applies
> > to
> > > > cordova as well.
> > > >
> > > > plugin add seems to copy the whole directory into the app's plugins
> > > > directory. Which is wrong.
> > > >
> > > >
> > > > I am developing a phonegap  plugin and inside the plugin's
> developement
> > > > folder I have a subfolder named examples. In this folder I created a
> > > > phonegap example project to show how the plugin might be used. I want
> > to
> > > > add the my plugin into this example app but "plugin add" dies because
> > it
> > > > tries to copy the whole plugin's folder into itself.
> > > >
> > > > Why isn't "plugin add" just copying the plugin.xml and all the files
> > > > (assets, js-modules etc) into the plugins folder? This would prevent
> > the
> > > > endless recursion and would just copy exactly those files that are
> > > needed.
> > > >
> > > > Am I missing something?
> > > >
> > > > cheers
> > > > Axel
> > >
> >
>

Re: endless recursion on phonegap local plugin add ../..

Posted by Don Coleman <do...@gmail.com>.
It would be useful for plugin.xml to exclude a directory such as examples
when copying. I think examples are important, especially for 3rd party
plugins and it's convenient to keep examples in the same repo as the code.


On Wed, Oct 23, 2013 at 10:42 AM, Braden Shepherdson <br...@chromium.org>wrote:

> The common places to fetch the plugin are over the network, from the plugin
> registry or from git. Therefore the tools are expecting to download exactly
> the files that are needed by the plugin, plus or minus a README or
> whatever. They expect local plugins to be self-contained, in a directory by
> themselves.
>
> If this is from an example plugin that is being published, maybe we should
> pull the plugin's parts into a "src" or "plugin" directory, that's a
> sibling of "examples"? This flow is not supported, and I don't think it's
> worth the work involved to go from a dumb copy to a careful copying of
> exactly the member files of the plugin.
>
> Braden
>
>
> On Wed, Oct 23, 2013 at 9:24 AM, Don Coleman <do...@gmail.com>
> wrote:
>
> > I've seen this problem with cordova. My instructions for the examples
> have
> > people copy the example folder out of the project before installing the
> > plugin as a work around.
> >
> >
> >
> > > On Oct 23, 2013, at 7:57 AM, Axel Nennker <ig...@gmail.com>
> wrote:
> > >
> > > Hi,
> > >
> > > the above phonegap command fails (name to long) and I think it applies
> to
> > > cordova as well.
> > >
> > > plugin add seems to copy the whole directory into the app's plugins
> > > directory. Which is wrong.
> > >
> > >
> > > I am developing a phonegap  plugin and inside the plugin's developement
> > > folder I have a subfolder named examples. In this folder I created a
> > > phonegap example project to show how the plugin might be used. I want
> to
> > > add the my plugin into this example app but "plugin add" dies because
> it
> > > tries to copy the whole plugin's folder into itself.
> > >
> > > Why isn't "plugin add" just copying the plugin.xml and all the files
> > > (assets, js-modules etc) into the plugins folder? This would prevent
> the
> > > endless recursion and would just copy exactly those files that are
> > needed.
> > >
> > > Am I missing something?
> > >
> > > cheers
> > > Axel
> >
>

Re: endless recursion on phonegap local plugin add ../..

Posted by Braden Shepherdson <br...@chromium.org>.
Feel free to file the bug, of course. There's multiple simple workarounds
(copy the example out of the directory, or put the plugin in a subdir), so
it's low-priority in my mind. The plugin.xml format is evolving, and having
to maintain this proposed logic every time we change the many ways to
include files is a nasty maintenance headache I would much rather avoid.

Don, the worry about it being non-standard is not too much of a problem,
since nearly all users of a plugin will be installing it from the registry,
so they don't need to know anything about this. They just "cordova plugin
add some.id" (or "plugman fetch some.id"), and it's there.

Braden


On Wed, Oct 23, 2013 at 2:52 PM, Carlos Santana <cs...@gmail.com>wrote:

> Today you can also use cli hooks to delete the "examples" directory if
> present
>
>
> --Carlos
>
>
> On Wed, Oct 23, 2013 at 2:39 PM, Axel Nennker <ig...@gmail.com>
> wrote:
>
> > Yes, a copy is simpler but I think that copying only the needed files
> > specified in plugin.xml makes a lot of sense.
> > Am 23.10.2013 16:42 schrieb "Braden Shepherdson" <br...@chromium.org>:
> >
> > > The common places to fetch the plugin are over the network, from the
> > plugin
> > > registry or from git. Therefore the tools are expecting to download
> > exactly
> > > the files that are needed by the plugin, plus or minus a README or
> > > whatever. They expect local plugins to be self-contained, in a
> directory
> > by
> > > themselves.
> > >
> > > If this is from an example plugin that is being published, maybe we
> > should
> > > pull the plugin's parts into a "src" or "plugin" directory, that's a
> > > sibling of "examples"? This flow is not supported, and I don't think
> it's
> > > worth the work involved to go from a dumb copy to a careful copying of
> > > exactly the member files of the plugin.
> > >
> > > Braden
> > >
> > >
> > > On Wed, Oct 23, 2013 at 9:24 AM, Don Coleman <do...@gmail.com>
> > > wrote:
> > >
> > > > I've seen this problem with cordova. My instructions for the examples
> > > have
> > > > people copy the example folder out of the project before installing
> the
> > > > plugin as a work around.
> > > >
> > > >
> > > >
> > > > > On Oct 23, 2013, at 7:57 AM, Axel Nennker <ig...@gmail.com>
> > > wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > the above phonegap command fails (name to long) and I think it
> > applies
> > > to
> > > > > cordova as well.
> > > > >
> > > > > plugin add seems to copy the whole directory into the app's plugins
> > > > > directory. Which is wrong.
> > > > >
> > > > >
> > > > > I am developing a phonegap  plugin and inside the plugin's
> > developement
> > > > > folder I have a subfolder named examples. In this folder I created
> a
> > > > > phonegap example project to show how the plugin might be used. I
> want
> > > to
> > > > > add the my plugin into this example app but "plugin add" dies
> because
> > > it
> > > > > tries to copy the whole plugin's folder into itself.
> > > > >
> > > > > Why isn't "plugin add" just copying the plugin.xml and all the
> files
> > > > > (assets, js-modules etc) into the plugins folder? This would
> prevent
> > > the
> > > > > endless recursion and would just copy exactly those files that are
> > > > needed.
> > > > >
> > > > > Am I missing something?
> > > > >
> > > > > cheers
> > > > > Axel
> > > >
> > >
> >
>
>
>
> --
> Carlos Santana
> <cs...@gmail.com>
>

Re: endless recursion on phonegap local plugin add ../..

Posted by Carlos Santana <cs...@gmail.com>.
Today you can also use cli hooks to delete the "examples" directory if
present


--Carlos


On Wed, Oct 23, 2013 at 2:39 PM, Axel Nennker <ig...@gmail.com> wrote:

> Yes, a copy is simpler but I think that copying only the needed files
> specified in plugin.xml makes a lot of sense.
> Am 23.10.2013 16:42 schrieb "Braden Shepherdson" <br...@chromium.org>:
>
> > The common places to fetch the plugin are over the network, from the
> plugin
> > registry or from git. Therefore the tools are expecting to download
> exactly
> > the files that are needed by the plugin, plus or minus a README or
> > whatever. They expect local plugins to be self-contained, in a directory
> by
> > themselves.
> >
> > If this is from an example plugin that is being published, maybe we
> should
> > pull the plugin's parts into a "src" or "plugin" directory, that's a
> > sibling of "examples"? This flow is not supported, and I don't think it's
> > worth the work involved to go from a dumb copy to a careful copying of
> > exactly the member files of the plugin.
> >
> > Braden
> >
> >
> > On Wed, Oct 23, 2013 at 9:24 AM, Don Coleman <do...@gmail.com>
> > wrote:
> >
> > > I've seen this problem with cordova. My instructions for the examples
> > have
> > > people copy the example folder out of the project before installing the
> > > plugin as a work around.
> > >
> > >
> > >
> > > > On Oct 23, 2013, at 7:57 AM, Axel Nennker <ig...@gmail.com>
> > wrote:
> > > >
> > > > Hi,
> > > >
> > > > the above phonegap command fails (name to long) and I think it
> applies
> > to
> > > > cordova as well.
> > > >
> > > > plugin add seems to copy the whole directory into the app's plugins
> > > > directory. Which is wrong.
> > > >
> > > >
> > > > I am developing a phonegap  plugin and inside the plugin's
> developement
> > > > folder I have a subfolder named examples. In this folder I created a
> > > > phonegap example project to show how the plugin might be used. I want
> > to
> > > > add the my plugin into this example app but "plugin add" dies because
> > it
> > > > tries to copy the whole plugin's folder into itself.
> > > >
> > > > Why isn't "plugin add" just copying the plugin.xml and all the files
> > > > (assets, js-modules etc) into the plugins folder? This would prevent
> > the
> > > > endless recursion and would just copy exactly those files that are
> > > needed.
> > > >
> > > > Am I missing something?
> > > >
> > > > cheers
> > > > Axel
> > >
> >
>



-- 
Carlos Santana
<cs...@gmail.com>

Re: endless recursion on phonegap local plugin add ../..

Posted by Axel Nennker <ig...@gmail.com>.
Yes, a copy is simpler but I think that copying only the needed files
specified in plugin.xml makes a lot of sense.
Am 23.10.2013 16:42 schrieb "Braden Shepherdson" <br...@chromium.org>:

> The common places to fetch the plugin are over the network, from the plugin
> registry or from git. Therefore the tools are expecting to download exactly
> the files that are needed by the plugin, plus or minus a README or
> whatever. They expect local plugins to be self-contained, in a directory by
> themselves.
>
> If this is from an example plugin that is being published, maybe we should
> pull the plugin's parts into a "src" or "plugin" directory, that's a
> sibling of "examples"? This flow is not supported, and I don't think it's
> worth the work involved to go from a dumb copy to a careful copying of
> exactly the member files of the plugin.
>
> Braden
>
>
> On Wed, Oct 23, 2013 at 9:24 AM, Don Coleman <do...@gmail.com>
> wrote:
>
> > I've seen this problem with cordova. My instructions for the examples
> have
> > people copy the example folder out of the project before installing the
> > plugin as a work around.
> >
> >
> >
> > > On Oct 23, 2013, at 7:57 AM, Axel Nennker <ig...@gmail.com>
> wrote:
> > >
> > > Hi,
> > >
> > > the above phonegap command fails (name to long) and I think it applies
> to
> > > cordova as well.
> > >
> > > plugin add seems to copy the whole directory into the app's plugins
> > > directory. Which is wrong.
> > >
> > >
> > > I am developing a phonegap  plugin and inside the plugin's developement
> > > folder I have a subfolder named examples. In this folder I created a
> > > phonegap example project to show how the plugin might be used. I want
> to
> > > add the my plugin into this example app but "plugin add" dies because
> it
> > > tries to copy the whole plugin's folder into itself.
> > >
> > > Why isn't "plugin add" just copying the plugin.xml and all the files
> > > (assets, js-modules etc) into the plugins folder? This would prevent
> the
> > > endless recursion and would just copy exactly those files that are
> > needed.
> > >
> > > Am I missing something?
> > >
> > > cheers
> > > Axel
> >
>

Re: endless recursion on phonegap local plugin add ../..

Posted by Braden Shepherdson <br...@chromium.org>.
The common places to fetch the plugin are over the network, from the plugin
registry or from git. Therefore the tools are expecting to download exactly
the files that are needed by the plugin, plus or minus a README or
whatever. They expect local plugins to be self-contained, in a directory by
themselves.

If this is from an example plugin that is being published, maybe we should
pull the plugin's parts into a "src" or "plugin" directory, that's a
sibling of "examples"? This flow is not supported, and I don't think it's
worth the work involved to go from a dumb copy to a careful copying of
exactly the member files of the plugin.

Braden


On Wed, Oct 23, 2013 at 9:24 AM, Don Coleman <do...@gmail.com> wrote:

> I've seen this problem with cordova. My instructions for the examples have
> people copy the example folder out of the project before installing the
> plugin as a work around.
>
>
>
> > On Oct 23, 2013, at 7:57 AM, Axel Nennker <ig...@gmail.com> wrote:
> >
> > Hi,
> >
> > the above phonegap command fails (name to long) and I think it applies to
> > cordova as well.
> >
> > plugin add seems to copy the whole directory into the app's plugins
> > directory. Which is wrong.
> >
> >
> > I am developing a phonegap  plugin and inside the plugin's developement
> > folder I have a subfolder named examples. In this folder I created a
> > phonegap example project to show how the plugin might be used. I want to
> > add the my plugin into this example app but "plugin add" dies because it
> > tries to copy the whole plugin's folder into itself.
> >
> > Why isn't "plugin add" just copying the plugin.xml and all the files
> > (assets, js-modules etc) into the plugins folder? This would prevent the
> > endless recursion and would just copy exactly those files that are
> needed.
> >
> > Am I missing something?
> >
> > cheers
> > Axel
>

Re: endless recursion on phonegap local plugin add ../..

Posted by Don Coleman <do...@gmail.com>.
I've seen this problem with cordova. My instructions for the examples have people copy the example folder out of the project before installing the plugin as a work around. 



> On Oct 23, 2013, at 7:57 AM, Axel Nennker <ig...@gmail.com> wrote:
> 
> Hi,
> 
> the above phonegap command fails (name to long) and I think it applies to
> cordova as well.
> 
> plugin add seems to copy the whole directory into the app's plugins
> directory. Which is wrong.
> 
> 
> I am developing a phonegap  plugin and inside the plugin's developement
> folder I have a subfolder named examples. In this folder I created a
> phonegap example project to show how the plugin might be used. I want to
> add the my plugin into this example app but "plugin add" dies because it
> tries to copy the whole plugin's folder into itself.
> 
> Why isn't "plugin add" just copying the plugin.xml and all the files
> (assets, js-modules etc) into the plugins folder? This would prevent the
> endless recursion and would just copy exactly those files that are needed.
> 
> Am I missing something?
> 
> cheers
> Axel