Question about iOS build tools

I am developing a small extension to OpenFL for iOS that would allow one to show a web page and to have HaXe and the page javascript be able to exchange information. I have most of the code ready and in a working condition (available at under MIT licence in case anyone is interested) but I am having some trouble with command line build tools that I currently bypass via XCode GUI.

To be precise, I cannot figure out how to get resources that are included with the project (in the project.xml file) to be a part of a bundle I can reference from the plugin code. My current workaround is to move them to an appropriate position via the XCode GUI but this is highly inconvenient as it needs manual work after each “lime build” command.

Am I missing something obvious (like looking somewhere other than mainBundle or having a tag attribute for project.xml that accomplishes what I need)?

Hi. Try the “template” tag. Write the path to your resource and in “rename” the relative location were you need it.

You can use <template path="to/my/templates/directory" /> and mirror the directory structure in or

For example:

<templates path="templates" />

and you have “templates/iphone/PROJ/mycoolfile.txt”

When the tools generate a project directory for the iOS target, the template will include your additional file now

Sadly, that does not work, as copying the file into the root directory of thhe project still does not add them to the mainBundle . I’m not ruling out this can be accomplished with templating, but my current best guess is that one would have to change the ios project file in order to get the files into a bundle.

If you are confident it can be done with templates, could you please look at my github code and tell me why my attempt at doing it with template tags does not work and how to fix it?

You can check your project.pbxproj file, which is inside your *.xcodeproj to see what is the difference.

You can also use template tag for overriding this file (use “…/foo.xcodeproj/project.pbxproj” in rename). So, save your file after manually edited in xcode, and then override it on next time with the template tag. Just take care if you made other changes, to update your saved file.

there should also be some code in place in order to use <dependency path="to/file" /> for projects, it’s designed, though, for C++ libraries primarily, so it might not have all the right behavior for including a standard file, another way to have things added to the bundle (obviously) is for it to be a standard asset, I’m not sure if including it with other assets would be a valid way to go

Thank you for the answers. What you are proposing should work, but does have the downside of having to update the project file manually every time there are more substantial code changes (new files added etc).

As such, I was wondering, could anyone point me in the direction of where the pbxproj file is generated by lime, as I might be able to figure out the required changes to generate scripts and in this way contribute to the development of the build system. There are a few other minor annoyances I would also like to get resolved this way, and I’d be happy to format it as a PR if I do manage to get it done so that everyone could benefit.

Lime’s project.pbxproj template.

Note: this goes outside the folder that the template system normally places files in. You’ll have to use the path “../YourProjectName.xcodeproj/project.pbxproj”.

1 Like

What I mean is that you should compare your project.pbxproj (in the bin directory, inside YourProjectName.xcodeproj) before and after your editing in XCode. These differences can be adjusted using the XML tags. As @singmajesty says, the “dependecy” tag may be enough, otherwise a new tag may be implemented :smiley:

My suggestion to override the project.pbxproj file is only temporary. Only useful if you know that it won’t be changed and if there is no way to achieve it by XML tags.

The file is generated from “lime/tools”, I think the file you’re looking for is under “src/platforms/IOSPlatform.hx” or something like that :slight_smile: