Merge changes I5199a7e9,I386ab7c1,I2038c77c
* changes: sourcedr: Add more project analysis filters sourcedr: Check whether paths map to projects vtable-dumper: Update test script
This commit is contained in:
@@ -22,11 +22,15 @@ import argparse
|
||||
import collections
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import xml.dom.minidom
|
||||
|
||||
from blueprint import RecursiveParser, evaluate_defaults, fill_module_namespaces
|
||||
|
||||
|
||||
_GROUPS = ['system_only', 'vendor_only', 'both']
|
||||
|
||||
|
||||
def parse_manifest_xml(manifest_path):
|
||||
"""Build a dictionary that maps directories into projects."""
|
||||
dir_project_dict = {}
|
||||
@@ -115,8 +119,15 @@ def _parse_args():
|
||||
help='Path to root Android.bp')
|
||||
parser.add_argument('-m', '--manifest', required=True,
|
||||
help='Path to repo manifest xml file')
|
||||
parser.add_argument('--skip-no-overlaps', action='store_true',
|
||||
help='Skip projects without overlaps')
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
group.add_argument('--skip-no-overlaps', action='store_true',
|
||||
help='Skip projects without overlaps')
|
||||
group.add_argument('--has-group', choices=_GROUPS,
|
||||
help='List projects that some modules are in the group')
|
||||
group.add_argument('--only-has-group', choices=_GROUPS,
|
||||
help='List projects that all modules are in the group')
|
||||
group.add_argument('--without-group', choices=_GROUPS,
|
||||
help='List projects that no modules are in the group')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@@ -140,23 +151,51 @@ def main():
|
||||
root_dir = os.path.dirname(os.path.abspath(args.blueprint))
|
||||
root_prefix_len = len(root_dir) + 1
|
||||
|
||||
has_error = False
|
||||
|
||||
for rule, attrs in parse_blueprint(args.blueprint):
|
||||
path = _get_property(attrs, '_path')[root_prefix_len:]
|
||||
project = dir_matcher.find(path)
|
||||
if project is None:
|
||||
print('error: Path {!r} does not belong to any git projects.'
|
||||
.format(path), file=sys.stderr)
|
||||
has_error = True
|
||||
continue
|
||||
git_projects[project].add_module(path, rule, attrs)
|
||||
|
||||
# Print output
|
||||
total_projects = 0
|
||||
for project, modules in sorted(git_projects.items()):
|
||||
if args.skip_no_overlaps and (int(len(modules.system_only) > 0) +
|
||||
int(len(modules.vendor_only) > 0) +
|
||||
int(len(modules.both) > 0)) <= 1:
|
||||
continue
|
||||
if args.skip_no_overlaps:
|
||||
if (int(len(modules.system_only) > 0) +
|
||||
int(len(modules.vendor_only) > 0) +
|
||||
int(len(modules.both) > 0)) <= 1:
|
||||
continue
|
||||
elif args.has_group:
|
||||
if not getattr(modules, args.has_group):
|
||||
continue
|
||||
elif args.only_has_group:
|
||||
if any(getattr(modules, group)
|
||||
for group in _GROUPS if group != args.only_has_group):
|
||||
continue
|
||||
if not getattr(modules, args.only_has_group):
|
||||
continue
|
||||
elif args.without_group:
|
||||
if getattr(modules, args.without_group):
|
||||
continue
|
||||
|
||||
print(project, len(modules.system_only), len(modules.vendor_only),
|
||||
len(modules.both))
|
||||
_dump_module_set('system_only', modules.system_only)
|
||||
_dump_module_set('vendor_only', modules.vendor_only)
|
||||
_dump_module_set('both', modules.both)
|
||||
|
||||
total_projects += 1
|
||||
|
||||
print('Total:', total_projects)
|
||||
|
||||
if has_error:
|
||||
sys.exit(2)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -24,9 +24,11 @@ import tempfile
|
||||
|
||||
"""Test vndk vtable dumper"""
|
||||
|
||||
NDK_VERSION = 'r11'
|
||||
NDK_VERSION = 'r16'
|
||||
API_LEVEL = 'android-24'
|
||||
|
||||
LLVM_PREBUILTS_VERSION = 'clang-4691093'
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
VNDK_VTABLE_DUMPER = 'vndk-vtable-dumper'
|
||||
|
||||
@@ -54,7 +56,7 @@ def get_prebuilts_gcc(android_build_top, arch, gcc_version):
|
||||
def get_prebuilts_clang(android_build_top):
|
||||
"""Get the path to prebuilt gcc for the current platform"""
|
||||
return os.path.join(android_build_top, 'prebuilts', 'clang', 'host',
|
||||
get_prebuilts_host(), 'clang-stable')
|
||||
get_prebuilts_host(), LLVM_PREBUILTS_VERSION)
|
||||
|
||||
def get_prebuilts_ndk(android_build_top, subdirs):
|
||||
"""Get the path to prebuilt ndk for the current platform and API level"""
|
||||
|
||||
Reference in New Issue
Block a user