The pull request is here:
https://github.com/apache/cordova-plugman/pull/41

The code now emits a warning if resouce-file is not supported on the
platform.
res is now not prepended to the target anymore; so an example element in
plugin.xml would be:
<resource-file src="glass.xml" target="res/xml/glass.xml" />
Which would move the file from <plugin_dir>/glass.xml to
<project_dir>/res/xml/glass.xml (project_dir is e.g. platforms/android/)

Added a comment to

https://issues.apache.org/jira/browse/CB-5720

The repository is here:

https://github.com/AxelNennker/cordova-plugman

Cordova docs

http://cordova.apache.org/docs/en/3.3.0/plugin_ref_spec.md.html#Plugin%20Specification_resource_file_and_header_file_elements

need an update because of the new "target" attribute of "resouce-file".

Somewhere in the doc is an Android example for source-file. I would add an
example for resouce-file there but I can't find it anymore...


-Axel



needs an update.

-Axel




2014/1/8 Axel Nennker <ignisvul...@gmail.com>

> ad 1) I tried emit but it did not emit anything. Will try again.
> ad 2) I will remove the path.join with res.
> -d outputs what is copied to where. So devs can see what ends up where.
>
> -Axel
>
>
> 2014/1/8 Andrew Grieve <agri...@chromium.org>
>
>> Hey, thanks for the reminder.
>>
>> Change looks great. Only two questions for it:
>>
>> 1. The stubs for the other platforms will make them silently ignore
>> resource-file tags. WDYT about emitting a log message with a warning saying
>> that the tag is ignored?
>> 2. For Android, you're restricting resources to the res/ directory. I can
>> see someone making the mistake of also saying prefixing their target with
>> "res/", so I'm wondering if it would be good to either:
>>   - Not prefix with res/ (and thus allow them to put files anywhere,
>> maybe in assets/myfile.txt for example), or:
>>   - Check that they are putting files within one of:
>> (drawable-*|layout|values|xml)
>>
>> WDYT?
>>
>>
>> On Wed, Jan 8, 2014 at 3:38 AM, Axel Nennker <ignisvul...@gmail.com>wrote:
>>
>>> Andrew,
>>>
>>> any progress on this?
>>> I think that it make sense to implement resource-file on Android.
>>>
>>> best
>>> Axel
>>>
>>>
>>> 2014/1/3 Axel Nennker <ignisvul...@gmail.com>
>>>
>>>> Although source-file could be used I think it is wrong to use
>>>> source-file to copy files to <project_dir> or it's subdirectory.
>>>> It just happens to work because on Android because the Android build
>>>> system just compiles every file in <project_dir>/src and uses every file in
>>>> <project_dir>/res to generate e.g gen/R.java
>>>> On other platforms (ios) the plugin author can even specify compiler
>>>> flags.
>>>> source-file should only be used for files that are input to the
>>>> compiler I think.
>>>>
>>>> Too bad that the documentation for resource file
>>>>
>>>> http://cordova.apache.org/docs/en/3.3.0/plugin_ref_spec.md.html#Plugin%20Specification_resource_file_and_header_file_elements
>>>> does not specify a target. I think it should.
>>>>
>>>> Every Android developer thinks that "resource-file" is intended to
>>>> handle file in e.g. <project_dir>/res/xml/
>>>> I think it is bad that the cordova leaves it to the developer to
>>>> discover that some elements (like lib-file or resource-file) do not work on
>>>> their target platform.
>>>>
>>>> I think that resource-file should be implemented for Android and that
>>>> there should be a clear warning when it is not implemented on a platform
>>>> like e.g. firefoxos.
>>>>
>>>> Could you please pull - at least - this?: (android.js)
>>>>
>>>> https://github.com/AxelNennker/cordova-plugman/commit/97974f77859d78437d84086d2b927036359d971e
>>>>
>>>> -Axel
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> 2014/1/2 Axel Nennker <ignisvul...@gmail.com>
>>>>
>>>>> ios does something more than just copy files.
>>>>> ubuntu copies the src to a subdirectory named qml.
>>>>>
>>>>> source-file could be used on Android for my purposes. The major
>>>>> difference is that my implementation of resouce-file uses a target file
>>>>> instead of target-dir which would allow to rename the src.
>>>>>
>>>>> I suggest to improve the documentation to say that source-file could
>>>>> be used to move arbitrary files.
>>>>>
>>>>> -Axel
>>>>>
>>>>> ps: some implentations use common.copyFile while others use shell.cp
>>>>> to copy files. Is there a difference when copying binary files.
>>>>> What about --variable on binary files?
>>>>>
>>>>>
>>>>>
>>>>> 2014/1/2 Andrew Grieve <agri...@chromium.org>
>>>>>
>>>>>> I thought about <source-file> as well, but given that <resource-file>
>>>>>> is
>>>>>> already implemented on other platforms, I think it would make sense
>>>>>> to have
>>>>>> it for Android.
>>>>>>
>>>>>> Another thought is that it's more semantically correct.
>>>>>> E.g. We might at some point make target-dir optional for android (it's
>>>>>> optional on other platforms), and just infer the directory from the
>>>>>> package
>>>>>> declaration.
>>>>>>
>>>>>>
>>>>>> On Thu, Jan 2, 2014 at 1:47 PM, Joe Bowser <bows...@gmail.com> wrote:
>>>>>>
>>>>>> > Why is this needed?  You can use source file to copy resources.
>>>>>>  This
>>>>>> > just adds XML for the sake of adding more XML.
>>>>>> >
>>>>>> > On Thu, Jan 2, 2014 at 10:36 AM, Andrew Grieve <
>>>>>> agri...@chromium.org>
>>>>>> > wrote:
>>>>>> > > Looking at the plugin spec:
>>>>>> > >
>>>>>> >
>>>>>> http://cordova.apache.org/docs/en/3.3.0/plugin_ref_spec.md.html#Plugin%20Specification
>>>>>> > >
>>>>>> > > I think this sounds great! Certainly the section in there could
>>>>>> use some
>>>>>> > > elaboration, but I think I'd expect the tag to work as you've
>>>>>> implemented
>>>>>> > > it.
>>>>>> > >
>>>>>> > > If no one objects, I'll pull it in tomorrow.
>>>>>> > >
>>>>>> > >
>>>>>> > > On Thu, Jan 2, 2014 at 1:10 PM, Axel Nennker <
>>>>>> ignisvul...@gmail.com>
>>>>>> > wrote:
>>>>>> > >
>>>>>> > >> Hi,
>>>>>> > >>
>>>>>> > >> I created an issue in JIRA:
>>>>>> > >> https://issues.apache.org/jira/browse/CB-5720
>>>>>> > >>
>>>>>> > >> Description
>>>>>> > >>
>>>>>> > >> Add support for <resource-file src="glass.xml"
>>>>>> target="xml/glass.xml"
>>>>>> > /> to
>>>>>> > >> a plugin's plugin.xml
>>>>>> > >>
>>>>>> > >> The above example would copy the file glass.xml from the plugin's
>>>>>> > directory
>>>>>> > >> to the platforms/android/res/xml/glass.xml
>>>>>> > >>
>>>>>> > >> The ubuntu platform had this feature already. Although
>>>>>> undocumented.
>>>>>> > >>
>>>>>> > >> This is for the use case when a plugin in needs additional file
>>>>>> e.g. in
>>>>>> > >> res/xml or other directories.
>>>>>> > >> An example for Android would be an authenticator that is
>>>>>> specified in
>>>>>> > >> AndroidManifest.xml
>>>>>> > >> The code to implement this is here
>>>>>> > >> https://github.com/AxelNennker/cordova-plugman
>>>>>> > >>
>>>>>> > >> The pull request is here:
>>>>>> > >> https://github.com/apache/cordova-plugman/pull/41
>>>>>> > >>
>>>>>> > >> -Axel
>>>>>> > >>
>>>>>> >
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>

Reply via email to