• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Seeking Suggestions for Template Projects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Seeking Suggestions for Template Projects


  • Subject: Re: Seeking Suggestions for Template Projects
  • From: Rush Manbert <email@hidden>
  • Date: Wed, 14 Jun 2006 12:47:59 -0700

Jonas Maebe wrote:

On 14 jun 2006, at 19:18, Rush Manbert wrote:

1) Is there any advantage to making an "official" project template by copying the project directory to the magic location over just leaving the original in your source tree and copying/renaming it when you want a new library project? I can write a script that copies and renames, and it saves the Mac developers from needing to install the project template directory.


I guess nothing apart from being able to use some built-in Xcode magic to automatically rename and substitute some things.

2) Since my project template contains a named target that builds the library, I will want to rename the target when I make a new project. I will also want to change the product name build setting. Is there any programmatic way to do that other than AppleScript?


You have to edit the $projectname.xcode/project.pbxproject file and replace the appropriate target name with "«PROJECTNAME»" (without the double quotes). The encoding of the file is UTF-8, but it doesn't (and mustn't) start with an UTF-8 marker. So the safest way to do this (in my experience), is to edit it as Mac OS roman or so, open a standard Apple template in another window and copy/paste the corresponding character string (should look like "¬´PROJECTNAME¬ª", again without the quotes).

You can also put a file called TemplateInfo.plist in the $projectname.xcode directory, with contents like this:

---
{
FilesToRename = {
"PascalTool.pas" = "«PROJECTNAME».pas";
"PascalTool.1" = "«PROJECTNAME».1";
};
FilesToMacroExpand = (
"«PROJECTNAME».1"
);
Description = "This project builds a command line tool written in Pascal and compiled with the Free Pascal Compiler.";
}
---


FilesToRename is self-explanatory I guess. The FilesToMacroExpand are scanned and every occurrence of «PROJECTNAME» in them is replaced with the actual project name. There may be other macro's you can put in, but I don't know about them.

3) My "build the library" target build settings are based on a Xcode config file (actually 2 - one for Debug and another for Release) that is in the project directory. We name the config files for the target, so I will need to change the config file name and set the "based on" setting for the target. Do I need AppleScript to do the target setting?


I'm not sure if I completely understand what you want to do, but at first sight you should be able to do this with the above as well.



Thank you Jonas, by editing the project.pbxproject file and adding a TemplateInfo.plist file, I got Xcode to do all the work that I thought I would need to do with AppleScript. It looks like my developers will be installing the project template in their ~/Library trees. Just another shell script to write...


- Rush
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Seeking Suggestions for Template Projects (From: Rush Manbert <email@hidden>)
 >Re: Seeking Suggestions for Template Projects (From: Jonas Maebe <email@hidden>)

  • Prev by Date: Re: Warning with offsetof macro?
  • Next by Date: zero link on of off?
  • Previous by thread: Re: Seeking Suggestions for Template Projects
  • Next by thread: XCode ld and static lib.a files...
  • Index(es):
    • Date
    • Thread