diff --git a/build/osx/makeprojects.applescript b/build/osx/makeprojects.applescript index 79b373ff6e..2a90dea455 100644 --- a/build/osx/makeprojects.applescript +++ b/build/osx/makeprojects.applescript @@ -1,3 +1,9 @@ +-- script for regenerating Xcode projects from templates and bakefile file lists +-- needs an Xcode version 3 application, no later versions have the AppleScript commands needed +-- implemented properly +-- in order to avoid your Xcode version 3 getting updated with later versions +-- put it into a folder which you hide from spotlight + global oldDelimiters global variables global variablesRef @@ -43,11 +49,11 @@ on parseLib(theElement, theVariables, theConditions) end parseLib on parseNode(anElement, theVariables, theConditions) - if class of anElement is XML element and ᅡ + if class of anElement is XML element and ¬ XML tag of anElement is "set" then parseEntry(anElement, theVariables, theConditions) else - if class of anElement is XML element and ᅡ + if class of anElement is XML element and ¬ XML tag of anElement is "lib" then parseLib(anElement, theVariables, theConditions) end if @@ -85,22 +91,22 @@ on getVar(theName) end getVar -- adds sources from fileList to a group named container -on addNode(theContainer, fileList) - tell application "Xcode" +on addNode(theContainer, fileList, theTargets) + tell application "Xcode3" tell project 1 - set theTargets to targets + -- set theTargets to targets repeat with listItem in fileList if (listItem starts with "$(") then set AppleScript's text item delimiters to "" set variableName to (characters 3 through ((length of listItem) - 1) of listItem) as text set AppleScript's text item delimiters to oldDelimiters - my addNode(theContainer, my getVar(variableName)) + my addNode(theContainer, my getVar(variableName), theTargets) else set AppleScript's text item delimiters to "/" set currPath to every text item in listItem set currFile to "../../" & listItem set currFileName to (item -1 in currPath) - set currGroup to (items 1 through -2 in currPath as text) + -- set currGroup to (items 1 through -2 in currPath as text) set AppleScript's text item delimiters to oldDelimiters try set theGroup to group theContainer @@ -110,17 +116,13 @@ on addNode(theContainer, fileList) end tell end try tell group theContainer - try - set theGroup to group named currGroup - on error - make new group with properties {name:currGroup} - end try - tell group currGroup - set newFile to make new file reference with properties {name:currFileName, path:currFile, path type:project relative} - repeat with theTarget in theTargets - add newFile to (get compile sources phase of theTarget) - end repeat - end tell + set newFile to make new file reference with properties {name:currFileName, path:currFile, path type:project relative} + repeat with theTarget in theTargets + -- silently ignore targets that don't exist in this project + try + add newFile to (get compile sources phase of target theTarget of project 1) + end try + end repeat end tell end if end repeat @@ -137,7 +139,7 @@ on readFile(posixFilePath) end readFile on init() - tell application "Xcode" + tell application "Xcode3" quit end tell set variablesRef to a reference to variables @@ -185,23 +187,23 @@ end instantiateProject -- adds the source files of the nodes of theProject to the xcode project on populateProject(theProject) - tell application "Xcode" + tell application "Xcode3" open projectFile end tell repeat with theNode in nodes of theProject -- reopen xcode for each pass, as otherwise the undomanager -- happens to crash quite frequently - addNode(label of theNode, entries of theNode) + addNode(label of theNode, entries of theNode, targets of theNode) end repeat - tell application "Xcode" + tell application "Xcode3" quit end tell do shell script (osxBuildFolder as text) & "fix_xcode_ids.py \"" & (POSIX path of projectFile as Unicode text) & "\"" -- reopen again to let Xcode sort identifiers - tell application "Xcode" + tell application "Xcode3" open projectFile end tell - tell application "Xcode" + tell application "Xcode3" quit end tell end populateProject @@ -215,31 +217,32 @@ end makeProject -- main init() -set theProject to {projectName:"", conditions:{}, bklfiles:{ᅡ - "../bakefiles/files.bkl", "../bakefiles/zlib.bkl", "../bakefiles/regex.bkl", "../bakefiles/tiff.bkl", "../bakefiles/png.bkl", "../bakefiles/jpeg.bkl", "../bakefiles/scintilla.bkl", "../bakefiles/expat.bkl"}, nodes:{ᅡ - {label:"base", entries:{"$(BASE_SRC)"}}, ᅡ - {label:"base", entries:{"$(BASE_AND_GUI_SRC)"}}, ᅡ - {label:"core", entries:{"$(CORE_SRC)"}}, ᅡ - {label:"net", entries:{"$(NET_SRC)"}}, ᅡ - {label:"adv", entries:{"$(ADVANCED_SRC)"}}, ᅡ - {label:"webview", entries:{"$(WEBVIEW_SRC)"}}, ᅡ - {label:"media", entries:{"$(MEDIA_SRC)"}}, ᅡ - {label:"html", entries:{"$(HTML_SRC)"}}, ᅡ - {label:"xrc", entries:{"$(XRC_SRC)"}}, ᅡ - {label:"xml", entries:{"$(XML_SRC)"}}, ᅡ - {label:"opengl", entries:{"$(OPENGL_SRC)"}}, ᅡ - {label:"aui", entries:{"$(AUI_SRC)"}}, ᅡ - {label:"ribbon", entries:{"$(RIBBON_SRC)"}}, ᅡ - {label:"propgrid", entries:{"$(PROPGRID_SRC)"}}, ᅡ - {label:"richtext", entries:{"$(RICHTEXT_SRC)"}}, ᅡ - {label:"stc", entries:{"$(STC_SRC)"}}, ᅡ - {label:"libzlib", entries:{"$(wxzlib)"}}, ᅡ - {label:"libtiff", entries:{"$(wxtiff)"}}, ᅡ - {label:"libjpeg", entries:{"$(wxjpeg)"}}, ᅡ - {label:"libpng", entries:{"$(wxpng)"}}, ᅡ - {label:"libregex", entries:{"$(wxregex)"}}, ᅡ - {label:"libscintilla", entries:{"$(wxscintilla)"}}, ᅡ - {label:"libexpat", entries:{"$(wxexpat)"}} ᅡ +set theProject to {projectName:"", conditions:{}, bklfiles:{¬ + "../bakefiles/files.bkl", "../bakefiles/zlib.bkl", "../bakefiles/regex.bkl", "../bakefiles/tiff.bkl", "../bakefiles/png.bkl", "../bakefiles/jpeg.bkl", "../bakefiles/scintilla.bkl", "../bakefiles/expat.bkl"}, nodes:{¬ + {label:"base", entries:{"$(BASE_SRC)"}, targets:{"dynamic", "static", "base"}}, ¬ + {label:"base", entries:{"$(BASE_AND_GUI_SRC)"}, targets:{"dynamic", "static", "base", "core"}}, ¬ + {label:"core", entries:{"$(CORE_SRC)"}, targets:{"dynamic", "static", "core"}}, ¬ + {label:"net", entries:{"$(NET_SRC)"}, targets:{"dynamic", "static", "net"}}, ¬ + {label:"adv", entries:{"$(ADVANCED_SRC)"}, targets:{"dynamic", "static", "adv"}}, ¬ + {label:"webview", entries:{"$(WEBVIEW_SRC)"}, targets:{"dynamic", "static", "webview"}}, ¬ + {label:"media", entries:{"$(MEDIA_SRC)"}, targets:{"dynamic", "static", "media"}}, ¬ + {label:"html", entries:{"$(HTML_SRC)"}, targets:{"dynamic", "static", "html"}}, ¬ + {label:"xrc", entries:{"$(XRC_SRC)"}, targets:{"dynamic", "static", "xrc"}}, ¬ + {label:"qa", entries:{"$(QA_SRC)"}, targets:{"dynamic", "static", "qa"}}, ¬ + {label:"xml", entries:{"$(XML_SRC)"}, targets:{"dynamic", "static", "xml"}}, ¬ + {label:"opengl", entries:{"$(OPENGL_SRC)"}, targets:{"dynamic", "static", "gl"}}, ¬ + {label:"aui", entries:{"$(AUI_SRC)"}, targets:{"dynamic", "static", "aui"}}, ¬ + {label:"ribbon", entries:{"$(RIBBON_SRC)"}, targets:{"dynamic", "static", "ribbon"}}, ¬ + {label:"propgrid", entries:{"$(PROPGRID_SRC)"}, targets:{"dynamic", "static", "propgrid"}}, ¬ + {label:"richtext", entries:{"$(RICHTEXT_SRC)"}, targets:{"dynamic", "static", "richttext"}}, ¬ + {label:"stc", entries:{"$(STC_SRC)"}, targets:{"dynamic", "static", "stc"}}, ¬ + {label:"libzlib", entries:{"$(wxzlib)"}, targets:{"dynamic", "static", "wxzlib"}}, ¬ + {label:"libtiff", entries:{"$(wxtiff)"}, targets:{"dynamic", "static", "wxtiff"}}, ¬ + {label:"libjpeg", entries:{"$(wxjpeg)"}, targets:{"dynamic", "static", "wxjpeg"}}, ¬ + {label:"libpng", entries:{"$(wxpng)"}, targets:{"dynamic", "static", "wxpng"}}, ¬ + {label:"libregex", entries:{"$(wxregex)"}, targets:{"dynamic", "static", "wxregex"}}, ¬ + {label:"libscintilla", entries:{"$(wxscintilla)"}, targets:{"dynamic", "static", "wxscintilla"}}, ¬ + {label:"libexpat", entries:{"$(wxexpat)"}, targets:{"dynamic", "static", "wxexpat"}} ¬ }} set conditions of theProject to {"PLATFORM_MACOSX=='1'", "TOOLKIT=='OSX_CARBON'", "WXUNIV=='0'", "USE_GUI=='1' and WXUNIV=='0'"} set projectName of theProject to "wxcarbon" @@ -249,6 +252,7 @@ set conditions of theProject to {"PLATFORM_MACOSX=='1'", "TOOLKIT=='OSX_COCOA'", set projectName of theProject to "wxcocoa" makeProject(theProject) + set conditions of theProject to {"PLATFORM_MACOSX=='1'", "TOOLKIT=='OSX_IPHONE'", "WXUNIV=='0'", "USE_GUI=='1' and WXUNIV=='0'"} set projectName of theProject to "wxiphone" makeProject(theProject)