Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made recipe graph resolution respect opt_depends #1617

Merged
merged 1 commit into from
Jan 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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