9
9
import argparse
10
10
import sys
11
11
from 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
13
13
from os import listdir , unlink , makedirs , environ , chdir , getcwd , walk
14
14
import sh
15
15
import zipfile
@@ -1188,7 +1188,7 @@ def _hostpython_pip(args):
1188
1188
shprint (pip_cmd , * args )
1189
1189
1190
1190
1191
- def update_pbxproj (filename , pbx_frameworks = None ):
1191
+ def update_pbxproj (filename , pbx_frameworks = None , custom_recipes = None , custom_recipes_paths = None ):
1192
1192
# list all the compiled recipes
1193
1193
ctx = Context ()
1194
1194
pbx_libraries = []
@@ -1197,7 +1197,17 @@ def update_pbxproj(filename, pbx_frameworks=None):
1197
1197
frameworks = []
1198
1198
libraries = []
1199
1199
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
+
1200
1207
for recipe in Recipe .list_recipes ():
1208
+ recipes .append (recipe )
1209
+
1210
+ for recipe in recipes :
1201
1211
key = "{}.build_all" .format (recipe )
1202
1212
if key not in ctx .state :
1203
1213
continue
@@ -1458,6 +1468,9 @@ def update(self):
1458
1468
description = "Update an existing xcode project" )
1459
1469
parser .add_argument ("filename" , help = "Path to your project or xcodeproj" )
1460
1470
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
+
1461
1474
args = parser .parse_args (sys .argv [2 :])
1462
1475
1463
1476
filename = self .find_xcodeproj (args .filename )
@@ -1466,7 +1479,13 @@ def update(self):
1466
1479
logger .error ("{} not found" .format (filename ))
1467
1480
sys .exit (1 )
1468
1481
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 )
1470
1489
print ("--" )
1471
1490
print ("Project {} updated" .format (filename ))
1472
1491
0 commit comments