Skip to content

Commit

Permalink
Adds --add-custom-recipe to the update command
Browse files Browse the repository at this point in the history
Custom recipes were built but not added to the XCode project.
See: #642
  • Loading branch information
meow464 committed Sep 25, 2021
1 parent 651461b commit dbdf45f
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions kivy_ios/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import argparse
import sys
from sys import stdout
from os.path import join, dirname, realpath, exists, isdir, basename
from os.path import join, dirname, realpath, exists, isdir, basename, split
from os import listdir, unlink, makedirs, environ, chdir, getcwd, walk
import sh
import zipfile
Expand Down Expand Up @@ -1188,7 +1188,7 @@ def _hostpython_pip(args):
shprint(pip_cmd, *args)


def update_pbxproj(filename, pbx_frameworks=None):
def update_pbxproj(filename, pbx_frameworks=None, custom_recipes=None, custom_recipes_paths=None):
# list all the compiled recipes
ctx = Context()
pbx_libraries = []
Expand All @@ -1197,7 +1197,17 @@ def update_pbxproj(filename, pbx_frameworks=None):
frameworks = []
libraries = []
sources = []

if custom_recipes and custom_recipes_paths:
recipes = custom_recipes
ctx.custom_recipes_paths = custom_recipes_paths
else:
recipes = []

for recipe in Recipe.list_recipes():
recipes.append(recipe)

for recipe in recipes:
key = "{}.build_all".format(recipe)
if key not in ctx.state:
continue
Expand Down Expand Up @@ -1458,6 +1468,9 @@ def update(self):
description="Update an existing xcode project")
parser.add_argument("filename", help="Path to your project or xcodeproj")
parser.add_argument("--add-framework", action="append", help="Additional Frameworks to include with this project")
parser.add_argument("--add-custom-recipe", action="append", default=[],
help="Path to custom recipe (the recipe must already have been built with the 'build' command)")

args = parser.parse_args(sys.argv[2:])

filename = self.find_xcodeproj(args.filename)
Expand All @@ -1466,7 +1479,13 @@ def update(self):
logger.error("{} not found".format(filename))
sys.exit(1)

update_pbxproj(filename, pbx_frameworks=args.add_framework)
recipes = []
for p in args.add_custom_recipe:
_, name = split(p)
recipes.append(name)

update_pbxproj(filename, pbx_frameworks=args.add_framework,
custom_recipes=recipes, custom_recipes_paths=args.add_custom_recipe)
print("--")
print("Project {} updated".format(filename))

Expand Down

0 comments on commit dbdf45f

Please sign in to comment.