Skip to content

Commit eb23232

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 7a6fd45 commit eb23232

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

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

0 commit comments

Comments
 (0)