Erlang support in Apple's XCode IDE

Bjorn Gustavsson bjorn@REDACTED
Wed Aug 18 09:20:57 CEST 2004


Have you tried the new XCode 1.5 that was released recently?

I have tried it myself, but if you are lucky some bugs might have
been fixed.

/Bjorn

Vance Shipley <vances@REDACTED> writes:

> I had another look at XCode today with a mind to seeing what it
> could offer in my Erlang centric work flow.  After way too much 
> time spent reverse engineering I came to the conclusion that it
> isn't much help now, but it could be ...
> 
> I did however get basic syntax highlighting working and put Erlang
> templates in place for targets and files.  I am giving up for now.
> If anyone else is working on this, or wants to, here is what I found:
> 
> For user specific changes use a base path of:
> 
> $(HOME)/Library/Application Support/Apple/Developer Tools/
> 
> For local system wide changes use a base path of:
> 
> /Library/Application Support/Apple/Developer Tools/
> 
> The system resources are in:
> 
> /System/Library/PrivateFrameworks/DevToolsCore.framework/Versions/A/Resources/
> 
> By copying things from the system files I came up with the following
> files to be added (relative to the base path).  The Specifications 
> directory probably doesn't exist yet so create it.
> 
> Specifications/Erlang File Specification.pbfilespec:
> (
>     //  Erlang Source File Specification
>     {
>         Identifier = sourcecode.erlang;
>         BasedOn = sourcecode;
>         Name = "Erlang source files";
>         Extensions = (erl);
>         ComputerLanguage = erlang;
>         AppliesToBuildRules = yes;
>     }
> )
> 
> 
> Specifications/Erlang Language Specification.pbfilespec:
> (
>     //  Erlang Language Specification
>     {
>         Identifier = erlang;
>         Name = "Erlang";
>         Description = "Erlang";
>         BasedOn = "pbx_root_language";
>         Extensions = ( erl );
>         ComputerLanguage = erlang;
>         AppliesToBuildRules = yes;
>         SupportsIndentation = YES;
>         Indentation = {
>         };
>         SyntaxColoring = {
>             CaseSensitive = YES;
>             UnicodeSymbols = YES;
>             IndexedSymbols = NO;
>             CommentsCanBeNested = YES;
>             String = (
>                 ( "\"", "\"" )
>             );
>             SingleLineComment = (  "%" );
>             DocComment = "%%";
>             DocCommentKeywords = (
>                 "@author",
>                 "@clear",
>                 "@copyright",
>                 "@deprecated",
>                 "@doc",
>                 "@end",
>                 "@equiv",
>                 "@hidden",
>                 "@private",
>                 "@reference",
>                 "@see",
>                 "@since",
>                 "@spec",
>                 "@type",
>                 "@version"
>             );
>             Keywords = (
>                 "after",
>                 "begin",
>                 "case",
>                 "catch",
>                 "end",
>                 "fun",
>                 "if",
>                 "of",
>                 "receive",
>                 "throw",
>                 "when"
>             );
>             PreprocessorKeywordStart = "-";
>             PreprocessorKeywords = (
>                 "behaviour",
>                 "define",
>                 "else",
>                 "endif",
>                 "export",
>                 "ifdef",
>                 "ifndef",
>                 "import",
>                 "include",
>                 "module",
>                 "record"
>             );
>         };
>     }
> )
> 
> 
> Those two additions get XCode to recognize that these are source
> files and will get rudimentary support as such.  An editor is slected
> and syntax highlighting is in effect.  The definition above for the
> syntax higlighting was my first pass and is unquestionably incomplete/wrong.
> 
> To include an Erlang category in the menu for creating files you add the
> directory:
> 
> File Templates/Erlang
> 
> In that directory you can create entries for different file types.
> Name the directories with a .pbfiletemplate suffix:
> 
> File Templates/Erlang/Erlang File.pbfiletemplate/
> File Templates/Erlang/Behaviour/application.pbfiletemplate/
> File Templates/Erlang/Behaviour/supervisor.pbfiletemplate/
> File Templates/Erlang/Behaviour/gen_server.pbfiletemplate/
> File Templates/Erlang/Behaviour/gen_fsm.pbfiletemplate/
> File Templates/Erlang/Behaviour/gen_event.pbfiletemplate/
> ...
> 
> In those directories you put your template .erl files.  You should 
> have a TemplateInfo.plist as well:
> 
> File Templates/Erlang/Behaviour/gen_fsm.pbfiletemplate/fsm.erl
> File Templates/Erlang/Behaviour/gen_fsm.pbfiletemplate/TemplateInfo.plist
> 
> TemplateInfo.plist:
> {
>    MainTemplateFile = "fsm.erl";
>    Description = "An Erlang gen_fsm behaviour module source file.";
> }
> 
> 
> To include an Erlang category in the menu for creating targets add:
> 
> Target Templates/Erlang/
> 
> Target Templates/Erlang/Beam.trgttmpl:
> {
>     Class = Native;
>     ProductType = "erlang.beam";
>     Description = "Target for building an Erlang beam file.";
>     CustomBuildSettings = {
>         INSTALL_PATH = "$(HOME)/ebin";
>         PRODUCT_NAME = "«PROJECTNAME»";
>     };
>         BuildPhases = (
>             {
>                 Class = Sources;
>             }
>         );
> }
> 
> 
> I think we need these files as well:
> 
> Specifications/Erlang Package Types Specification.pbpackspec
> Specifications/Erlang Product Types Specification.pbprodspec
> 
> I gave up after quite some time trying to get the syntax right with 
> these.  It looks like with the right incantations in these files you
> could have a good deal of the supported features.
> 
> For what it's worth I get an "Internal Error":
> File: /SourceCache/DevToolsBase/DevToolsBase-387/pbxcore/Target.subproj/PBXBuildSettingExpansion.m
> Line:	237
> Function:	PBXFindFirstMacroReferenceInRangeOfCFString
> 
> Assertion failed: macroNameRange.length >= 1
> 
> 	-Vance
> 
> Vance Shipley
> Motivity Telecom Inc.
> +1 519 240 3684
> vances@REDACTED
> 

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list