1414from pythonforandroid .recipe import Recipe
1515
1616
17- def copy_files (src_root , dest_root , override = True ):
17+ def copy_files (src_root , dest_root , override = True , symlink = False ):
1818 for root , dirnames , filenames in walk (src_root ):
1919 for filename in filenames :
2020 subdir = normpath (root .replace (src_root , "" ))
@@ -29,7 +29,10 @@ def copy_files(src_root, dest_root, override=True):
2929 if override and os .path .exists (dest_file ):
3030 os .unlink (dest_file )
3131 if not os .path .exists (dest_file ):
32- shutil .copy (src_file , dest_file )
32+ if symlink :
33+ os .symlink (src_file , dest_file )
34+ else :
35+ shutil .copy (src_file , dest_file )
3336 else :
3437 os .makedirs (dest_file )
3538
@@ -152,16 +155,8 @@ def prepare_build_dir(self):
152155 ]
153156 # now do a cumulative copy of all bootstrap dirs
154157 for bootstrap_dir in bootstrap_dirs :
155- copy_files (join (bootstrap_dir , 'build' ), self .build_dir )
156-
157- if self .ctx .symlink_java_src :
158- # XXX: has also to be generalized as for the copy stuff above
159- info ('Symlinking java src instead of copying' )
160- shprint (sh .rm , '-r' , join (self .build_dir , 'src' ))
161- shprint (sh .mkdir , join (self .build_dir , 'src' ))
162- for dirn in listdir (join (self .bootstrap_dir , 'build' , 'src' )):
163- shprint (sh .ln , '-s' , join (self .bootstrap_dir , 'build' , 'src' , dirn ),
164- join (self .build_dir , 'src' ))
158+ copy_files (join (bootstrap_dir , 'build' ), self .build_dir , symlink = self .ctx .symlink_java_src )
159+
165160 with current_directory (self .build_dir ):
166161 with open ('project.properties' , 'w' ) as fileh :
167162 fileh .write ('target=android-{}' .format (self .ctx .android_api ))
0 commit comments