You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Roman Shtylman <sh...@gmail.com> on 2014/02/24 22:25:15 UTC

reading config.xml during build

I am looking for a way to add support for the following item in config.xml

    <preference name="TargetDevices" value="handhelds”/>

And have my iOS build (eventually other platforms) target only iPhone and iPod.

I have found that to do this, all I need is to add TARGET_DEVICE_ID=1 to the build.xcconfig file in the iOS platforms cordova/scripts directory. However, I am not sure which file would be best responsible for reading config.xml (from the project root) and then updating this particular build file. Right now this file is copied into place by the “create” step in cordova-ios and it seems that nothing else ever touches it.

Where in cordova projects are the config.xml values read and then translated to platform specific settings?

cheers,
~Roman

Re: reading config.xml during build

Posted by Braden Shepherdson <br...@chromium.org>.
All the gory details of config files in CLI are here:
https://wiki.apache.org/cordova/config/cordova.xml

In short, that file is turned into a platform-specific config.xml during
the prepare step.

Your best approach to supporting this is probably to read config.xml in a
post-prepare hook. Then it will run during a "build" (build =
prepare+compile), or if you prepare and then use Xcode.

Braden


On Mon, Feb 24, 2014 at 4:25 PM, Roman Shtylman <sh...@gmail.com> wrote:

> I am looking for a way to add support for the following item in config.xml
>
>     <preference name="TargetDevices" value="handhelds”/>
>
> And have my iOS build (eventually other platforms) target only iPhone and
> iPod.
>
> I have found that to do this, all I need is to add TARGET_DEVICE_ID=1 to
> the build.xcconfig file in the iOS platforms cordova/scripts directory.
> However, I am not sure which file would be best responsible for reading
> config.xml (from the project root) and then updating this particular build
> file. Right now this file is copied into place by the “create” step in
> cordova-ios and it seems that nothing else ever touches it.
>
> Where in cordova projects are the config.xml values read and then
> translated to platform specific settings?
>
> cheers,
> ~Roman
>