diff --git a/core/Makefile b/core/Makefile index 669745a894..65f51fc42e 100644 --- a/core/Makefile +++ b/core/Makefile @@ -495,9 +495,20 @@ $(MK2BP_REMAINING_HTML): $(SOONG_CONV_DATA) $(MK2BP_CATALOG_SCRIPT) --title="Remaining Android.mk files for $(TARGET_DEVICE)-$(TARGET_BUILD_VARIANT)" \ --codesearch=$(PRIVATE_CODE_SEARCH_BASE_URL) \ --out_dir="$(OUT_DIR)" \ + --mode=html \ > $@ $(call dist-for-goals,droidcore,$(MK2BP_REMAINING_HTML)) +MK2BP_REMAINING_CSV := $(PRODUCT_OUT)/mk2bp_remaining.csv +$(MK2BP_REMAINING_CSV): $(SOONG_CONV_DATA) $(MK2BP_CATALOG_SCRIPT) + @rm -f $@ + $(hide) $(MK2BP_CATALOG_SCRIPT) \ + --device=$(TARGET_DEVICE) \ + --out_dir="$(OUT_DIR)" \ + --mode=csv \ + > $@ +$(call dist-for-goals,droidcore,$(MK2BP_REMAINING_CSV)) + # ----------------------------------------------------------------- # Modules use -Wno-error, or added default -Wall -Werror WALL_WERROR := $(PRODUCT_OUT)/wall_werror.txt diff --git a/tools/mk2bp_catalog.py b/tools/mk2bp_catalog.py index 83abd62512..c2afb9b948 100755 --- a/tools/mk2bp_catalog.py +++ b/tools/mk2bp_catalog.py @@ -168,22 +168,24 @@ def is_google(dirname): return True return False -def make_annotation_link(annotations, analysis, modules): - if analysis: - return "%s" % ( - annotations.Add(analysis, modules), - len(analysis) - ) - else: - return ""; - - def is_clean(makefile): for analysis in makefile.analyses.values(): if analysis: return False return True +def clean_and_only_blocked_by_clean(soong, all_makefiles, makefile): + if not is_clean(makefile): + return False + modules = soong.reverse_makefiles[makefile.filename] + for module in modules: + for dep in soong.transitive_deps(module): + for filename in soong.makefiles.get(dep, []): + m = all_makefiles.get(filename) + if m and not is_clean(m): + return False + return True + class Annotations(object): def __init__(self): self.entries = [] @@ -205,6 +207,7 @@ class SoongData(object): self.makefiles = dict() self.reverse_makefiles = dict() self.installed = dict() + self.reverse_installed = dict() self.modules = set() for (module, module_type, problem, dependencies, makefiles, installed) in reader: @@ -222,6 +225,29 @@ class SoongData(object): self.reverse_makefiles.setdefault(f, []).append(module) for f in installed.strip().split(' '): self.installed[f] = module + self.reverse_installed.setdefault(module, []).append(f) + + def transitive_deps(self, module): + results = set() + def traverse(module): + for dep in self.deps.get(module, []): + if not dep in results: + results.add(dep) + traverse(module) + traverse(module) + return results + + def contains_unblocked_modules(self, filename): + for m in self.reverse_makefiles[filename]: + if len(self.deps[m]) == 0: + return True + return False + + def contains_blocked_modules(self, filename): + for m in self.reverse_makefiles[filename]: + if len(self.deps[m]) > 0: + return True + return False def count_deps(depsdb, module, seen): """Based on the depsdb, count the number of transitive dependencies. @@ -237,18 +263,6 @@ def count_deps(depsdb, module, seen): count += 1 + count_deps(depsdb, dep, seen) return count -def contains_unblocked_modules(soong, modules): - for m in modules: - if len(soong.deps[m]) == 0: - return True - return False - -def contains_blocked_modules(soong, modules): - for m in modules: - if len(soong.deps[m]) > 0: - return True - return False - OTHER_PARTITON = "_other" HOST_PARTITON = "_host" @@ -273,6 +287,27 @@ def format_module_link(module): def format_module_list(modules): return "".join(["
Directory | +Total | +Easy | +Unblocked Clean | +Unblocked | +Blocked | +Clean | + """ % { + "link": link, + "title": title + }) + for analyzer in ANALYZERS: + print("""%s | """ % analyzer.title) + print("
---|
Total | -The total number of makefiles in this each directory. | -
---|---|
Unblocked | -Makefiles containing one or more modules that don't have any - additional dependencies pending before conversion. | -
Blocked | -Makefiles containiong one or more modules which do have - additional prerequesite depenedencies that are not yet converted. | -
Clean | -The number of makefiles that have none of the following warnings. | -
ifeq / ifneq | -Makefiles that use ifeq or ifneq . i.e.
- conditionals. |
-
Wacky Includes | -Makefiles that include files other than the standard build-system
- defined template and macros. |
-
Calls base_rules | -Makefiles that include base_rules.mk directly. | -
Calls define | -Makefiles that define their own macros. Some of these are easy to convert
- to soong defaults , but others are complex. |
-
Has ../ | -Makefiles containing the string "../" outside of a comment. These likely - access files outside their directories. | -
dist-for-goals | -Makefiles that call dist-for-goals directly. |
-
.PHONY | -Makefiles that declare .PHONY targets. | -
renderscript | -Makefiles defining targets that depend on .rscript source files. |
-
vts src | -Makefiles defining targets that depend on .vts source files. |
-
COPY_HEADERS | -Makefiles using LOCAL_COPY_HEADERS. | -
- Following the list of directories is a list of the modules that are installed on - each partition. Potential issues from their makefiles are listed, as well as the - total number of dependencies (both blocking that module and blocked by that module) - and the list of direct dependencies. Note: The number is the number of all transitive - dependencies and the list of modules is only the direct dependencies. -
Directory | -Total | -Unblocked | -Blocked | -Clean | + + +|
---|---|---|---|---|---|
%(dirname)s | -%(makefiles)s | -%(unblocked)s | -%(blocked)s | -%(clean)s | - """ % { - "rowclass": rowclass, - "dirname": dirname, - "makefiles": make_annotation_link(annotations, all_makefiles, modules), - "unblocked": make_annotation_link(annotations, unblocked_makefiles, modules), - "blocked": make_annotation_link(annotations, blocked_makefiles, modules), - "clean": make_annotation_link(annotations, clean_makefiles, modules), - }) - for analyzer in ANALYZERS: - analyses = [m.analyses.get(analyzer) for m in makefiles if m.analyses.get(analyzer)] - print("""%s | """ - % make_annotation_link(annotations, analyses, modules)) - - print("
+ This page analyzes the remaining Android.mk files in the Android Source tree. +
+ The modules are first broken down by which of the device filesystem partitions + they are installed to. This also includes host tools and testcases which don't + actually reside in their own partition but convenitely group together. +
+ The makefiles for each partition are further are grouped into a set of directories + aritrarily picked to break down the problem size by owners. +
+
Total | +The total number of makefiles in this each directory. | +
---|---|
Easy | +The number of makefiles that have no warnings themselves, and also + none of their dependencies have warnings either. | +
Unblocked Clean | +The number of makefiles that are both Unblocked and Clean. | +
Unblocked | +Makefiles containing one or more modules that don't have any + additional dependencies pending before conversion. | +
Blocked | +Makefiles containiong one or more modules which do have + additional prerequesite depenedencies that are not yet converted. | +
Clean | +The number of makefiles that have none of the following warnings. | +
ifeq / ifneq | +Makefiles that use ifeq or ifneq . i.e.
+ conditionals. |
+
Wacky Includes | +Makefiles that include files other than the standard build-system
+ defined template and macros. |
+
Calls base_rules | +Makefiles that include base_rules.mk directly. | +
Calls define | +Makefiles that define their own macros. Some of these are easy to convert
+ to soong defaults , but others are complex. |
+
Has ../ | +Makefiles containing the string "../" outside of a comment. These likely + access files outside their directories. | +
dist-for-goals | +Makefiles that call dist-for-goals directly. |
+
.PHONY | +Makefiles that declare .PHONY targets. | +
renderscript | +Makefiles defining targets that depend on .rscript source files. |
+
vts src | +Makefiles defining targets that depend on .vts source files. |
+
COPY_HEADERS | +Makefiles using LOCAL_COPY_HEADERS. | +
+ Following the list of directories is a list of the modules that are installed on + each partition. Potential issues from their makefiles are listed, as well as the + total number of dependencies (both blocking that module and blocked by that module) + and the list of direct dependencies. Note: The number is the number of all transitive + dependencies and the list of modules is only the direct dependencies. +
Module Name | ") + print("Issues | ") + print("Blocked By | ") + print("Blocking | ") print("
---|