You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Andreas Sander <an...@hotmail.de> on 2013/05/02 17:46:51 UTC

Import platform specific www-files

Hi again ;-),
I use a plugin with different JavaScript files for each platform. Can I, somehow, control which of these files are added to which platform specific www folder during cordova build?
Or do I need to include both inside the www folder and refer to them based on device.platform?
Greets,
Andreas 		 	   		  

Re: Import platform specific www-files

Posted by Filip Maj <fi...@adobe.com>.
Andreas,

Can you file this as an issue in JIRA instead of on this list? We can work
out your specific problems in an issue instead of bothering the entire
list.

Head over to issues.cordova.io, sign up for an account if you don't have
one already, and file an issue. Component should be set to "plugman"

On 5/3/13 12:41 AM, "Andreas Sander" <an...@hotmail.de> wrote:

>Hi,
>I need a tip what's wrong with my XML file.
>My file structure is:
>plugin||-> plugin.xml|-> www/       |        ----> ios/        ---->
>android/-> src/     |      ---> ios/      ---> android/
>and here is my XML
>When I use the asset command before android platform, everything works
>great. But inside the platform specification something seems to be wrong
>and nothing happens.
>Can somebody help me with that, or is it possible to debug the xml or
>check it against a specific xml specification?
>With best regards,
>Andreas
><?xml version="1.0" encoding="UTF-8"?><plugin
>xmlns="http://apache.org/cordova/ns/plugins/1.0"
>xmlns:android="http://schemas.android.com/apk/res/android"
>id="com.phonegap.sqlitePlugin"    version="1.0.0">
>    <name>SQLite Plugin</name>        <preference name="API_KEY" />
> <engines>      <engine name="cordova" version=">=2.1.0" />    </engines>
>       <!-- This one works great <asset src="www/android/SQLitePlugin.js"
>target="SQLitePlugin.js" />-->
>    <!-- android -->    <platform name="android">
>	<asset src="www/android/SQLitePlugin.js" target="SQLitePlugin.js" />
>        <config-file target="config.xml" parent="/cordova/plugins">
>    <plugin name="SQLitePlugin"
>value="com.phonegap.plugin.sqlitePlugin.SQLitePlugin"/>
></config-file>               <!-- res files -->
><!-- cordova plugin src files -->        <source-file
>src="src/android/com/phonegap/plugin/sqlitePlugin/SQLitePlugin.java"
>target-dir="src/com/phonegap/plugin/sqlitePlugin" />
></platform>        <!-- ios -->    <platform name="ios">
>	<asset src="www/ios/SQLitePlugin.js" target="SQLitePlugin.js"
>/>	<header-file src="SQLitePlugin.h"/>        <source-file
>src="src/ios/SQLitePlugin.m"/>
>	<plugins-plist key="SQLitePlugin" string="SQLitePlugin" />
>                     <!-- frameworks -->        <framework
>src="libsqlite3.dylib" />    </platform></plugin>
>
>> From: andreas.sander@hotmail.de
>> To: dev@cordova.apache.org
>> Subject: RE: Import platform specific www-files
>> Date: Thu, 2 May 2013 20:41:05 +0200
>> 
>> Is there a way to debug my plugin.xml file?
>> > From: fil@adobe.com
>> > To: dev@cordova.apache.org
>> > Date: Thu, 2 May 2013 09:44:52 -0700
>> > Subject: Re: Import platform specific www-files
>> > 
>> > Hey Andreas,
>> > 
>> > If you are the author of the plugin, I would recommend checking out
>> > plugman, which is cordova's tool for installing and uninstalling
>>plugins
>> > automatically into/from a cordova project:
>> > 
>> > 
>>https://git-wip-us.apache.org/repos/asf?p=cordova-plugman.git;a=summary
>> > 
>> > 
>> > In the README, there is a specification for a plugin.xml manifest.
>>This
>> > file describes what makes up your plugin, and the plugman tool uses
>>this
>> > manifest to run the installation and uninstallation. It supports the
>> > following use cases, which seem to align with your objectives:
>> > 
>> > - <asset> or <js-module> elements that can be nested under a
>>particular
>> > <platform> element, denoting platform-specific web assets or
>>javascript
>> > modules that should be included in the plugin only for certain
>>platforms.
>> > - also has a <config-file> element allowing to automatically
>>add/remove
>> > sections from various cordova and native project configuration files.
>> > 
>> > For a few examples check out PhoneGap Build's plugins:
>> > 
>> > https://github.com/phonegap-build
>> > 
>> > They all have a plugin.xml manifest.
>> > 
>> > On 5/2/13 9:36 AM, "Andreas Sander" <an...@hotmail.de> wrote:
>> > 
>> > >Thanks!
>> > >One further question:
>> > >Is it possible to add the necessary plugin entries into the project
>>plist
>> > >(iOS) and config.xml (android) automatically during build or do I
>>have to
>> > >do this always manually?
>> > >Do I need to specify these settings inside the plugin folder?
>> > >> From: mmocny@chromium.org
>> > >> Date: Thu, 2 May 2013 11:55:59 -0400
>> > >> Subject: Re: Import platform specific www-files
>> > >> To: dev@cordova.apache.org
>> > >> 
>> > >> If you are using cordova-cli, there is already a merges/ folder for
>> > >>exactly
>> > >> this.
>> > >> 
>> > >> From the README:
>> > >> 
>> > >> Platform-specific web assets (HTML, CSS and JavaScript files) are
>> > >>contained
>> > >> within appropriate subfolders in this directory. These are deployed
>> > >>during
>> > >> a prepare to the appropriate native directory. Files placed under
>> > >>merges/ will
>> > >> override matching files in the www/folder for the relevant
>>platform.
>> > >> 
>> > >> 
>> > >> On Thu, May 2, 2013 at 11:46 AM, Andreas Sander
>> > >> <an...@hotmail.de>wrote:
>> > >> 
>> > >> > Hi again ;-),
>> > >> > I use a plugin with different JavaScript files for each
>>platform. Can
>> > >>I,
>> > >> > somehow, control which of these files are added to which platform
>> > >>specific
>> > >> > www folder during cordova build?
>> > >> > Or do I need to include both inside the www folder and refer to
>>them
>> > >>based
>> > >> > on device.platform?
>> > >> > Greets,
>> > >> > Andreas
>> > > 		 	   		  
>> > 
>>  		 	   		  
> 		 	   		  


RE: Import platform specific www-files

Posted by Andreas Sander <an...@hotmail.de>.
Hi,
I need a tip what's wrong with my XML file.
My file structure is:
plugin||-> plugin.xml|-> www/       |        ----> ios/        ----> android/-> src/     |      ---> ios/      ---> android/
and here is my XML
When I use the asset command before android platform, everything works great. But inside the platform specification something seems to be wrong and nothing happens.
Can somebody help me with that, or is it possible to debug the xml or check it against a specific xml specification?
With best regards,
Andreas
<?xml version="1.0" encoding="UTF-8"?><plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"    xmlns:android="http://schemas.android.com/apk/res/android"    id="com.phonegap.sqlitePlugin"    version="1.0.0">
    <name>SQLite Plugin</name>        <preference name="API_KEY" />        <engines>      <engine name="cordova" version=">=2.1.0" />    </engines>        <!-- This one works great <asset src="www/android/SQLitePlugin.js" target="SQLitePlugin.js" />-->
    <!-- android -->    <platform name="android">
	<asset src="www/android/SQLitePlugin.js" target="SQLitePlugin.js" />
        <config-file target="config.xml" parent="/cordova/plugins">           <plugin name="SQLitePlugin" value="com.phonegap.plugin.sqlitePlugin.SQLitePlugin"/>        </config-file>               <!-- res files -->                       <!-- cordova plugin src files -->        <source-file src="src/android/com/phonegap/plugin/sqlitePlugin/SQLitePlugin.java" target-dir="src/com/phonegap/plugin/sqlitePlugin" />            </platform>        <!-- ios -->    <platform name="ios">
	<asset src="www/ios/SQLitePlugin.js" target="SQLitePlugin.js" />	<header-file src="SQLitePlugin.h"/>        <source-file src="src/ios/SQLitePlugin.m"/>
	<plugins-plist key="SQLitePlugin" string="SQLitePlugin" />                                    <!-- frameworks -->        <framework src="libsqlite3.dylib" />    </platform></plugin>

> From: andreas.sander@hotmail.de
> To: dev@cordova.apache.org
> Subject: RE: Import platform specific www-files
> Date: Thu, 2 May 2013 20:41:05 +0200
> 
> Is there a way to debug my plugin.xml file?
> > From: fil@adobe.com
> > To: dev@cordova.apache.org
> > Date: Thu, 2 May 2013 09:44:52 -0700
> > Subject: Re: Import platform specific www-files
> > 
> > Hey Andreas,
> > 
> > If you are the author of the plugin, I would recommend checking out
> > plugman, which is cordova's tool for installing and uninstalling plugins
> > automatically into/from a cordova project:
> > 
> > https://git-wip-us.apache.org/repos/asf?p=cordova-plugman.git;a=summary
> > 
> > 
> > In the README, there is a specification for a plugin.xml manifest. This
> > file describes what makes up your plugin, and the plugman tool uses this
> > manifest to run the installation and uninstallation. It supports the
> > following use cases, which seem to align with your objectives:
> > 
> > - <asset> or <js-module> elements that can be nested under a particular
> > <platform> element, denoting platform-specific web assets or javascript
> > modules that should be included in the plugin only for certain platforms.
> > - also has a <config-file> element allowing to automatically add/remove
> > sections from various cordova and native project configuration files.
> > 
> > For a few examples check out PhoneGap Build's plugins:
> > 
> > https://github.com/phonegap-build
> > 
> > They all have a plugin.xml manifest.
> > 
> > On 5/2/13 9:36 AM, "Andreas Sander" <an...@hotmail.de> wrote:
> > 
> > >Thanks!
> > >One further question:
> > >Is it possible to add the necessary plugin entries into the project plist
> > >(iOS) and config.xml (android) automatically during build or do I have to
> > >do this always manually?
> > >Do I need to specify these settings inside the plugin folder?
> > >> From: mmocny@chromium.org
> > >> Date: Thu, 2 May 2013 11:55:59 -0400
> > >> Subject: Re: Import platform specific www-files
> > >> To: dev@cordova.apache.org
> > >> 
> > >> If you are using cordova-cli, there is already a merges/ folder for
> > >>exactly
> > >> this.
> > >> 
> > >> From the README:
> > >> 
> > >> Platform-specific web assets (HTML, CSS and JavaScript files) are
> > >>contained
> > >> within appropriate subfolders in this directory. These are deployed
> > >>during
> > >> a prepare to the appropriate native directory. Files placed under
> > >>merges/ will
> > >> override matching files in the www/folder for the relevant platform.
> > >> 
> > >> 
> > >> On Thu, May 2, 2013 at 11:46 AM, Andreas Sander
> > >> <an...@hotmail.de>wrote:
> > >> 
> > >> > Hi again ;-),
> > >> > I use a plugin with different JavaScript files for each platform. Can
> > >>I,
> > >> > somehow, control which of these files are added to which platform
> > >>specific
> > >> > www folder during cordova build?
> > >> > Or do I need to include both inside the www folder and refer to them
> > >>based
> > >> > on device.platform?
> > >> > Greets,
> > >> > Andreas
> > > 		 	   		  
> > 
>  		 	   		  
 		 	   		  

RE: Import platform specific www-files

Posted by Andreas Sander <an...@hotmail.de>.
Is there a way to debug my plugin.xml file?
> From: fil@adobe.com
> To: dev@cordova.apache.org
> Date: Thu, 2 May 2013 09:44:52 -0700
> Subject: Re: Import platform specific www-files
> 
> Hey Andreas,
> 
> If you are the author of the plugin, I would recommend checking out
> plugman, which is cordova's tool for installing and uninstalling plugins
> automatically into/from a cordova project:
> 
> https://git-wip-us.apache.org/repos/asf?p=cordova-plugman.git;a=summary
> 
> 
> In the README, there is a specification for a plugin.xml manifest. This
> file describes what makes up your plugin, and the plugman tool uses this
> manifest to run the installation and uninstallation. It supports the
> following use cases, which seem to align with your objectives:
> 
> - <asset> or <js-module> elements that can be nested under a particular
> <platform> element, denoting platform-specific web assets or javascript
> modules that should be included in the plugin only for certain platforms.
> - also has a <config-file> element allowing to automatically add/remove
> sections from various cordova and native project configuration files.
> 
> For a few examples check out PhoneGap Build's plugins:
> 
> https://github.com/phonegap-build
> 
> They all have a plugin.xml manifest.
> 
> On 5/2/13 9:36 AM, "Andreas Sander" <an...@hotmail.de> wrote:
> 
> >Thanks!
> >One further question:
> >Is it possible to add the necessary plugin entries into the project plist
> >(iOS) and config.xml (android) automatically during build or do I have to
> >do this always manually?
> >Do I need to specify these settings inside the plugin folder?
> >> From: mmocny@chromium.org
> >> Date: Thu, 2 May 2013 11:55:59 -0400
> >> Subject: Re: Import platform specific www-files
> >> To: dev@cordova.apache.org
> >> 
> >> If you are using cordova-cli, there is already a merges/ folder for
> >>exactly
> >> this.
> >> 
> >> From the README:
> >> 
> >> Platform-specific web assets (HTML, CSS and JavaScript files) are
> >>contained
> >> within appropriate subfolders in this directory. These are deployed
> >>during
> >> a prepare to the appropriate native directory. Files placed under
> >>merges/ will
> >> override matching files in the www/folder for the relevant platform.
> >> 
> >> 
> >> On Thu, May 2, 2013 at 11:46 AM, Andreas Sander
> >> <an...@hotmail.de>wrote:
> >> 
> >> > Hi again ;-),
> >> > I use a plugin with different JavaScript files for each platform. Can
> >>I,
> >> > somehow, control which of these files are added to which platform
> >>specific
> >> > www folder during cordova build?
> >> > Or do I need to include both inside the www folder and refer to them
> >>based
> >> > on device.platform?
> >> > Greets,
> >> > Andreas
> > 		 	   		  
> 
 		 	   		  

Re: Import platform specific www-files

Posted by Filip Maj <fi...@adobe.com>.
Hey Andreas,

If you are the author of the plugin, I would recommend checking out
plugman, which is cordova's tool for installing and uninstalling plugins
automatically into/from a cordova project:

https://git-wip-us.apache.org/repos/asf?p=cordova-plugman.git;a=summary


In the README, there is a specification for a plugin.xml manifest. This
file describes what makes up your plugin, and the plugman tool uses this
manifest to run the installation and uninstallation. It supports the
following use cases, which seem to align with your objectives:

- <asset> or <js-module> elements that can be nested under a particular
<platform> element, denoting platform-specific web assets or javascript
modules that should be included in the plugin only for certain platforms.
- also has a <config-file> element allowing to automatically add/remove
sections from various cordova and native project configuration files.

For a few examples check out PhoneGap Build's plugins:

https://github.com/phonegap-build

They all have a plugin.xml manifest.

On 5/2/13 9:36 AM, "Andreas Sander" <an...@hotmail.de> wrote:

>Thanks!
>One further question:
>Is it possible to add the necessary plugin entries into the project plist
>(iOS) and config.xml (android) automatically during build or do I have to
>do this always manually?
>Do I need to specify these settings inside the plugin folder?
>> From: mmocny@chromium.org
>> Date: Thu, 2 May 2013 11:55:59 -0400
>> Subject: Re: Import platform specific www-files
>> To: dev@cordova.apache.org
>> 
>> If you are using cordova-cli, there is already a merges/ folder for
>>exactly
>> this.
>> 
>> From the README:
>> 
>> Platform-specific web assets (HTML, CSS and JavaScript files) are
>>contained
>> within appropriate subfolders in this directory. These are deployed
>>during
>> a prepare to the appropriate native directory. Files placed under
>>merges/ will
>> override matching files in the www/folder for the relevant platform.
>> 
>> 
>> On Thu, May 2, 2013 at 11:46 AM, Andreas Sander
>> <an...@hotmail.de>wrote:
>> 
>> > Hi again ;-),
>> > I use a plugin with different JavaScript files for each platform. Can
>>I,
>> > somehow, control which of these files are added to which platform
>>specific
>> > www folder during cordova build?
>> > Or do I need to include both inside the www folder and refer to them
>>based
>> > on device.platform?
>> > Greets,
>> > Andreas
> 		 	   		  


RE: Import platform specific www-files

Posted by Andreas Sander <an...@hotmail.de>.
Thanks!
One further question:
Is it possible to add the necessary plugin entries into the project plist (iOS) and config.xml (android) automatically during build or do I have to do this always manually?
Do I need to specify these settings inside the plugin folder? 
> From: mmocny@chromium.org
> Date: Thu, 2 May 2013 11:55:59 -0400
> Subject: Re: Import platform specific www-files
> To: dev@cordova.apache.org
> 
> If you are using cordova-cli, there is already a merges/ folder for exactly
> this.
> 
> From the README:
> 
> Platform-specific web assets (HTML, CSS and JavaScript files) are contained
> within appropriate subfolders in this directory. These are deployed during
> a prepare to the appropriate native directory. Files placed under merges/ will
> override matching files in the www/folder for the relevant platform.
> 
> 
> On Thu, May 2, 2013 at 11:46 AM, Andreas Sander
> <an...@hotmail.de>wrote:
> 
> > Hi again ;-),
> > I use a plugin with different JavaScript files for each platform. Can I,
> > somehow, control which of these files are added to which platform specific
> > www folder during cordova build?
> > Or do I need to include both inside the www folder and refer to them based
> > on device.platform?
> > Greets,
> > Andreas
 		 	   		  

Re: Import platform specific www-files

Posted by Michal Mocny <mm...@chromium.org>.
If you are using cordova-cli, there is already a merges/ folder for exactly
this.

>From the README:

Platform-specific web assets (HTML, CSS and JavaScript files) are contained
within appropriate subfolders in this directory. These are deployed during
a prepare to the appropriate native directory. Files placed under merges/ will
override matching files in the www/folder for the relevant platform.


On Thu, May 2, 2013 at 11:46 AM, Andreas Sander
<an...@hotmail.de>wrote:

> Hi again ;-),
> I use a plugin with different JavaScript files for each platform. Can I,
> somehow, control which of these files are added to which platform specific
> www folder during cordova build?
> Or do I need to include both inside the www folder and refer to them based
> on device.platform?
> Greets,
> Andreas