Revert^2 "Add variables for notice deps, license kinds etc."

dcfb9c5ef5

Test: m nothing

Bug: 180688789

Change-Id: I6a60f55ab0e7013061a695cb1b7c5ffde29577dd
Merged-in: I6a60f55ab0e7013061a695cb1b7c5ffde29577dd
This commit is contained in:
Bob Badour 2021-01-07 03:34:31 +00:00
parent 02aea13272
commit 44dcaac28b
4 changed files with 134 additions and 1 deletions

View file

@ -157,6 +157,10 @@ LOCAL_JNI_SHARED_LIBRARIES_ABI:=
LOCAL_CERTIFICATE_LINEAGE:=
LOCAL_LDFLAGS:=
LOCAL_LDLIBS:=
LOCAL_LICENSE_CONDITIONS:=
LOCAL_LICENSE_KINDS:=
LOCAL_LICENSE_INSTALL_MAP:=
LOCAL_LICENSE_PACKAGE_NAME:=
LOCAL_LOGTAGS_FILES:=
LOCAL_MANIFEST_FILE:=
LOCAL_MANIFEST_INSTRUMENTATION_FOR:=
@ -168,6 +172,7 @@ LOCAL_MODULE_HOST_ARCH:=
LOCAL_MODULE_HOST_ARCH_WARN:=
LOCAL_MODULE_HOST_CROSS_ARCH:=
LOCAL_MODULE_HOST_OS:=
LOCAL_MODULE_IS_CONTAINER:=
LOCAL_MODULE_OWNER:=
LOCAL_MODULE_PATH:=
LOCAL_MODULE_RELATIVE_PATH :=

View file

@ -530,6 +530,47 @@ $(eval _idf_val_:=$(if $(strip $(LOCAL_IS_HOST_MODULE)),HOST,$(if $(strip $(LOCA
$(_idf_val_)
endef
###########################################################
## Sometimes a notice dependency will reference an unadorned
## module name that only appears in ALL_MODULES adorned with
## an ARCH suffix or a `host_cross_` prefix.
##
## After all of the modules are processed in base_rules.mk,
## replace all such dependencies with every matching adorned
## module name.
###########################################################
define fix-notice-deps
$(strip \
$(eval _all_module_refs := \
$(sort \
$(foreach m,$(sort $(ALL_MODULES)), \
$(ALL_MODULES.$(m).NOTICE_DEPS) \
) \
) \
) \
$(foreach m, $(_all_module_refs), \
$(eval _lookup.$(m) := \
$(sort \
$(if $(strip $(ALL_MODULES.$(m).PATH)), \
$(m), \
$(filter $(m)_32 $(m)_64 host_cross_$(m) host_cross_$(m)_32 host_cross_$(m)_64, $(ALL_MODULES)) \
) \
) \
) \
) \
$(foreach m, $(ALL_MODULES), \
$(eval ALL_MODULES.$(m).NOTICE_DEPS := \
$(sort \
$(foreach d,$(ALL_MODULES.$(m).NOTICE_DEPS), \
$(_lookup.$(d)) \
) \
) \
) \
) \
)
endef
###########################################################
## Returns correct _idfPrefix from the list:
## { HOST, HOST_CROSS, AUX, TARGET }

View file

@ -1333,6 +1333,9 @@ modules_to_install := $(sort $(ALL_DEFAULT_INSTALLED_MODULES))
ALL_DEFAULT_INSTALLED_MODULES :=
$(call fix-notice-deps)
# These are additional goals that we build, in order to make sure that there
# is as little code as possible in the tree that doesn't build.
modules_to_check := $(foreach m,$(ALL_MODULES),$(ALL_MODULES.$(m).CHECKED))

View file

@ -9,6 +9,32 @@ else
notice_file:=$(strip $(wildcard $(LOCAL_PATH)/NOTICE))
endif
ifneq (,$(strip $(LOCAL_LICENSE_PACKAGE_NAME)))
license_package_name:=$(strip $(LOCAL_LICENSE_PACKAGE_NAME))
else ifdef my_register_name
license_package_name:=$(my_register_name)
else
license_package_name:=$(strip $(LOCAL_MODULE))
endif
ifneq (,$(strip $(LOCAL_LICENSE_INSTALL_MAP)))
install_map:=$(strip $(LOCAL_LICENSE_INSTALL_MAP))
else
install_map:=
endif
ifneq (,$(strip $(LOCAL_LICENSE_KINDS)))
license_kinds:=$(strip $(LOCAL_LICENSE_KINDS))
else
license_kinds:=legacy_by_exception_only
endif
ifneq (,$(strip $(LOCAL_LICENSE_CONDITIONS)))
license_conditions:=$(strip $(LOCAL_LICENSE_CONDITIONS))
else
license_conditions:=by_exception_only
endif
ifeq ($(LOCAL_MODULE_CLASS),GYP)
# We ignore NOTICE files for modules of type GYP.
notice_file :=
@ -40,10 +66,64 @@ endif
installed_notice_file :=
is_container:=$(strip $(LOCAL_MODULE_IS_CONTAINER))
ifeq (,$(is_container))
ifneq (,$(strip $(filter %.zip %.tar %.tgz %.tar.gz %.apk %.img %.srcszip %.apex, $(LOCAL_BUILT_MODULE))))
is_container:=true
else
is_container:=false
endif
else ifneq (,$(strip $(filter-out true false,$(is_container))))
$(error Unrecognized value '$(is_container)' for LOCAL_MODULE_IS_CONTAINER)
endif
ifeq (true,$(is_container))
# Include shared libraries' notices for "container" types, but not for binaries etc.
notice_deps := \
$(sort \
$(LOCAL_REQUIRED_MODULES) \
$(LOCAL_STATIC_LIBRARIES) \
$(LOCAL_WHOLE_STATIC_LIBRARIES) \
$(LOCAL_SHARED_LIBRARIES) \
$(LOCAL_DYLIB_LIBRARIES) \
$(LOCAL_RLIB_LIBRARIES) \
$(LOCAL_PROC_MACRO_LIBRARIES) \
$(LOCAL_HEADER_LIBRARIES) \
$(LOCAL_STATIC_JAVA_LIBRARIES) \
$(LOCAL_JAVA_LIBRARIES) \
$(LOCAL_JNI_SHARED_LIBRARIES) \
)
else
notice_deps := \
$(sort \
$(LOCAL_REQUIRED_MODULES) \
$(LOCAL_STATIC_LIBRARIES) \
$(LOCAL_WHOLE_STATIC_LIBRARIES) \
$(LOCAL_RLIB_LIBRARIES) \
$(LOCAL_PROC_MACRO_LIBRARIES) \
$(LOCAL_HEADER_LIBRARIES) \
$(LOCAL_STATIC_JAVA_LIBRARIES) \
)
endif
ifeq ($(LOCAL_IS_HOST_MODULE),true)
notice_deps := $(sort $(notice_deps) $(LOCAL_HOST_REQUIRED_MODULES))
else
notice_deps := $(sort $(notice_deps) $(LOCAL_TARGET_REQUIRED_MODULES))
endif
ifdef my_register_name
ALL_MODULES.$(my_register_name).LICENSE_PACKAGE_NAME := $(strip $(license_package_name))
ALL_MODULES.$(my_register_name).LICENSE_KINDS := $(sort $(ALL_MODULES.$(my_register_name).LICENSE_KINDS) $(license_kinds))
ALL_MODULES.$(my_register_name).LICENSE_CONDITIONS := $(sort $(ALL_MODULES.$(my_register_name).LICENSE_CONDITIONS) $(license_conditions))
ALL_MODULES.$(my_register_name).LICENSE_INSTALL_MAP := $(sort $(ALL_MODULES.$(my_register_name).LICENSE_INSTALL_MAP) $(install_map))
ALL_MODULES.$(my_register_name).NOTICE_DEPS := $(sort $(ALL_MODULES.$(my_register_name).NOTICE_DEPS) $(notice_deps))
ALL_MODULES.$(my_register_name).IS_CONTAINER := $(sort $(ALL_MODULES.$(my_register_name).IS_CONTAINER) $(is_container))
endif
ifdef notice_file
ifdef my_register_name
ALL_MODULES.$(my_register_name).NOTICES := $(ALL_MODULES.$(my_register_name).NOTICES) $(notice_file)
ALL_MODULES.$(my_register_name).NOTICES := $(sort $(ALL_MODULES.$(my_register_name).NOTICES) $(notice_file))
endif
# This relies on the name of the directory in PRODUCT_OUT matching where
@ -100,6 +180,10 @@ module_installed_filename := $(patsubst $(HOST_CROSS_OUT)/%,%,$(module_installed
installed_notice_file := $($(my_prefix)OUT_NOTICE_FILES)/src/$(module_installed_filename).txt
ifdef my_register_name
ALL_MODULES.$(my_register_name).INSTALLED_NOTICE_FILE := $(installed_notice_file)
endif
$(installed_notice_file): PRIVATE_INSTALLED_MODULE := $(module_installed_filename)
$(installed_notice_file): $(notice_file)