Skip to content

Commit

Permalink
modify compiler to leave js files as-is for test deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Stepanov committed Aug 23, 2012
1 parent e7133f4 commit b96d1f8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions support/iphone/compiler.py
Expand Up @@ -376,7 +376,7 @@ def compileProject(self,xcode=False,devicefamily='ios',iphone_version='iphoneos'
if self.deploytype!='development' or has_modules:

if os.path.exists(app_dir) and self.deploytype != 'development':
self.copy_resources([resources_dir],app_dir,True,module_js)
self.copy_resources([resources_dir],app_dir,self.deploytype != 'test',module_js)

if self.deploytype == 'production':
debugger_plist = os.path.join(app_dir,'debugger.plist')
Expand Down Expand Up @@ -579,7 +579,7 @@ def compile_js_file(self, path, from_, js_files):
js_files.append(path);

def copy_resources(self,sources,target,write_routing=True,module_js=[]):

js_files = []
if write_routing:
intf = open(os.path.join(self.classes_dir,'ApplicationRouting.h'),'w+')
impf = open(os.path.join(self.classes_dir,'ApplicationRouting.m'),'w+')
Expand All @@ -590,7 +590,6 @@ def copy_resources(self,sources,target,write_routing=True,module_js=[]):
impf.write(HEADER)
impf.write(IMPL_HEADER)
impf.write("+ (NSData*) resolveAppAsset:(NSString*)path;\n{\n")
js_files = []

if not os.path.exists(os.path.expanduser(target)):
os.makedirs(os.path.expanduser(target))
Expand Down Expand Up @@ -638,15 +637,15 @@ def add_compiled_resources(source,target):
fp = os.path.splitext(file)
ext = fp[1]
if ext == '.jss': continue
if len(fp)>1 and write_routing and ext in ['.html','.js','.css']:
if len(fp)>1 and ext in ['.html','.js','.css']:
path = prefix + os.sep + file
path = path[1:]
entry = {'path':path,'from':from_,'to':to_}
if compiled_targets.has_key(ext):
compiled_targets[ext].append(entry)
else:
compiled_targets[ext]=[entry]
else:
if not write_routing:

This comment has been minimized.

Copy link
@farfromrefug

farfromrefug Sep 26, 2012

Contributor

This broke adhoc( and distribution i think) packaging.
When doing adhoc command, write_routing is true (as command != 'test') and so all external resources (not html, js or css, or in iphone dir) are not copied to the app folder.

# only copy if different filesize or doesn't exist
if not os.path.exists(to_) or os.path.getsize(from_)!=os.path.getsize(to_):
print "[DEBUG] copying: %s to %s" % (from_,to_)
Expand Down Expand Up @@ -700,10 +699,10 @@ def add_compiled_resources(source,target):
for source in sources:
add_compiled_resources(source,target)

if write_routing:
for js_file in module_js:
compile_js_file(js_file['path'], js_file['from'])
for js_file in module_js:
compile_js_file(js_file['path'], js_file['from'])

if write_routing:
compile_js_files();
impf.write("\tNSNumber *index = [map objectForKey:path];\n")
impf.write("\tif (index == nil) { return nil; }\n")
Expand Down

0 comments on commit b96d1f8

Please sign in to comment.