Skip to content

Commit 06e27e2

Browse files
committed
[dist] Implement BootstrapNDKRecipe.should_build
1 parent b6fbd0b commit 06e27e2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pythonforandroid/recipe.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from six import PY2, with_metaclass
55

66
import hashlib
7-
from re import match
7+
from re import match, IGNORECASE
88

99
import sh
1010
import shutil
@@ -642,6 +642,15 @@ class BootstrapNDKRecipe(Recipe):
642642

643643
dir_name = None # The name of the recipe build folder in the jni dir
644644

645+
def should_build(self, arch):
646+
lib_dir = self.get_lib_dir(arch)
647+
if not exists(lib_dir):
648+
return True
649+
for f in listdir(lib_dir):
650+
if match('lib{name}.so'.format(name=self.name), f, IGNORECASE):
651+
return False
652+
return True
653+
645654
def clean_build(self, arch=None):
646655
# we must set python recipe first or `get_recipe_env` will fail
647656
self.ctx.python_recipe = Recipe.get_recipe(
@@ -666,6 +675,9 @@ def get_build_dir(self, arch):
666675
'this is necessary'.format(self.name))
667676
return join(self.get_build_container_dir(arch), self.dir_name)
668677

678+
def get_lib_dir(self, arch):
679+
return join(self.ctx.bootstrap.build_dir, 'obj', 'local', arch.arch)
680+
669681
def get_jni_dir(self):
670682
return join(self.ctx.bootstrap.build_dir, 'jni')
671683

0 commit comments

Comments
 (0)