Skip to content

Commit

Permalink
Made recipe graph resolution respect opt_depends
Browse files Browse the repository at this point in the history
  • Loading branch information
inclement committed Jan 27, 2019
1 parent a31f9f1 commit d30caa4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pythonforandroid/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def conflicts(self, name):
return False


def recursively_collect_orders(name, ctx, orders=[]):
def recursively_collect_orders(name, ctx, all_inputs, orders=[]):
'''For each possible recipe ordering, try to add the new recipe name
to that order. Recursively do the same thing with all the
dependencies of each recipe.
Expand All @@ -40,6 +40,11 @@ def recursively_collect_orders(name, ctx, orders=[]):
dependencies = [([dependency] if not isinstance(
dependency, (list, tuple))
else dependency) for dependency in recipe.depends]

# handle opt_depends: these impose requirements on the build
# order only if already present in the list of recipes to build
dependencies.extend([[d] for d in recipe.get_opt_depends_in_list(all_inputs)])

if recipe.conflicts is None:
conflicts = []
else:
Expand Down Expand Up @@ -68,7 +73,7 @@ def recursively_collect_orders(name, ctx, orders=[]):
dependency_new_orders = [new_order]
for dependency in dependency_set:
dependency_new_orders = recursively_collect_orders(
dependency, ctx, dependency_new_orders)
dependency, ctx, all_inputs, dependency_new_orders)

new_orders.extend(dependency_new_orders)

Expand Down Expand Up @@ -109,7 +114,7 @@ def get_recipe_order_and_bootstrap(ctx, names, bs=None):
new_possible_orders = [RecipeOrder(ctx)]
for name in name_set:
new_possible_orders = recursively_collect_orders(
name, ctx, orders=new_possible_orders)
name, ctx, name_set, orders=new_possible_orders)
possible_orders.extend(new_possible_orders)

# turn each order graph into a linear list if possible
Expand Down
6 changes: 6 additions & 0 deletions pythonforandroid/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ def check_recipe_choices(self):
recipes.append(recipe)
return sorted(recipes)

def get_opt_depends_in_list(self, recipes):
'''Given a list of recipe names, returns those that are also in
self.opt_depends.
'''
return [recipe for recipe in recipes if recipe in self.opt_depends]

def get_build_container_dir(self, arch):
'''Given the arch name, returns the directory where it will be
built.
Expand Down

0 comments on commit d30caa4

Please sign in to comment.