Skip to content

Commit b7a2520

Browse files
committed
[dist] Implement BootstrapNDKRecipe.should_build
1 parent 2b5960e commit b7a2520

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
@@ -758,6 +758,15 @@ class BootstrapNDKRecipe(Recipe):
758758

759759
dir_name = None # The name of the recipe build folder in the jni dir
760760

761+
def should_build(self, arch):
762+
lib_dir = self.get_lib_dir(arch)
763+
if not exists(lib_dir):
764+
return True
765+
for f in listdir(lib_dir):
766+
if match('lib{name}.so'.format(name=self.name), f, IGNORECASE):
767+
return False
768+
return True
769+
761770
def clean_build(self, arch=None):
762771
# we must set python recipe first or `get_recipe_env` will fail
763772
self.ctx.python_recipe = Recipe.get_recipe(
@@ -782,6 +791,9 @@ def get_build_dir(self, arch):
782791
'this is necessary'.format(self.name))
783792
return join(self.get_build_container_dir(arch), self.dir_name)
784793

794+
def get_lib_dir(self, arch):
795+
return join(self.ctx.bootstrap.build_dir, 'obj', 'local', arch.arch)
796+
785797
def get_jni_dir(self):
786798
return join(self.ctx.bootstrap.build_dir, 'jni')
787799

0 commit comments

Comments
 (0)