Re: random crashes when updating xcode source files using applescript
Re: random crashes when updating xcode source files using applescript
- Subject: Re: random crashes when updating xcode source files using applescript
- From: Tobias Ford <email@hidden>
- Date: Thu, 3 May 2007 03:44:22 -0500
So just as a followup, I've decided to abandon the deleting the
source groups approach and now I'm just deleting the project and
building it based off of a predefined template.
So far, it's a decent solution.
On May 2, 2007, at 2:27 AM, Tobias Ford wrote:
So after some more experimenting it looks like my AppleScript
method that deletes the existing groups might be causing some
internal corruption in xCode.
The general idea of the script is to delete the group hierarchy and
the xCode group's file references associated with a directory
layout on disk. The script then rebuilds the hierarchy and adds
the files to the xcode project. Eventually, it also needs to track
through referenced sub-projects updating them. This is an attempt
at rebuilding all of the build targets without having to update
them by hand since this is a large project. Doing so by hand takes
about an hour.
This is the general flow of the script:
delete a specified group - "shared"
delete a specified group - "macosx"
delete a specified group - "opengl20" if exists on disk for the
library
re-add the files of a specified group - "shared"
re-add the files of a specified group - "macosx"
re-add the files of a specified group - "opengl20" if exists on
disk for the library
This is the actual AppleScript method that Appears to causing the
corruption. It's method that deletes the groups and their members
for the re-add
on deleteXCodeGroups(groupNameToMatch)
set timesToCallDelete to 0
tell application "Xcode"
activate
try
set theRootGroup to root group of front project
repeat with theGroup in groups of theRootGroup
if (name of theGroup is groupNameToMatch) then
set timesToCallDelete to timesToCallDelete + 1
end if
end repeat
repeat timesToCallDelete times
delete group groupNameToMatch of theRootGroup
--delete group groupNameToMatch of root group of front project
end repeat
end try
end tell
end deleteXCodeGroups
I've attempted adding various delays to give xcode time to think
and have even closed and reopened the project in an attempt to let
it save out and flush it's state to disk before starting again. No
luck. But it does appear to be related primarily to deleting the
groups. The weird thing is that even when I delete these groups
and then close the project and reopen there is the potential for a
crash. If I manually delete the groups and then run my script
there never seems to be a crash. Additionally the script that I
have works great with ~40 source files but begins failing when you
start throwing ~180 or more when deleting the groups.
Can anyone share with me what I might be doing wrong or any work
around that I should know about when doing this?
Thanks in advance.
On May 1, 2007, at 5:04 PM, Tobias Ford wrote:
This is part of a script that traverses a defined disk heirarchy
and adds the files to the project. It's working great about 40%
of the time. All of the other times, it's crashing randomly.
This is my first applescript so I'm probably doing all kinds of
wrong. My guess is that I'm sending so many make new file
references and add to target messages, that xCode is being
overwhelmed. Can anyone help with suggestions or workarounds?
Thanks.
on addSourceFiles(theFilePathToLibrary, thePlatformGroupName)
set theFilePathToDirectory to theFilePathToLibrary & "/src/" &
thePlatformGroupName
set theGroupList to ListFolderContents(theFilePathToDirectory, "")
if (length of theGroupList > 0) then
--create the platform specific group name
tell application "Xcode"
activate
tell root group of front project
set theSourceGroup to make new group with properties {path
type:"project relative", name:thePlatformGroupName}
end tell
end tell
repeat with theGroupName in theGroupList
set theGroupPathToDirectory to theFilePathToDirectory & "/" &
theGroupName
set theSourceFileList to ListFolderContents
(theGroupPathToDirectory, "*.cpp *.h")
-- add the directory based sub group
tell application "Xcode"
activate
tell theSourceGroup
try
set theChildGroup to make new group with properties {path
type:"project relative", name:theGroupName}
repeat with theSourceFileName in theSourceFileList
set theSourceFilePath to theGroupPathToDirectory & "/" &
theSourceFileName
tell theChildGroup
try
set sourceFile to make new file reference with properties
{path type:"project relative", full path:theSourceFilePath,
name:theSourceFileName}
add sourceFile to first target of front project
end try
end tell
end repeat
end try
end tell
end tell
end repeat
end if
end addSourceFiles
-------------------
Tobias Ford...
tobias1482 'at' mac.com
tford 'at' spacetimestudios.com
-------------------
Sr Programmer @ space time studios for a generic space game mmo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
-------------------
Tobias Ford...
tobias1482 'at' mac.com
tford 'at' spacetimestudios.com
-------------------
Sr Programmer @ space time studios for a generic space game mmo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40alienskin.com
This email sent to email@hidden
-------------------
Tobias Ford...
tobias1482 'at' mac.com
tford 'at' spacetimestudios.com
-------------------
Sr Programmer @ space time studios for a generic space game mmo
_______________________________________________
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