vndk-def: Reuse cached vndk classification.
This commit replaces is_ndk with _vndk_classification so that we can
know the whether a library is in LL-NDK, SP-NDK, or HL-NDK without
repeating path matching.
Test: Run vndk_definition_tool.py on master tree.
Change-Id: Ia6894b6325f58bef74e3525f3b212a2c2776d982
diff --git a/vndk/tools/definition-tool/vndk_definition_tool.py b/vndk/tools/definition-tool/vndk_definition_tool.py
index ccb6408..bc85863 100755
--- a/vndk/tools/definition-tool/vndk_definition_tool.py
+++ b/vndk/tools/definition-tool/vndk_definition_tool.py
@@ -659,10 +659,26 @@
self._deps = (set(), set())
self._users = (set(), set())
self.imported_ext_symbols = collections.defaultdict(set)
- self.is_ndk = NDK_LIBS.is_ndk(path)
+ self._ndk_classification = NDK_LIBS.classify(path)
self.unresolved_symbols = set()
self.linked_symbols = dict()
+ @property
+ def is_ndk(self):
+ return self._ndk_classification != NDKLibDict.NOT_NDK
+
+ @property
+ def is_ll_ndk(self):
+ return self._ndk_classification == NDKLibDict.LL_NDK
+
+ @property
+ def is_sp_ndk(self):
+ return self._ndk_classification == NDKLibDict.SP_NDK
+
+ @property
+ def is_hl_ndk(self):
+ return self._ndk_classification == NDKLibDict.HL_NDK
+
def add_dep(self, dst, ty):
self._deps[ty].add(dst)
dst._users[ty].add(self)
@@ -1424,7 +1440,7 @@
# considered as banned libraries at the moment.
def is_banned(lib):
if lib.is_ndk:
- return NDK_LIBS.is_hl_ndk(lib.path)
+ return lib.is_hl_ndk
return (banned_libs.is_banned(lib.path) or
not lib.is_system_lib() or
not lib.path.endswith('.so'))
@@ -1703,7 +1719,7 @@
for lib_set in lib_sets:
for lib in lib_set:
for dep in lib.deps:
- if NDK_LIBS.is_hl_ndk(dep.path):
+ if dep.is_hl_ndk:
print('warning: {}: VNDK is using high-level NDK {}.'
.format(lib.path, dep.path), file=sys.stderr)