Avoid duplicate installed notice file rules.
For cases with a my_register_name, move into $(call license-metadata-rule). Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m nothing Bug: 180688789 Change-Id: Ib6c610960347db84503831b1e1519622696d4500 Merged-in: Ib6c610960347db84503831b1e1519622696d4500 Merged-in: Ib8a9276b33429cdac24e8a7dd8efa4165534749d Merged-in: I6df18c141c4a5ef8b9cbdec5545d5f03c864cb79
This commit is contained in:
parent
d0a24aa504
commit
5b4d603783
2 changed files with 45 additions and 26 deletions
|
@ -562,7 +562,7 @@ $(strip \
|
|||
$(foreach m, $(ALL_MODULES), \
|
||||
$(eval ALL_MODULES.$(m).NOTICE_DEPS := \
|
||||
$(sort \
|
||||
$(foreach d,$(ALL_MODULES.$(m).NOTICE_DEPS), \
|
||||
$(foreach d,$(sort $(ALL_MODULES.$(m).NOTICE_DEPS)), \
|
||||
$(_lookup.$(d)) \
|
||||
) \
|
||||
) \
|
||||
|
@ -584,7 +584,9 @@ endef
|
|||
define license-metadata-rule
|
||||
$(strip $(eval _dir := $(call license-metadata-dir)))
|
||||
$(strip $(eval _deps := $(sort $(filter-out $(_dir)/$(1).meta_lic,$(foreach d,$(ALL_MODULES.$(1).NOTICE_DEPS), $(_dir)/$(d).meta_lic)))))
|
||||
$(foreach b,$(sort $(ALL_MODULES.$(1).BUILT) $(ALL_MODULES.$(1).INSTALLED)),
|
||||
$(strip $(eval _notices := $(sort $(ALL_MODULES.$(1).NOTICES))))
|
||||
$(strip $(eval _tgts := $(sort $(ALL_MODULES.$(1).BUILT) $(ALL_MODULES.$(1).INSTALLED))))
|
||||
$(foreach b,$(_tgts),
|
||||
$(_dir)/$(b).meta_module ::
|
||||
mkdir -p $$(dir $$@)
|
||||
echo $(_dir)/$(1).meta_lic >> $$@
|
||||
|
@ -593,31 +595,46 @@ $(_dir)/$(b).meta_module ::
|
|||
)
|
||||
$(_dir)/$(1).meta_lic: PRIVATE_KINDS := $(sort $(ALL_MODULES.$(1).LICENSE_KINDS))
|
||||
$(_dir)/$(1).meta_lic: PRIVATE_CONDITIONS := $(sort $(ALL_MODULES.$(1).LICENSE_CONDITIONS))
|
||||
$(_dir)/$(1).meta_lic: PRIVATE_NOTICES := $(sort $(ALL_MODULES.$(1).NOTICES))
|
||||
$(_dir)/$(1).meta_lic: PRIVATE_NOTICES := $(_notices)
|
||||
$(_dir)/$(1).meta_lic: PRIVATE_NOTICE_DEPS := $(_deps)
|
||||
$(_dir)/$(1).meta_lic: PRIVATE_TARGETS := $(sort $(ALL_MODULES.$(1).BUILT) $(ALL_MODULES.$(1).INSTALLED))
|
||||
$(_dir)/$(1).meta_lic: PRIVATE_IS_CONTAINER := $(sort $(ALL_MODULES.$(1).IS_CONTAINER))
|
||||
$(_dir)/$(1).meta_lic: PRIVATE_PACKAGE_NAME := $(ALL_MODULES.$(1).LICENSE_PACKAGE_NAME)
|
||||
$(_dir)/$(1).meta_lic: PRIVATE_TARGETS := $(_tgts)
|
||||
$(_dir)/$(1).meta_lic: PRIVATE_IS_CONTAINER := $(ALL_MODULES.$(1).IS_CONTAINER)
|
||||
$(_dir)/$(1).meta_lic: PRIVATE_PACKAGE_NAME := $(strip $(ALL_MODULES.$(1).LICENSE_PACKAGE_NAME))
|
||||
$(_dir)/$(1).meta_lic: PRIVATE_INSTALL_MAP := $(sort $(ALL_MODULES.$(1).LICENSE_INSTALL_MAP))
|
||||
$(_dir)/$(1).meta_lic : $(_deps) $(ALL_MODULES.$(1).NOTICES) $(foreach b,$(sort $(ALL_MODULES.$(1).BUILT) $(ALL_MODULES.$(1).INSTALLED)), $(_dir)/$(b).meta_module) build/make/tools/build-license-metadata.sh
|
||||
$(_dir)/$(1).meta_lic : $(_deps) $(_notices) $(foreach b,$(_tgts), $(_dir)/$(b).meta_module) build/make/tools/build-license-metadata.sh
|
||||
rm -f $$@
|
||||
mkdir -p $$(dir $$@)
|
||||
build/make/tools/build-license-metadata.sh -k $$(PRIVATE_KINDS) -c $$(PRIVATE_CONDITIONS) -n $$(PRIVATE_NOTICES) -d $$(PRIVATE_NOTICE_DEPS) -m $$(PRIVATE_INSTALL_MAP) -t $$(PRIVATE_TARGETS) $$(if $$(filter-out false,$$(PRIVATE_IS_CONTAINER)),-is_container) -p $$(PRIVATE_PACKAGE_NAME) -o $$@
|
||||
|
||||
$(1) : $(_dir)/$(1).meta_lic
|
||||
|
||||
$(if $(ALL_MODULES.$(1).INSTALLED_NOTICE_FILE),$(ALL_MODULES.$(1).INSTALLED_NOTICE_FILE) : $(_dir)/$(1).meta_lic)
|
||||
build/make/tools/build-license-metadata.sh -k $$(PRIVATE_KINDS) -c $$(PRIVATE_CONDITIONS) -n $$(PRIVATE_NOTICES) -d $$(PRIVATE_NOTICE_DEPS) -m $$(PRIVATE_INSTALL_MAP) -t $$(PRIVATE_TARGETS) $$(if $$(PRIVATE_IS_CONTAINER),-is_container) -p $$(PRIVATE_PACKAGE_NAME) -o $$@
|
||||
|
||||
.PHONY: $(1).meta_lic
|
||||
$(1).meta_lic : $(_dir)/$(1).meta_lic
|
||||
|
||||
$(strip $(eval _mifs := $(sort $(ALL_MODULES.$(1).MODULE_INSTALLED_FILENAMES))))
|
||||
$(strip $(eval _infs := $(sort $(ALL_MODULES.$(1).INSTALLED_NOTICE_FILE))))
|
||||
|
||||
# Emit each installed notice file rule if it references the current module
|
||||
$(if $(_infs),$(foreach inf,$(_infs),
|
||||
$(if $(strip $(filter $(1),$(INSTALLED_NOTICE_FILES.$(inf).MODULE))),
|
||||
$(strip $(eval _mif := $(firstword $(foreach m,$(_mifs),$(if $(filter %/src/$(m).txt,$(inf)),$(m))))))
|
||||
|
||||
$(inf) : $(_dir)/$(1).meta_lic
|
||||
$(inf): PRIVATE_INSTALLED_MODULE := $(_mif)
|
||||
$(inf) : PRIVATE_NOTICES := $(_notices)
|
||||
|
||||
$(inf): $(_notices)
|
||||
@echo Notice file: $$< -- $$@
|
||||
mkdir -p $$(dir $$@)
|
||||
awk 'FNR==1 && NR > 1 {print "\n"} {print}' $$(PRIVATE_NOTICES) > $$@
|
||||
|
||||
)))
|
||||
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## Declares a license metadata build rule for ALL_MODULES
|
||||
###########################################################
|
||||
define build-license-metadata
|
||||
$(foreach m,$(ALL_MODULES),$(eval $(call license-metadata-rule,$(m))))
|
||||
$(foreach m,$(sort $(ALL_MODULES)),$(eval $(call license-metadata-rule,$(m))))
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
|
|
|
@ -80,7 +80,7 @@ endif
|
|||
ifeq (true,$(is_container))
|
||||
# Include shared libraries' notices for "container" types, but not for binaries etc.
|
||||
notice_deps := \
|
||||
$(sort \
|
||||
$(strip \
|
||||
$(LOCAL_REQUIRED_MODULES) \
|
||||
$(LOCAL_STATIC_LIBRARIES) \
|
||||
$(LOCAL_WHOLE_STATIC_LIBRARIES) \
|
||||
|
@ -95,7 +95,7 @@ notice_deps := \
|
|||
)
|
||||
else
|
||||
notice_deps := \
|
||||
$(sort \
|
||||
$(strip \
|
||||
$(LOCAL_REQUIRED_MODULES) \
|
||||
$(LOCAL_STATIC_LIBRARIES) \
|
||||
$(LOCAL_WHOLE_STATIC_LIBRARIES) \
|
||||
|
@ -106,24 +106,24 @@ notice_deps := \
|
|||
)
|
||||
endif
|
||||
ifeq ($(LOCAL_IS_HOST_MODULE),true)
|
||||
notice_deps := $(sort $(notice_deps) $(LOCAL_HOST_REQUIRED_MODULES))
|
||||
notice_deps := $(strip $(notice_deps) $(LOCAL_HOST_REQUIRED_MODULES))
|
||||
else
|
||||
notice_deps := $(sort $(notice_deps) $(LOCAL_TARGET_REQUIRED_MODULES))
|
||||
notice_deps := $(strip $(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))
|
||||
ALL_MODULES.$(my_register_name).LICENSE_KINDS := $(ALL_MODULES.$(my_register_name).LICENSE_KINDS) $(license_kinds)
|
||||
ALL_MODULES.$(my_register_name).LICENSE_CONDITIONS := $(ALL_MODULES.$(my_register_name).LICENSE_CONDITIONS) $(license_conditions)
|
||||
ALL_MODULES.$(my_register_name).LICENSE_INSTALL_MAP := $(ALL_MODULES.$(my_register_name).LICENSE_INSTALL_MAP) $(install_map)
|
||||
ALL_MODULES.$(my_register_name).NOTICE_DEPS := $(ALL_MODULES.$(my_register_name).NOTICE_DEPS) $(notice_deps)
|
||||
ALL_MODULES.$(my_register_name).IS_CONTAINER := $(strip $(filter-out false,$(ALL_MODULES.$(my_register_name).IS_CONTAINER) $(is_container)))
|
||||
endif
|
||||
|
||||
ifdef notice_file
|
||||
|
||||
ifdef my_register_name
|
||||
ALL_MODULES.$(my_register_name).NOTICES := $(sort $(ALL_MODULES.$(my_register_name).NOTICES) $(notice_file))
|
||||
ALL_MODULES.$(my_register_name).NOTICES := $(ALL_MODULES.$(my_register_name).NOTICES) $(notice_file)
|
||||
endif
|
||||
|
||||
# This relies on the name of the directory in PRODUCT_OUT matching where
|
||||
|
@ -179,9 +179,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
|
||||
|
||||
ALL_MODULES.$(my_register_name).INSTALLED_NOTICE_FILE := $(ALL_MODULES.$(my_register_name).INSTALLED_NOTICE_FILE) $(installed_notice_file)
|
||||
ALL_MODULES.$(my_register_name).MODULE_INSTALLED_FILENAMES := $(ALL_MODULES.$(my_register_name).MODULE_INSTALLED_FILENAMES) $(module_installed_filename)
|
||||
INSTALLED_NOTICE_FILES.$(installed_notice_file).MODULE := $(my_register_name)
|
||||
else
|
||||
$(installed_notice_file): PRIVATE_INSTALLED_MODULE := $(module_installed_filename)
|
||||
$(installed_notice_file) : PRIVATE_NOTICES := $(notice_file)
|
||||
|
||||
|
@ -189,6 +190,7 @@ $(installed_notice_file): $(notice_file)
|
|||
@echo Notice file: $< -- $@
|
||||
$(hide) mkdir -p $(dir $@)
|
||||
$(hide) awk 'FNR==1 && NR > 1 {print "\n"} {print}' $(PRIVATE_NOTICES) > $@
|
||||
endif
|
||||
|
||||
ifdef LOCAL_INSTALLED_MODULE
|
||||
# Make LOCAL_INSTALLED_MODULE depend on NOTICE files if they exist
|
||||
|
|
Loading…
Reference in a new issue