forked from openkylin/platform_build
Merge "Fix event-log-tags so we don't rebuild framework.jar because of an installclean." into gingerbread
This commit is contained in:
commit
d7324cc356
|
@ -252,8 +252,23 @@ systemimage:
|
|||
|
||||
.PHONY: event-log-tags
|
||||
|
||||
# Produce an event logs tag file for everything we know about, in order
|
||||
# to properly allocate numbers. Then produce a file that's filtered
|
||||
# for what's going to be installed.
|
||||
|
||||
all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
|
||||
|
||||
# Include tags from all packages that we know about
|
||||
all_event_log_tags_src := \
|
||||
$(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
|
||||
|
||||
$(all_event_log_tags_file): PRIVATE_SRC_FILES := $(all_event_log_tags_src)
|
||||
$(all_event_log_tags_file): $(all_event_log_tags_src)
|
||||
$(hide) mkdir -p $(dir $@)
|
||||
$(hide) build/tools/merge-event-log-tags.py -o $@ $(PRIVATE_SRC_FILES)
|
||||
|
||||
|
||||
event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
|
||||
ALL_PREBUILT += $(event_log_tag_file)
|
||||
|
||||
# Include tags from all packages included in this product.
|
||||
event_log_tags_src := \
|
||||
|
@ -263,14 +278,16 @@ event_log_tags_src := \
|
|||
$(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
|
||||
|
||||
$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src)
|
||||
$(event_log_tags_file): $(event_log_tags_src)
|
||||
$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
|
||||
$(event_log_tags_file): $(event_log_tags_src) $(all_event_log_tags_file)
|
||||
$(hide) mkdir -p $(dir $@)
|
||||
$(hide) build/tools/merge-event-log-tags.py -o $@ $(PRIVATE_SRC_FILES)
|
||||
$(hide) build/tools/merge-event-log-tags.py -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
|
||||
|
||||
event-log-tags: $(event_log_tags_file)
|
||||
|
||||
ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
|
||||
|
||||
|
||||
ifneq ($(TARGET_SIMULATOR),true)
|
||||
|
||||
# #################################################################
|
||||
|
|
|
@ -222,7 +222,7 @@ ifneq ($(strip $(filter $(LOCAL_MODULE_CLASS),APPS JAVA_LIBRARIES)),)
|
|||
logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources)))
|
||||
logtags_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(logtags_sources))
|
||||
|
||||
$(logtags_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.logtags $(TARGET_OUT)/etc/event-log-tags
|
||||
$(logtags_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.logtags $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
|
||||
$(transform-logtags-to-java)
|
||||
|
||||
endif
|
||||
|
|
|
@ -36,6 +36,7 @@ errors = []
|
|||
warnings = []
|
||||
|
||||
output_file = None
|
||||
pre_merged_file = None
|
||||
|
||||
# Tags with a tag number of ? are assigned a tag in the range
|
||||
# [ASSIGN_START, ASSIGN_LIMIT).
|
||||
|
@ -43,7 +44,7 @@ ASSIGN_START = 900000
|
|||
ASSIGN_LIMIT = 1000000
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "ho:")
|
||||
opts, args = getopt.getopt(sys.argv[1:], "ho:m:")
|
||||
except getopt.GetoptError, err:
|
||||
print str(err)
|
||||
print __doc__
|
||||
|
@ -55,6 +56,8 @@ for o, a in opts:
|
|||
sys.exit(2)
|
||||
elif o == "-o":
|
||||
output_file = a
|
||||
elif o == "-m":
|
||||
pre_merged_file = a
|
||||
else:
|
||||
print >> sys.stderr, "unhandled option %s" % (o,)
|
||||
sys.exit(1)
|
||||
|
@ -71,6 +74,11 @@ for o, a in opts:
|
|||
by_tagname = {}
|
||||
by_tagnum = {}
|
||||
|
||||
pre_merged_tags = {}
|
||||
if pre_merged_file:
|
||||
for t in event_log_tags.TagFile(pre_merged_file).tags:
|
||||
pre_merged_tags[t.tagname] = t
|
||||
|
||||
for fn in args:
|
||||
tagfile = event_log_tags.TagFile(fn)
|
||||
|
||||
|
@ -140,15 +148,26 @@ def hashname(str):
|
|||
# assigned. We do this based on a hash of the tag name so that the
|
||||
# numbers should stay relatively stable as tags are added.
|
||||
|
||||
# If we were provided pre-merged tags (w/ the -m option), then don't
|
||||
# ever try to allocate one, just fail if we don't have a number
|
||||
|
||||
for name, t in sorted(by_tagname.iteritems()):
|
||||
if t.tagnum is None:
|
||||
while True:
|
||||
x = (hashname(name) % (ASSIGN_LIMIT - ASSIGN_START - 1)) + ASSIGN_START
|
||||
if x not in by_tagnum:
|
||||
t.tagnum = x
|
||||
by_tagnum[x] = t
|
||||
break
|
||||
name = "_" + name
|
||||
if pre_merged_tags:
|
||||
try:
|
||||
t.tagnum = pre_merged_tags[t.tagname]
|
||||
except KeyError:
|
||||
print >> sys.stderr, ("Error: Tag number not defined for tag `%s'."
|
||||
+" Have you done a full build?") % t.tagname
|
||||
sys.exit(1)
|
||||
else:
|
||||
while True:
|
||||
x = (hashname(name) % (ASSIGN_LIMIT - ASSIGN_START - 1)) + ASSIGN_START
|
||||
if x not in by_tagnum:
|
||||
t.tagnum = x
|
||||
by_tagnum[x] = t
|
||||
break
|
||||
name = "_" + name
|
||||
|
||||
# by_tagnum should be complete now; we've assigned numbers to all tags.
|
||||
|
||||
|
|
Loading…
Reference in New Issue