Remove obsolete uses of LOCAL_MODULE_TAGS

Only LOCAL_MODULE_TAGS := tests is used is meaningful in the current
implementation.  "optional" and "samples" both exist in the tree, but
are meaningless.  "gnu", "user", "eng" and "debug" are  no longer used,
and are already forbidden by the unusual tags check.  The info from the
"module" target is now available in module-info.json.  Delete all the
irrelevant code.

Test: no change to out/build-aosp_cf_x86_64_phone.ninja
Change-Id: I04e8178a362e382a1a4bd997c1b4c3a480db7714
This commit is contained in:
Colin Cross 2023-11-02 09:46:10 -07:00
parent 8b1d74ec60
commit aed37d79f2
3 changed files with 6 additions and 129 deletions

View file

@ -124,11 +124,6 @@ include $(BUILD_SYSTEM)/local_vndk.mk
include $(BUILD_SYSTEM)/local_systemsdk.mk
include $(BUILD_SYSTEM)/local_current_sdk.mk
my_module_tags := $(LOCAL_MODULE_TAGS)
ifeq ($(my_host_cross),true)
my_module_tags :=
endif
# Ninja has an implicit dependency on the command being run, and kati will
# regenerate the ninja manifest if any read makefile changes, so there is no
# need to have dependencies on makefiles.
@ -148,46 +143,13 @@ endif
## Validate and define fallbacks for input LOCAL_* variables.
###########################################################
## Dump a .csv file of all modules and their tags
#ifneq ($(tag-list-first-time),false)
#$(shell rm -f tag-list.csv)
#tag-list-first-time := false
#endif
#$(shell echo $(lastword $(filter-out config/% out/%,$(MAKEFILE_LIST))),$(LOCAL_MODULE),$(strip $(LOCAL_MODULE_CLASS)),$(subst $(space),$(comma),$(sort $(my_module_tags))) >> tag-list.csv)
LOCAL_UNINSTALLABLE_MODULE := $(strip $(LOCAL_UNINSTALLABLE_MODULE))
my_module_tags := $(sort $(my_module_tags))
ifeq (,$(my_module_tags))
my_module_tags := optional
endif
# User tags are not allowed anymore. Fail early because it will not be installed
# like it used to be.
ifneq ($(filter $(my_module_tags),user),)
$(warning *** Module name: $(LOCAL_MODULE))
$(warning *** Makefile location: $(LOCAL_MODULE_MAKEFILE))
$(warning * )
$(warning * Module is attempting to use the 'user' tag. This)
$(warning * used to cause the module to be installed automatically.)
$(warning * Now, the module must be listed in the PRODUCT_PACKAGES)
$(warning * section of a product makefile to have it installed.)
$(warning * )
$(error user tag detected on module.)
endif
my_bad_module_tags := $(filter eng debug,$(my_module_tags))
ifdef my_bad_module_tags
ifeq (true,$(LOCAL_UNINSTALLABLE_MODULE))
$(call pretty-warning,LOCAL_MODULE_TAGS := $(my_bad_module_tags) does not do anything for uninstallable modules)
endif
$(call pretty-error,LOCAL_MODULE_TAGS := $(my_bad_module_tags) is obsolete. See $(CHANGES_URL)#LOCAL_MODULE_TAGS)
endif
# Only the tags mentioned in this test are expected to be set by module
# makefiles. Anything else is either a typo or a source of unexpected
# behaviors.
ifneq ($(filter-out tests optional samples,$(my_module_tags)),)
$(call pretty-error,unusual tags: $(filter-out tests optional samples,$(my_module_tags)))
ifneq ($(filter-out tests optional samples,$(LOCAL_MODULE_TAGS)),)
$(call pretty-error,unusual tags: $(filter-out tests optional samples,$(LOCAL_MODULE_TAGS)))
endif
LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS))
@ -240,7 +202,7 @@ else ifeq (NATIVE_TESTS,$(LOCAL_MODULE_CLASS))
else
# The definition of should-install-to-system will be different depending
# on which goal (e.g., sdk or just droid) is being built.
partition_tag := $(if $(call should-install-to-system,$(my_module_tags)),,_DATA)
partition_tag := $(if $(call should-install-to-system,$(LOCAL_MODULE_TAGS)),,_DATA)
actual_partition_tag := $(if $(partition_tag),data,system)
endif
endif
@ -252,7 +214,7 @@ ifndef LOCAL_COMPATIBILITY_SUITE
LOCAL_COMPATIBILITY_SUITE := null-suite
endif
ifneq ($(filter APPS, $(LOCAL_MODULE_CLASS)),)
ifneq ($(filter $(my_module_tags),tests),)
ifneq ($(filter $(LOCAL_MODULE_TAGS),tests),)
LOCAL_COMPATIBILITY_SUITE := null-suite
endif
endif
@ -947,7 +909,7 @@ ALL_MODULES.$(my_register_name).CLASS := \
ALL_MODULES.$(my_register_name).PATH := \
$(ALL_MODULES.$(my_register_name).PATH) $(LOCAL_PATH)
ALL_MODULES.$(my_register_name).TAGS := \
$(ALL_MODULES.$(my_register_name).TAGS) $(my_module_tags)
$(ALL_MODULES.$(my_register_name).TAGS) $(LOCAL_MODULE_TAGS)
ALL_MODULES.$(my_register_name).CHECKED := \
$(ALL_MODULES.$(my_register_name).CHECKED) $(my_checked_module)
ALL_MODULES.$(my_register_name).BUILT := \
@ -1213,17 +1175,6 @@ ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS := $(sort \
license_files := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*)
ALL_DEPS.$(LOCAL_MODULE).LICENSE := $(sort $(ALL_DEPS.$(LOCAL_MODULE).LICENSE) $(license_files))
###########################################################
## Take care of my_module_tags
###########################################################
# Keep track of all the tags we've seen.
ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(my_module_tags))
# Add this module name to the tag list of each specified tag.
$(foreach tag,$(filter-out optional,$(my_module_tags)),\
$(eval ALL_MODULE_NAME_TAGS.$(tag) := $$(ALL_MODULE_NAME_TAGS.$(tag)) $(my_register_name)))
###########################################################
## umbrella targets used to verify builds
###########################################################
@ -1250,7 +1201,7 @@ endif
ifdef j_or_n
$(j_or_n) $(h_or_t) $(j_or_n)-$(h_or_hc_or_t) : $(my_checked_module)
ifneq (,$(filter $(my_module_tags),tests))
ifneq (,$(filter $(LOCAL_MODULE_TAGS),tests))
$(j_or_n)-$(h_or_t)-tests $(j_or_n)-tests $(h_or_t)-tests : $(my_checked_module)
endif
$(LOCAL_MODULE)-$(h_or_hc_or_t) : $(my_all_targets)

View file

@ -48,20 +48,6 @@ ALL_COPIED_TARGETS:=
# set of installed targets.
ALL_DEFAULT_INSTALLED_MODULES:=
# The list of tags that have been defined by
# LOCAL_MODULE_TAGS. Each word in this variable maps
# to a corresponding ALL_MODULE_TAGS.<tagname> variable
# that contains all of the INSTALLED_MODULEs with that tag.
ALL_MODULE_TAGS:=
# Similar to ALL_MODULE_TAGS, but contains the short names
# of all targets for a particular tag. The top-level variable
# won't have the list of tags; ust ALL_MODULE_TAGS to get
# the list of all known tags. (This means that this variable
# will always be empty; it's just here as a placeholder for
# its sub-variables.)
ALL_MODULE_NAME_TAGS:=
# Full path to all asm, C, C++, lex and yacc generated C files.
# These all have an order-only dependency on the copied headers
ALL_C_CPP_ETC_OBJECTS:=
@ -1294,38 +1280,6 @@ define exported-sdk-libs-files
$(foreach lib,$(1),$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/exported-sdk-libs)
endef
###########################################################
## MODULE_TAG set operations
###########################################################
# Given a list of tags, return the targets that specify
# any of those tags.
# $(1): tag list
define modules-for-tag-list
$(sort $(foreach tag,$(1),$(foreach m,$(ALL_MODULE_NAME_TAGS.$(tag)),$(ALL_MODULES.$(m).INSTALLED))))
endef
# Same as modules-for-tag-list, but operates on
# ALL_MODULE_NAME_TAGS.
# $(1): tag list
define module-names-for-tag-list
$(sort $(foreach tag,$(1),$(ALL_MODULE_NAME_TAGS.$(tag))))
endef
# Given an accept and reject list, find the matching
# set of targets. If a target has multiple tags and
# any of them are rejected, the target is rejected.
# Reject overrides accept.
# $(1): list of tags to accept
# $(2): list of tags to reject
#TODO(dbort): do $(if $(strip $(1)),$(1),$(ALL_MODULE_TAGS))
#TODO(jbq): as of 20100106 nobody uses the second parameter
define get-tagged-modules
$(filter-out \
$(call modules-for-tag-list,$(2)), \
$(call modules-for-tag-list,$(1)))
endef
###########################################################
## Append a leaf to a base path. Properly deals with
## base paths ending in /.

View file

@ -1399,28 +1399,7 @@ modules_to_install := $(sort \
# var to prevent Make from trying to make a sense of it.
_unused := $(call copy-many-files, $(sort $(ALL_COMPATIBILITY_DIST_FILES)))
# Don't include any GNU General Public License shared objects or static
# libraries in SDK images. GPL executables (not static/dynamic libraries)
# are okay if they don't link against any closed source libraries (directly
# or indirectly)
# It's ok (and necessary) to build the host tools, but nothing that's
# going to be installed on the target (including static libraries).
ifdef is_sdk_build
target_gnu_MODULES := \
$(filter \
$(TARGET_OUT_INTERMEDIATES)/% \
$(TARGET_OUT)/% \
$(TARGET_OUT_DATA)/%, \
$(sort $(call get-tagged-modules,gnu)))
target_gnu_MODULES := $(filter-out $(TARGET_OUT_EXECUTABLES)/%,$(target_gnu_MODULES))
target_gnu_MODULES := $(filter-out %/libopenjdkjvmti.so,$(target_gnu_MODULES))
target_gnu_MODULES := $(filter-out %/libopenjdkjvmtid.so,$(target_gnu_MODULES))
$(info Removing from sdk:)$(foreach d,$(target_gnu_MODULES),$(info : $(d)))
modules_to_install := \
$(filter-out $(target_gnu_MODULES),$(modules_to_install))
# Ensure every module listed in PRODUCT_PACKAGES* gets something installed
# TODO: Should we do this for all builds and not just the sdk?
dangling_modules :=
@ -2008,13 +1987,6 @@ $(LSDUMP_PATHS_FILE):
.PHONY: check-elf-files
check-elf-files:
#xxx scrape this from ALL_MODULE_NAME_TAGS
.PHONY: modules
modules:
@echo "Available sub-modules:"
@echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \
tr -s ' ' '\n' | sort -u
.PHONY: dump-files
dump-files:
@echo "Target files for $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) ($(INTERNAL_PRODUCT)):"