99import argparse
1010import sys
1111from sys import stdout
12- from os .path import join , dirname , realpath , exists , isdir , basename
12+ from os .path import join , dirname , realpath , exists , isdir , basename , split
1313from os import listdir , unlink , makedirs , environ , chdir , getcwd , walk
1414import sh
1515import zipfile
@@ -1188,7 +1188,7 @@ def _hostpython_pip(args):
11881188 shprint (pip_cmd , * args )
11891189
11901190
1191- def update_pbxproj (filename , pbx_frameworks = None ):
1191+ def update_pbxproj (filename , pbx_frameworks = None , custom_recipes = None , custom_recipes_paths = None ):
11921192 # list all the compiled recipes
11931193 ctx = Context ()
11941194 pbx_libraries = []
@@ -1197,7 +1197,17 @@ def update_pbxproj(filename, pbx_frameworks=None):
11971197 frameworks = []
11981198 libraries = []
11991199 sources = []
1200+
1201+ if custom_recipes and custom_recipes_paths :
1202+ recipes = custom_recipes
1203+ ctx .custom_recipes_paths = custom_recipes_paths
1204+ else :
1205+ recipes = []
1206+
12001207 for recipe in Recipe .list_recipes ():
1208+ recipes .append (recipe )
1209+
1210+ for recipe in recipes :
12011211 key = "{}.build_all" .format (recipe )
12021212 if key not in ctx .state :
12031213 continue
@@ -1458,6 +1468,9 @@ def update(self):
14581468 description = "Update an existing xcode project" )
14591469 parser .add_argument ("filename" , help = "Path to your project or xcodeproj" )
14601470 parser .add_argument ("--add-framework" , action = "append" , help = "Additional Frameworks to include with this project" )
1471+ parser .add_argument ("--add-custom-recipe" , action = "append" , default = [],
1472+ help = "Path to custom recipe (the recipe must already have been built with the 'build' command)" )
1473+
14611474 args = parser .parse_args (sys .argv [2 :])
14621475
14631476 filename = self .find_xcodeproj (args .filename )
@@ -1466,7 +1479,13 @@ def update(self):
14661479 logger .error ("{} not found" .format (filename ))
14671480 sys .exit (1 )
14681481
1469- update_pbxproj (filename , pbx_frameworks = args .add_framework )
1482+ recipes = []
1483+ for p in args .add_custom_recipe :
1484+ _ , name = split (p )
1485+ recipes .append (name )
1486+
1487+ update_pbxproj (filename , pbx_frameworks = args .add_framework ,
1488+ custom_recipes = recipes , custom_recipes_paths = args .add_custom_recipe )
14701489 print ("--" )
14711490 print ("Project {} updated" .format (filename ))
14721491
0 commit comments