templatesscriptingxcode4targets

How to add a build phase in a project template?


I'm trying to add a Run Script Build Phase to a target in a custom Project Template for Xcode 4.

Does anyone have any examples, tutorials, or tips on how to do this?

I'm assuming that this will be done in TemplateInfo.plist - but my searches are comming up fruitless.


Solution

  • After quite a lot of trial-and-error I've worked it out. This is the extra key needed in the TemplateInfo.plist. This adds a script that will run after the other default build phases.

    <key>Targets</key>
    <array>
        <dict>
            <key>BuildPhases</key>
            <array>
                <dict>
                    <key>Class</key>
                    <string>ShellScript</string>
                    <key>ShellPath</key>
                    <string>/bin/sh</string>
                    <key>ShellScript</key>
                    <string># Just a comment</string>
                </dict>
            </array>
        </dict>
    </array>