2

Is it possible to execute a script within a custom Xcode 4 project file template? I am not referring to a Run Script within the target build phase but a script that is executed once the template is chosen and prepares the project itself.

I am trying to create a template that forces the addition of a (number of) git submodules. To do so, I envisioned to run a script that is executed once the user creates a project file from my custom template. So far, my research did not succeed in finding a way to run a script once the template is used.

Till
  • 27,559
  • 13
  • 88
  • 122

1 Answers1

2

You could try adding a .gitmodules to a project template… no idea if that would fly under Xcode's templates.

If that fails, then, no -- but you can just add the .gitmodules file to the directory (or write a script), and the process should be quick and painless despite no direct support from the ide.

You might even take a middle of the road approach, where the project contained a script (PROJECT_ROOT/config_modules.sh) to add these modules to the repo at that directory. Then create another script to search, exec, and delete the config_modules.sh, once you have created all those projects.

justin
  • 104,054
  • 14
  • 179
  • 226
  • First of all, thanks for your valuable input. For the first part, if I understood the project templates correctly then adding a file to it that is later on not referenced within the project is not possible. For the rest of your ideas I think having some kind of a hybrid solution that works with self-modification (kinda) seems possible. Will investigate.... – Till May 21 '12 at 14:41