mirror of
https://gitee.com/openharmony/developtools_integration_verification
synced 2024-11-23 08:10:12 +00:00
commit
e348bd4e07
@ -51,6 +51,8 @@ class CompileInfoLoader(object):
|
||||
info["moduleName"] = item["label_name"]
|
||||
else:
|
||||
info["moduleName"] = ""
|
||||
if "version_script" in item:
|
||||
info["version_script"] = item["version_script"]
|
||||
info["third_party"] = False
|
||||
info["chipset"] = False
|
||||
info["napi"] = False
|
||||
@ -80,7 +82,8 @@ class CompileInfoLoader(object):
|
||||
"napi": False,
|
||||
"innerapi": False,
|
||||
"sa_id": 0,
|
||||
"labelPath": ""
|
||||
"labelPath": "",
|
||||
"version_script": ""
|
||||
}
|
||||
|
||||
if info:
|
||||
@ -89,7 +92,8 @@ class CompileInfoLoader(object):
|
||||
if not elf:
|
||||
continue
|
||||
for k in defaultInfo.keys():
|
||||
elf[k] = item[k]
|
||||
if k in item:
|
||||
elf[k] = item[k]
|
||||
|
||||
unknown_items = []
|
||||
for elf in mgr.get_all():
|
||||
@ -106,7 +110,8 @@ class CompileInfoLoader(object):
|
||||
unknown = defaultInfo.copy()
|
||||
unknown["name"] = elf["path"]
|
||||
for k in defaultInfo.keys():
|
||||
defaultInfo[k] = elf[k]
|
||||
if k in elf:
|
||||
defaultInfo[k] = elf[k]
|
||||
unknown_items.append(unknown)
|
||||
|
||||
if elf["path"].startswith("system/lib64/module/") or elf["path"].startswith("system/lib/module/"):
|
||||
|
@ -13,15 +13,8 @@
|
||||
"distributeddataobject_impl",
|
||||
"medialibrary",
|
||||
"image",
|
||||
"media_avplayer",
|
||||
"featureability",
|
||||
|
||||
"rpc",
|
||||
"uri",
|
||||
"url",
|
||||
"xml",
|
||||
"convertxml",
|
||||
"buffer",
|
||||
"medical",
|
||||
"devicestatus",
|
||||
"geolocation"
|
||||
"devicestatus"
|
||||
]
|
||||
|
@ -1 +1,15 @@
|
||||
[]
|
||||
[
|
||||
"liblbsservice_locator.z.so",
|
||||
"libnetsys_native_manager.z.so",
|
||||
"libresschedsvc.z.so",
|
||||
"libedmservice.z.so",
|
||||
"libabilityms.z.so",
|
||||
"libavsession_service.z.so",
|
||||
"libtime_service.z.so",
|
||||
"libgeofence_service.z.so",
|
||||
"libtimeline_service.z.so",
|
||||
"libusagestatservice.z.so",
|
||||
"libcomponent_sched_server.z.so",
|
||||
"libsg_collect_service.z.so",
|
||||
"libabnormal_efficiency_mgr_service.z.so"
|
||||
]
|
@ -2,12 +2,22 @@
|
||||
#coding=utf-8
|
||||
|
||||
from .napi_rule import NapiRule
|
||||
from .sa_rule import SaRule
|
||||
|
||||
def check_all_rules(mgr, args):
|
||||
rules = [
|
||||
NapiRule,
|
||||
SaRule
|
||||
]
|
||||
|
||||
passed = True
|
||||
napi = NapiRule(mgr, args)
|
||||
if not napi.check():
|
||||
passed = False
|
||||
for rule in rules:
|
||||
r = rule(mgr, args)
|
||||
if not r.check():
|
||||
passed = False
|
||||
|
||||
if not passed:
|
||||
r.log(" Please refer to: \033[91m%s\x1b[0m" % r.get_help_url())
|
||||
|
||||
if args and args.no_fail:
|
||||
return True
|
||||
|
@ -31,8 +31,14 @@ class BaseRule(object):
|
||||
def log(self, info):
|
||||
print(info)
|
||||
|
||||
def warn(self, info):
|
||||
print("\033[35m[WARNING]\x1b[0m: %s" % info)
|
||||
|
||||
def error(self, info):
|
||||
print("\033[91m[NOT ALLOWED]\x1b[0m: %s" % info)
|
||||
|
||||
def get_help_url(self):
|
||||
return "https://gitee.com/openharmony/developtools_integration_verification/tools/deps_guard/rules/%s/README.md" % self.__class__.RULE_NAME
|
||||
return "https://gitee.com/openharmony/developtools_integration_verification/tree/master/tools/deps_guard/rules/%s/README.md" % self.__class__.RULE_NAME
|
||||
|
||||
# To be override
|
||||
def check(self):
|
||||
|
@ -26,15 +26,12 @@ class NapiRule(BaseRule):
|
||||
if targetName in lists:
|
||||
continue
|
||||
|
||||
self.log("NOT ALLOWED: napi module %s depended by:" % mod["name"])
|
||||
self.error("napi module %s depended by:" % mod["name"])
|
||||
for dep in mod["dependedBy"]:
|
||||
caller = dep["caller"]
|
||||
self.log(" module [%s] defined in [%s]" % (caller["name"], caller["labelPath"]))
|
||||
passed = False
|
||||
|
||||
if not passed:
|
||||
self.log(" Please refer to: %s" % self.get_help_url())
|
||||
|
||||
return passed
|
||||
|
||||
def check(self):
|
||||
|
67
tools/deps_guard/rules_checker/sa_rule.py
Executable file
67
tools/deps_guard/rules_checker/sa_rule.py
Executable file
@ -0,0 +1,67 @@
|
||||
#! /usr/bin/env python
|
||||
#coding=utf-8
|
||||
|
||||
import json
|
||||
|
||||
from .base_rule import BaseRule
|
||||
|
||||
class SaRule(BaseRule):
|
||||
RULE_NAME = "NO-Depends-On-SA"
|
||||
|
||||
def __check_depends_on_sa(self):
|
||||
lists = self.get_white_lists()
|
||||
|
||||
passed = True
|
||||
|
||||
sa_without_shlib_type = []
|
||||
non_sa_with_sa_shlib_type = []
|
||||
|
||||
# Check if any napi modules has dependedBy
|
||||
for mod in self.get_mgr().get_all():
|
||||
#print("Check %s now " % mod["path"])
|
||||
is_sa = False
|
||||
if "sa_id" in mod and mod["sa_id"] > 0:
|
||||
is_sa = True
|
||||
# Collect non SA modules with shlib_type of value "sa"
|
||||
if not is_sa and ("shlib_type" in mod and mod["shlib_type"] == "sa"):
|
||||
non_sa_with_sa_shlib_type.append(mod)
|
||||
|
||||
# Collect SA modules without shlib_type with value of "sa"
|
||||
if is_sa and ("shlib_type" not in mod or mod["shlib_type"] != "sa"):
|
||||
if mod["name"] not in lists:
|
||||
sa_without_shlib_type.append(mod)
|
||||
|
||||
if not is_sa:
|
||||
continue
|
||||
|
||||
if len(mod["dependedBy"]) == 0:
|
||||
continue
|
||||
|
||||
if mod["name"] in lists:
|
||||
continue
|
||||
|
||||
# If sa module has version_script to specify exported symbols, it can be depended by others
|
||||
if "version_script" in mod:
|
||||
continue
|
||||
|
||||
# Check if SA modules is depended by other modules
|
||||
self.error("sa module %s depended by:" % mod["name"])
|
||||
for dep in mod["dependedBy"]:
|
||||
caller = dep["caller"]
|
||||
self.log(" module [%s] defined in [%s]" % (caller["name"], caller["labelPath"]))
|
||||
passed = False
|
||||
|
||||
if len(sa_without_shlib_type) > 0:
|
||||
for mod in sa_without_shlib_type:
|
||||
self.warn('sa module %s has no shlib_type="sa", add it in %s' % (mod["name"], mod["labelPath"]))
|
||||
|
||||
if len(non_sa_with_sa_shlib_type) > 0:
|
||||
passed = False
|
||||
for mod in non_sa_with_sa_shlib_type:
|
||||
self.error('\033[91m[NOT ALLOWED]\x1b[0m: non sa module %s with shlib_type="sa", %s' % (mod["name"], mod["labelPath"]))
|
||||
|
||||
return passed
|
||||
|
||||
def check(self):
|
||||
self.log("Do %s rule checking now:" % self.__class__.RULE_NAME)
|
||||
return self.__check_depends_on_sa()
|
Loading…
Reference in New Issue
Block a user