From e89df9323110a872e0a357763cada8630ce2aa67 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 15 Nov 2017 21:33:10 -0800 Subject: [PATCH 1/2] Add support for srcjars to droiddoc Soong generates the R.java for framework-res.apk to a srcjar. Droiddoc will need to consume them, so add support to the droiddoc rules for extracting sources from a srcjar. Test: m checkbuild Change-Id: I064889c9063b642835d9f668e2568b61d0fabe35 --- core/droiddoc.mk | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/core/droiddoc.mk b/core/droiddoc.mk index 45b8af092..4ba480b48 100644 --- a/core/droiddoc.mk +++ b/core/droiddoc.mk @@ -91,8 +91,11 @@ intermediates.COMMON := $(call local-intermediates-dir,COMMON) $(full_target): PRIVATE_SOURCE_PATH := $(call normalize-path-list,$(LOCAL_DROIDDOC_SOURCE_PATH)) $(full_target): PRIVATE_JAVA_FILES := $(filter %.java,$(full_src_files)) $(full_target): PRIVATE_JAVA_FILES += $(addprefix $($(my_prefix)OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES))) +$(full_target): PRIVATE_SRCJARS := $(LOCAL_SRCJARS) $(full_target): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/src +$(full_target): PRIVATE_SRCJAR_INTERMEDIATES_DIR := $(intermediates.COMMON)/srcjars $(full_target): PRIVATE_SRC_LIST_FILE := $(intermediates.COMMON)/droiddoc-src-list +$(full_target): PRIVATE_SRCJAR_LIST_FILE := $(intermediates.COMMON)/droiddoc-srcjar-list ifneq ($(strip $(LOCAL_ADDITIONAL_JAVA_DIR)),) $(full_target): PRIVATE_ADDITIONAL_JAVA_DIR := $(LOCAL_ADDITIONAL_JAVA_DIR) @@ -173,17 +176,21 @@ $(full_target): \ $(droiddoc) \ $(html_dir_files) \ $(full_java_libs) \ + $(EXTRACT_SRCJARS) \ + $(LOCAL_SRCJARS) \ $(LOCAL_ADDITIONAL_DEPENDENCIES) @echo Docs droiddoc: $(PRIVATE_OUT_DIR) $(hide) mkdir -p $(dir $@) - $(addprefix $(hide) rm -rf ,$(PRIVATE_STUB_OUT_DIR)) + $(hide) rm -rf $(PRIVATE_STUB_OUT_DIR) $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) $(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \ $(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR)) + $(EXTRACT_SRCJARS) $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) $(PRIVATE_SRCJAR_LIST_FILE) $(PRIVATE_SRCJARS) $(hide) ( \ $(JAVADOC) \ -encoding UTF-8 \ -source 1.8 \ \@$(PRIVATE_SRC_LIST_FILE) \ + \@$(PRIVATE_SRCJAR_LIST_FILE) \ -J-Xmx1600m \ -J-XX:-OmitStackTraceInFastThrow \ -XDignore.symbol.file \ @@ -223,17 +230,19 @@ else # For OpenJDK 8 we can use -bootclasspath to define the core libraries code. $(full_target): PRIVATE_BOOTCLASSPATH_ARG := $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) endif - -$(full_target): $(full_src_files) $(full_java_libs) +$(full_target): $(full_src_files) $(full_java_libs) $(EXTRACT_SRCJARS) $(LOCAL_SRCJARS) $(LOCAL_ADDITIONAL_DEPENDENCIES) @echo Docs javadoc: $(PRIVATE_OUT_DIR) @mkdir -p $(dir $@) + rm -rf $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) $(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \ $(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR)) + $(EXTRACT_SRCJARS) $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) $(PRIVATE_SRCJAR_LIST_FILE) $(PRIVATE_SRCJARS) $(hide) ( \ $(JAVADOC) \ -encoding UTF-8 \ $(PRIVATE_DROIDDOC_OPTIONS) \ \@$(PRIVATE_SRC_LIST_FILE) \ + \@$(PRIVATE_SRCJAR_LIST_FILE) \ -J-Xmx1024m \ -XDignore.symbol.file \ -Xdoclint:none \ From 0bb782bd4e19fa51552f33f990d79e46a976bd9d Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 15 Nov 2017 21:34:32 -0800 Subject: [PATCH 2/2] Allow converting logtags to java without merged logtags file Most logtags files only have entries with hardcoded numbers. Allow these files to be converted to java without needing the merged logtags file. Test: m checkbuild Change-Id: I4cd38aa502fc9b8e50af92ff8296d3ad6abfb56e --- tools/java-event-log-tags.py | 43 +++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/tools/java-event-log-tags.py b/tools/java-event-log-tags.py index f364751c4..37cd71220 100755 --- a/tools/java-event-log-tags.py +++ b/tools/java-event-log-tags.py @@ -51,30 +51,37 @@ for o, a in opts: print >> sys.stderr, "unhandled option %s" % (o,) sys.exit(1) -if len(args) != 2: - print "need exactly two input files, not %d" % (len(args),) +if len(args) != 1 and len(args) != 2: + print "need one or two input files, not %d" % (len(args),) print __doc__ sys.exit(1) fn = args[0] tagfile = event_log_tags.TagFile(fn) -# Load the merged tag file (which should have numbers assigned for all -# tags. Use the numbers from the merged file to fill in any missing -# numbers from the input file. -merged_fn = args[1] -merged_tagfile = event_log_tags.TagFile(merged_fn) -merged_by_name = dict([(t.tagname, t) for t in merged_tagfile.tags]) -for t in tagfile.tags: - if t.tagnum is None: - if t.tagname in merged_by_name: - t.tagnum = merged_by_name[t.tagname].tagnum - else: - # We're building something that's not being included in the - # product, so its tags don't appear in the merged file. Assign - # them all an arbitrary number so we can emit the java and - # compile the (unused) package. - t.tagnum = 999999 +if len(args) > 1: + # Load the merged tag file (which should have numbers assigned for all + # tags. Use the numbers from the merged file to fill in any missing + # numbers from the input file. + merged_fn = args[1] + merged_tagfile = event_log_tags.TagFile(merged_fn) + merged_by_name = dict([(t.tagname, t) for t in merged_tagfile.tags]) + for t in tagfile.tags: + if t.tagnum is None: + if t.tagname in merged_by_name: + t.tagnum = merged_by_name[t.tagname].tagnum + else: + # We're building something that's not being included in the + # product, so its tags don't appear in the merged file. Assign + # them all an arbitrary number so we can emit the java and + # compile the (unused) package. + t.tagnum = 999999 +else: + # Not using the merged tag file, so all tags must have manually assigned + # numbers + for t in tagfile.tags: + if t.tagnum is None: + tagfilef.AddError("tag \"%s\" has no number" % (tagname,), tag.linenum) if "java_package" not in tagfile.options: tagfile.AddError("java_package option not specified", linenum=0)