Skip to content

Commit 975d7bb

Browse files
committed
[dist] Check recipes version when reusing dist
And in case that we detect a mismatch version we will force to delete the old build so it can be rebuild
1 parent a05cc6b commit 975d7bb

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

pythonforandroid/toolchain.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,38 @@ def build_dist_from_args(ctx, dist, args):
214214
ctx.prepare_bootstrap(bs)
215215
if dist.needs_build:
216216
ctx.prepare_dist(ctx.dist_name)
217+
if dist.recipes_to_rebuild:
218+
info(
219+
'Dist will rebuild outdated recipes that depends on {}, '
220+
'preparing build directories for those recipes...'.format(
221+
dist.recipes_to_rebuild)
222+
)
223+
all_to_rebuild = set()
224+
for recipe_name in dist.recipes_to_rebuild:
225+
recipe = Recipe.get_recipe(recipe_name, ctx)
226+
all_to_rebuild.add(recipe_name)
227+
recipe.clean_build()
228+
# if any recipe depends on this one, we also rebuild it
229+
for affected_recipe in dist.recipes.keys():
230+
try:
231+
test_recipe = Recipe.get_recipe(affected_recipe, ctx)
232+
except ValueError:
233+
# we don't have a recipe for this one, so skipping it
234+
continue
235+
if affected_recipe not in all_to_rebuild and (
236+
recipe_name in test_recipe.depends
237+
or recipe_name in test_recipe.opt_depends
238+
):
239+
all_to_rebuild.add(affected_recipe)
240+
test_recipe.clean_build()
241+
242+
more_to_rebuild = set(dist.recipes_to_rebuild) ^ all_to_rebuild
243+
if more_to_rebuild:
244+
info(
245+
'Dist will also rebuild the following recipes: {}'.format(
246+
', '.join(more_to_rebuild)
247+
)
248+
)
217249

218250
build_recipes(build_order, python_modules, ctx,
219251
getattr(args, "private", None),

0 commit comments

Comments
 (0)