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 2014/11/11 16:52:21 UTC

plugin.xml config-file for json files

Hi,

if I remember correctly then this was discussed before but I can't find the
email exchange.

We are trying to use our cordova app on firefoxos and would like to modify
manifest.webapp which is a json file.

In plugin.xml we can only modify xml files using the config-file element.

What are your preference on how to implenent this?
- reuse config-file with new attribute type="json" (default "xml")
  or new element e.g. "config-file-json"
- only adding to the json and throw if key already exists?
- ...

Should I file an issue and implement it?

cheers
Axel

Re: plugin.xml config-file for json files

Posted by Ian Clelland <ic...@google.com>.
Relevant existing work:
https://tools.ietf.org/html/rfc6902 - JSON Patch
https://github.com/benjamine/jsondiffpatch - JSON diff / patch -- not sure
if it uses the same format as the RFC


On Tue Nov 11 2014 at 2:38:11 PM Jesse <pu...@gmail.com> wrote:

> Adding json-file would/could lead to the deprecation of the xml config
> files, but ultimately we will always need to write xml anyway, so this just
> adds functionality.
> Given that it is just an added tag, and matching worker module, this has
> near zero impact on the existing system.
>
> Modification of elements is supported in xml, optimistically, assuming
> there are never conflicts. This is especially important for things like
> plist modification, where most values are specified as defaults.
>
>
>
>
> @purplecabbage
> risingj.com
>
> On Tue, Nov 11, 2014 at 11:18 AM, Michal Mocny <mm...@chromium.org>
> wrote:
>
> > I'd also recommend hooks for now.
> >
> > <json-file> tag sounds potentially more resilient to change, but since
> you
> > have to explicitly reference the path to target I don't think its any
> > better in practice.
> >
> > Additionally, we've expressed interest in replacing our xml based configs
> > with json manifests, and while that work may not be in a hurry, it seems
> > counterproductive to extend the scope of plugin/app configs right now.
> >
> > -Michal
> >
> > On Tue, Nov 11, 2014 at 2:09 PM, Axel Nennker <ig...@gmail.com>
> > wrote:
> >
> > > I would not modify the value. Can config-file replace values?
> > > Just adding stuff would be good enough for my (current) purposes.
> > > I would throw on existing keys.
> > > When two plugins add the same key then plugman should throw and I don't
> > > want to track all changes over all plugins.
> > >
> > > 2014-11-11 19:58 GMT+01:00 Jesse <pu...@gmail.com>:
> > >
> > > > I would like to see a new element titled 'json-file' and matching
> > parser
> > > > that does the work.
> > > > something like this?
> > > >
> > > > <json-file target="someManifest.json" parent="some.object.path">
> > > > "{the:{stringValue:2,b:"added"},or:{modified:true}}"
> > > > </json-file>
> > > >
> > > >
> > > > @purplecabbage
> > > > risingj.com
> > > >
> > > > On Tue, Nov 11, 2014 at 9:02 AM, Shazron <sh...@gmail.com> wrote:
> > > >
> > > > > Have you considered plugin hooks?
> > > > > I just implemented this yesterday to modify the root config.xml
> file:
> > > > >
> > > > >
> > > >
> > >
> > https://github.com/apache/cordova-plugins/blob/master/
> local-webserver/plugin.xml
> > > > >
> > > > > On Tuesday, November 11, 2014, Axel Nennker <ignisvulpis@gmail.com
> >
> > > > wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > if I remember correctly then this was discussed before but I
> can't
> > > find
> > > > > the
> > > > > > email exchange.
> > > > > >
> > > > > > We are trying to use our cordova app on firefoxos and would like
> to
> > > > > modify
> > > > > > manifest.webapp which is a json file.
> > > > > >
> > > > > > In plugin.xml we can only modify xml files using the config-file
> > > > element.
> > > > > >
> > > > > > What are your preference on how to implenent this?
> > > > > > - reuse config-file with new attribute type="json" (default
> "xml")
> > > > > >   or new element e.g. "config-file-json"
> > > > > > - only adding to the json and throw if key already exists?
> > > > > > - ...
> > > > > >
> > > > > > Should I file an issue and implement it?
> > > > > >
> > > > > > cheers
> > > > > > Axel
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: plugin.xml config-file for json files

Posted by Jesse <pu...@gmail.com>.
Adding json-file would/could lead to the deprecation of the xml config
files, but ultimately we will always need to write xml anyway, so this just
adds functionality.
Given that it is just an added tag, and matching worker module, this has
near zero impact on the existing system.

Modification of elements is supported in xml, optimistically, assuming
there are never conflicts. This is especially important for things like
plist modification, where most values are specified as defaults.




@purplecabbage
risingj.com

On Tue, Nov 11, 2014 at 11:18 AM, Michal Mocny <mm...@chromium.org> wrote:

> I'd also recommend hooks for now.
>
> <json-file> tag sounds potentially more resilient to change, but since you
> have to explicitly reference the path to target I don't think its any
> better in practice.
>
> Additionally, we've expressed interest in replacing our xml based configs
> with json manifests, and while that work may not be in a hurry, it seems
> counterproductive to extend the scope of plugin/app configs right now.
>
> -Michal
>
> On Tue, Nov 11, 2014 at 2:09 PM, Axel Nennker <ig...@gmail.com>
> wrote:
>
> > I would not modify the value. Can config-file replace values?
> > Just adding stuff would be good enough for my (current) purposes.
> > I would throw on existing keys.
> > When two plugins add the same key then plugman should throw and I don't
> > want to track all changes over all plugins.
> >
> > 2014-11-11 19:58 GMT+01:00 Jesse <pu...@gmail.com>:
> >
> > > I would like to see a new element titled 'json-file' and matching
> parser
> > > that does the work.
> > > something like this?
> > >
> > > <json-file target="someManifest.json" parent="some.object.path">
> > > "{the:{stringValue:2,b:"added"},or:{modified:true}}"
> > > </json-file>
> > >
> > >
> > > @purplecabbage
> > > risingj.com
> > >
> > > On Tue, Nov 11, 2014 at 9:02 AM, Shazron <sh...@gmail.com> wrote:
> > >
> > > > Have you considered plugin hooks?
> > > > I just implemented this yesterday to modify the root config.xml file:
> > > >
> > > >
> > >
> >
> https://github.com/apache/cordova-plugins/blob/master/local-webserver/plugin.xml
> > > >
> > > > On Tuesday, November 11, 2014, Axel Nennker <ig...@gmail.com>
> > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > if I remember correctly then this was discussed before but I can't
> > find
> > > > the
> > > > > email exchange.
> > > > >
> > > > > We are trying to use our cordova app on firefoxos and would like to
> > > > modify
> > > > > manifest.webapp which is a json file.
> > > > >
> > > > > In plugin.xml we can only modify xml files using the config-file
> > > element.
> > > > >
> > > > > What are your preference on how to implenent this?
> > > > > - reuse config-file with new attribute type="json" (default "xml")
> > > > >   or new element e.g. "config-file-json"
> > > > > - only adding to the json and throw if key already exists?
> > > > > - ...
> > > > >
> > > > > Should I file an issue and implement it?
> > > > >
> > > > > cheers
> > > > > Axel
> > > > >
> > > >
> > >
> >
>

Re: plugin.xml config-file for json files

Posted by Michal Mocny <mm...@chromium.org>.
I'd also recommend hooks for now.

<json-file> tag sounds potentially more resilient to change, but since you
have to explicitly reference the path to target I don't think its any
better in practice.

Additionally, we've expressed interest in replacing our xml based configs
with json manifests, and while that work may not be in a hurry, it seems
counterproductive to extend the scope of plugin/app configs right now.

-Michal

On Tue, Nov 11, 2014 at 2:09 PM, Axel Nennker <ig...@gmail.com> wrote:

> I would not modify the value. Can config-file replace values?
> Just adding stuff would be good enough for my (current) purposes.
> I would throw on existing keys.
> When two plugins add the same key then plugman should throw and I don't
> want to track all changes over all plugins.
>
> 2014-11-11 19:58 GMT+01:00 Jesse <pu...@gmail.com>:
>
> > I would like to see a new element titled 'json-file' and matching parser
> > that does the work.
> > something like this?
> >
> > <json-file target="someManifest.json" parent="some.object.path">
> > "{the:{stringValue:2,b:"added"},or:{modified:true}}"
> > </json-file>
> >
> >
> > @purplecabbage
> > risingj.com
> >
> > On Tue, Nov 11, 2014 at 9:02 AM, Shazron <sh...@gmail.com> wrote:
> >
> > > Have you considered plugin hooks?
> > > I just implemented this yesterday to modify the root config.xml file:
> > >
> > >
> >
> https://github.com/apache/cordova-plugins/blob/master/local-webserver/plugin.xml
> > >
> > > On Tuesday, November 11, 2014, Axel Nennker <ig...@gmail.com>
> > wrote:
> > >
> > > > Hi,
> > > >
> > > > if I remember correctly then this was discussed before but I can't
> find
> > > the
> > > > email exchange.
> > > >
> > > > We are trying to use our cordova app on firefoxos and would like to
> > > modify
> > > > manifest.webapp which is a json file.
> > > >
> > > > In plugin.xml we can only modify xml files using the config-file
> > element.
> > > >
> > > > What are your preference on how to implenent this?
> > > > - reuse config-file with new attribute type="json" (default "xml")
> > > >   or new element e.g. "config-file-json"
> > > > - only adding to the json and throw if key already exists?
> > > > - ...
> > > >
> > > > Should I file an issue and implement it?
> > > >
> > > > cheers
> > > > Axel
> > > >
> > >
> >
>

Re: plugin.xml config-file for json files

Posted by Axel Nennker <ig...@gmail.com>.
I would not modify the value. Can config-file replace values?
Just adding stuff would be good enough for my (current) purposes.
I would throw on existing keys.
When two plugins add the same key then plugman should throw and I don't
want to track all changes over all plugins.

2014-11-11 19:58 GMT+01:00 Jesse <pu...@gmail.com>:

> I would like to see a new element titled 'json-file' and matching parser
> that does the work.
> something like this?
>
> <json-file target="someManifest.json" parent="some.object.path">
> "{the:{stringValue:2,b:"added"},or:{modified:true}}"
> </json-file>
>
>
> @purplecabbage
> risingj.com
>
> On Tue, Nov 11, 2014 at 9:02 AM, Shazron <sh...@gmail.com> wrote:
>
> > Have you considered plugin hooks?
> > I just implemented this yesterday to modify the root config.xml file:
> >
> >
> https://github.com/apache/cordova-plugins/blob/master/local-webserver/plugin.xml
> >
> > On Tuesday, November 11, 2014, Axel Nennker <ig...@gmail.com>
> wrote:
> >
> > > Hi,
> > >
> > > if I remember correctly then this was discussed before but I can't find
> > the
> > > email exchange.
> > >
> > > We are trying to use our cordova app on firefoxos and would like to
> > modify
> > > manifest.webapp which is a json file.
> > >
> > > In plugin.xml we can only modify xml files using the config-file
> element.
> > >
> > > What are your preference on how to implenent this?
> > > - reuse config-file with new attribute type="json" (default "xml")
> > >   or new element e.g. "config-file-json"
> > > - only adding to the json and throw if key already exists?
> > > - ...
> > >
> > > Should I file an issue and implement it?
> > >
> > > cheers
> > > Axel
> > >
> >
>

Re: plugin.xml config-file for json files

Posted by Jesse <pu...@gmail.com>.
I would like to see a new element titled 'json-file' and matching parser
that does the work.
something like this?

<json-file target="someManifest.json" parent="some.object.path">
"{the:{stringValue:2,b:"added"},or:{modified:true}}"
</json-file>


@purplecabbage
risingj.com

On Tue, Nov 11, 2014 at 9:02 AM, Shazron <sh...@gmail.com> wrote:

> Have you considered plugin hooks?
> I just implemented this yesterday to modify the root config.xml file:
>
> https://github.com/apache/cordova-plugins/blob/master/local-webserver/plugin.xml
>
> On Tuesday, November 11, 2014, Axel Nennker <ig...@gmail.com> wrote:
>
> > Hi,
> >
> > if I remember correctly then this was discussed before but I can't find
> the
> > email exchange.
> >
> > We are trying to use our cordova app on firefoxos and would like to
> modify
> > manifest.webapp which is a json file.
> >
> > In plugin.xml we can only modify xml files using the config-file element.
> >
> > What are your preference on how to implenent this?
> > - reuse config-file with new attribute type="json" (default "xml")
> >   or new element e.g. "config-file-json"
> > - only adding to the json and throw if key already exists?
> > - ...
> >
> > Should I file an issue and implement it?
> >
> > cheers
> > Axel
> >
>

Re: plugin.xml config-file for json files

Posted by Shazron <sh...@gmail.com>.
Have you considered plugin hooks?
I just implemented this yesterday to modify the root config.xml file:
https://github.com/apache/cordova-plugins/blob/master/local-webserver/plugin.xml

On Tuesday, November 11, 2014, Axel Nennker <ig...@gmail.com> wrote:

> Hi,
>
> if I remember correctly then this was discussed before but I can't find the
> email exchange.
>
> We are trying to use our cordova app on firefoxos and would like to modify
> manifest.webapp which is a json file.
>
> In plugin.xml we can only modify xml files using the config-file element.
>
> What are your preference on how to implenent this?
> - reuse config-file with new attribute type="json" (default "xml")
>   or new element e.g. "config-file-json"
> - only adding to the json and throw if key already exists?
> - ...
>
> Should I file an issue and implement it?
>
> cheers
> Axel
>

Re: plugin.xml config-file for json files

Posted by Mark Koudritsky <ka...@google.com>.
I was just having similar thoughts about getting info from the plugin to
*.gradle files.

Another option for JSON would be to bundle a JSON file with the same
structure as manifest.webapp and have the FirefoxOS build script merge this
file into manifest.webapp as one of the first steps. This will require a
convention, say all JOSN fils in a dir called manifest_extras get merged
into manifest.webapp by the firefoxos build script. And plugins will be
able to bundle json files with target-dir="manifest_extras/".

I know very little about firefoxos, but for gradle files on Android this
will probably be simpler to implement and more flexible (but only after
Gradles becomes the only supported build system).

On Tue, Nov 11, 2014 at 10:52 AM, Axel Nennker <ig...@gmail.com>
wrote:

> Hi,
>
> if I remember correctly then this was discussed before but I can't find the
> email exchange.
>
> We are trying to use our cordova app on firefoxos and would like to modify
> manifest.webapp which is a json file.
>
> In plugin.xml we can only modify xml files using the config-file element.
>
> What are your preference on how to implenent this?
> - reuse config-file with new attribute type="json" (default "xml")
>   or new element e.g. "config-file-json"
> - only adding to the json and throw if key already exists?
> - ...
>
> Should I file an issue and implement it?
>
> cheers
> Axel
>