Skip to content

Commit

Permalink
[TISTUD-465] Conditionally recompile, only when the debugger.plist ha…
Browse files Browse the repository at this point in the history
…s changed. Speeds things up a bit when not using the debugger at all.
  • Loading branch information
sptramer committed Jun 21, 2011
1 parent 1a4e09b commit 130f684
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions support/iphone/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# the application on the device via iTunes
#

import os, sys, uuid, subprocess, shutil, signal, string, traceback, imp
import os, sys, uuid, subprocess, shutil, signal, string, traceback, imp, filecmp
import platform, time, re, run, glob, codecs, hashlib, datetime, plistlib
from compiler import Compiler
from projector import Projector
Expand Down Expand Up @@ -700,10 +700,21 @@ def write_debugger_plist(debuggerplist):
else:
plist = plist.replace('__DEBUGGER_HOST__','')
plist = plist.replace('__DEBUGGER_PORT__','')
pf = codecs.open(debuggerplist,'w', encoding='utf-8')

tempfile = debuggerplist+'.tmp'
pf = codecs.open(tempfile,'w',encoding='utf-8')
pf.write(plist)
pf.close()

if os.path.exists(debuggerplist):
changed = not filecmp.cmp(tempfile, debuggerplist, shallow=False)
else:
changed = True

shutil.move(tempfile, debuggerplist)

return changed


# TODO:
# This code is used elsewhere, as well. We should move stuff like this to
Expand Down Expand Up @@ -883,13 +894,9 @@ def write_info_plist(infoplist_tmpl):

# compile debugger file
debug_plist = os.path.join(iphone_dir,'Resources','debugger.plist')
write_debugger_plist(debug_plist)
# With debugger support, we actually have to force a rebuild
# ALWAYS - this is because when you swap from debug back to run,
# the stale debugger.plist is still there.
# Note that this only forces a relink (and recompile of plists) -
# so it's relatively fast.
force_xcode = True

# Force an xcodebuild if the debugger.plist has changed
force_xcode = write_debugger_plist(debug_plist)

if command!='simulator':
# compile plist into binary format so it's faster to load
Expand Down

0 comments on commit 130f684

Please sign in to comment.