wxWidgets/build/osx/makeprojects.applescript

1 line
8.8 KiB
AppleScript
Raw Normal View History

global oldDelimiters global variables global variablesRef global bakefilesXML global bakefilesXMLRef global projectFile global osxBuildFolder property test : false -- retrieves the files from the xml node including optional conditions on parseSources(theName, theElement, theVariables, theConditions) set AppleScript's text item delimiters to " " set allElements to {} repeat with currElement in XML contents of theElement if class of currElement is text then set allElements to allElements & (every text item of currElement) else if class of currElement is XML element and XML tag of currElement is "if" then if (cond of XML attributes of currElement is in theConditions) then set allElements to allElements & (every text item of (item 1 of XML contents of currElement)) end if end if end if end repeat set AppleScript's text item delimiters to oldDelimiters copy {varname:theName, entries:allElements} to end of theVariables end parseSources on parseEntry(theElement, theVariables, theConditions) set theName to var of XML attributes of theElement parseSources(theName, theElement, theVariables, theConditions) end parseEntry on parseLib(theElement, theVariables, theConditions) set theName to |id| of XML attributes of theElement repeat with currElement in XML contents of theElement if class of currElement is XML element and XML tag of currElement is "sources" then parseSources(theName, currElement, theVariables, theConditions) end if end repeat end parseLib on parseNode(anElement, theVariables, theConditions) 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 ¬ XML tag of anElement is "lib" then parseLib(anElement, theVariables, theConditions) end if end if end parseNode -- iterates through the entire xml tree and populates the variables on parseFiles(theXML, theVariables, theConditions) if class of theXML is XML element or class of theXML is XML document then repeat with anElement in XML contents of theXML try parseNode(anElement, theVariables, theConditions) on error number -1728 -- ignore this error end try end repeat else if class of theXML is list then repeat with anElement in theXML try parseNode(anElement, theVariables, theConditions) on error number -1728 -- ignore this error end try end repeat end if end parseFiles -- gets the entries of the variable named theName on getVar(theName) repeat with anElement in variablesRef if (varname of anElement is theName) then return entries of anElement end if end repeat end getVar -- adds sources from fileList to a group named container on addNode(theContainer, fileList) tell application "Xcode" tell project 1 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)) 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 AppleScript's text item delimiters to oldDelimiters try set theGroup to group theContainer on error tell root group make new group with properties {name:theContainer} 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 c