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 Change-Id: Ib6c610960347db84503831b1e1519622696d4500 Merged-in: Ib6c610960347db84503831b1e1519622696d4500
This commit is contained in:
parent
6be34750a3
commit
3412a07822
|
@ -556,7 +556,7 @@ $(strip \
|
||||||
$(foreach m, $(ALL_MODULES), \
|
$(foreach m, $(ALL_MODULES), \
|
||||||
$(eval ALL_MODULES.$(m).NOTICE_DEPS := \
|
$(eval ALL_MODULES.$(m).NOTICE_DEPS := \
|
||||||
$(sort \
|
$(sort \
|
||||||
$(foreach d,$(ALL_MODULES.$(m).NOTICE_DEPS), \
|
$(foreach d,$(sort $(ALL_MODULES.$(m).NOTICE_DEPS)), \
|
||||||
$(_lookup.$(d)) \
|
$(_lookup.$(d)) \
|
||||||
) \
|
) \
|
||||||
) \
|
) \
|
||||||
|
@ -578,7 +578,9 @@ endef
|
||||||
define license-metadata-rule
|
define license-metadata-rule
|
||||||
$(strip $(eval _dir := $(call license-metadata-dir)))
|
$(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)))))
|
$(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 ::
|
$(_dir)/$(b).meta_module ::
|
||||||
mkdir -p $$(dir $$@)
|
mkdir -p $$(dir $$@)
|
||||||
echo $(_dir)/$(1).meta_lic >> $$@
|
echo $(_dir)/$(1).meta_lic >> $$@
|
||||||
|
@ -587,29 +589,46 @@ $(_dir)/$(b).meta_module ::
|
||||||
)
|
)
|
||||||
$(_dir)/$(1).meta_lic: PRIVATE_KINDS := $(sort $(ALL_MODULES.$(1).LICENSE_KINDS))
|
$(_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_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_NOTICE_DEPS := $(_deps)
|
||||||
$(_dir)/$(1).meta_lic: PRIVATE_TARGETS := $(sort $(ALL_MODULES.$(1).BUILT) $(ALL_MODULES.$(1).INSTALLED))
|
$(_dir)/$(1).meta_lic: PRIVATE_TARGETS := $(_tgts)
|
||||||
$(_dir)/$(1).meta_lic: PRIVATE_IS_CONTAINER := $(sort $(ALL_MODULES.$(1).IS_CONTAINER))
|
$(_dir)/$(1).meta_lic: PRIVATE_IS_CONTAINER := $(ALL_MODULES.$(1).IS_CONTAINER)
|
||||||
$(_dir)/$(1).meta_lic: PRIVATE_PACKAGE_NAME := $(ALL_MODULES.$(1).LICENSE_PACKAGE_NAME)
|
$(_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: 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 $$@
|
rm -f $$@
|
||||||
mkdir -p $$(dir $$@)
|
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 $$@
|
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 $$@
|
||||||
|
|
||||||
$(if $(ALL_MODULES.$(1).INSTALLED_NOTICE_FILE),$(ALL_MODULES.$(1).INSTALLED_NOTICE_FILE) : $(_dir)/$(1).meta_lic)
|
|
||||||
|
|
||||||
.PHONY: $(1).meta_lic
|
.PHONY: $(1).meta_lic
|
||||||
$(1).meta_lic : $(_dir)/$(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
|
endef
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
## Declares a license metadata build rule for ALL_MODULES
|
## Declares a license metadata build rule for ALL_MODULES
|
||||||
###########################################################
|
###########################################################
|
||||||
define build-license-metadata
|
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
|
endef
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
|
@ -80,7 +80,7 @@ endif
|
||||||
ifeq (true,$(is_container))
|
ifeq (true,$(is_container))
|
||||||
# Include shared libraries' notices for "container" types, but not for binaries etc.
|
# Include shared libraries' notices for "container" types, but not for binaries etc.
|
||||||
notice_deps := \
|
notice_deps := \
|
||||||
$(sort \
|
$(strip \
|
||||||
$(LOCAL_REQUIRED_MODULES) \
|
$(LOCAL_REQUIRED_MODULES) \
|
||||||
$(LOCAL_STATIC_LIBRARIES) \
|
$(LOCAL_STATIC_LIBRARIES) \
|
||||||
$(LOCAL_WHOLE_STATIC_LIBRARIES) \
|
$(LOCAL_WHOLE_STATIC_LIBRARIES) \
|
||||||
|
@ -95,7 +95,7 @@ notice_deps := \
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
notice_deps := \
|
notice_deps := \
|
||||||
$(sort \
|
$(strip \
|
||||||
$(LOCAL_REQUIRED_MODULES) \
|
$(LOCAL_REQUIRED_MODULES) \
|
||||||
$(LOCAL_STATIC_LIBRARIES) \
|
$(LOCAL_STATIC_LIBRARIES) \
|
||||||
$(LOCAL_WHOLE_STATIC_LIBRARIES) \
|
$(LOCAL_WHOLE_STATIC_LIBRARIES) \
|
||||||
|
@ -106,24 +106,24 @@ notice_deps := \
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
ifeq ($(LOCAL_IS_HOST_MODULE),true)
|
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
|
else
|
||||||
notice_deps := $(sort $(notice_deps) $(LOCAL_TARGET_REQUIRED_MODULES))
|
notice_deps := $(strip $(notice_deps) $(LOCAL_TARGET_REQUIRED_MODULES))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef my_register_name
|
ifdef my_register_name
|
||||||
ALL_MODULES.$(my_register_name).LICENSE_PACKAGE_NAME := $(strip $(license_package_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_KINDS := $(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_CONDITIONS := $(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).LICENSE_INSTALL_MAP := $(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).NOTICE_DEPS := $(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).IS_CONTAINER := $(strip $(filter-out false,$(ALL_MODULES.$(my_register_name).IS_CONTAINER) $(is_container)))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef notice_file
|
ifdef notice_file
|
||||||
|
|
||||||
ifdef my_register_name
|
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
|
endif
|
||||||
|
|
||||||
# This relies on the name of the directory in PRODUCT_OUT matching where
|
# This relies on the name of the directory in PRODUCT_OUT matching where
|
||||||
|
@ -180,9 +180,10 @@ module_installed_filename := $(patsubst $(HOST_CROSS_OUT)/%,%,$(module_installed
|
||||||
installed_notice_file := $($(my_prefix)OUT_NOTICE_FILES)/src/$(module_installed_filename).txt
|
installed_notice_file := $($(my_prefix)OUT_NOTICE_FILES)/src/$(module_installed_filename).txt
|
||||||
|
|
||||||
ifdef my_register_name
|
ifdef my_register_name
|
||||||
ALL_MODULES.$(my_register_name).INSTALLED_NOTICE_FILE := $(installed_notice_file)
|
ALL_MODULES.$(my_register_name).INSTALLED_NOTICE_FILE := $(ALL_MODULES.$(my_register_name).INSTALLED_NOTICE_FILE) $(installed_notice_file)
|
||||||
endif
|
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_INSTALLED_MODULE := $(module_installed_filename)
|
||||||
$(installed_notice_file) : PRIVATE_NOTICES := $(notice_file)
|
$(installed_notice_file) : PRIVATE_NOTICES := $(notice_file)
|
||||||
|
|
||||||
|
@ -190,6 +191,7 @@ $(installed_notice_file): $(notice_file)
|
||||||
@echo Notice file: $< -- $@
|
@echo Notice file: $< -- $@
|
||||||
$(hide) mkdir -p $(dir $@)
|
$(hide) mkdir -p $(dir $@)
|
||||||
$(hide) awk 'FNR==1 && NR > 1 {print "\n"} {print}' $(PRIVATE_NOTICES) > $@
|
$(hide) awk 'FNR==1 && NR > 1 {print "\n"} {print}' $(PRIVATE_NOTICES) > $@
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef LOCAL_INSTALLED_MODULE
|
ifdef LOCAL_INSTALLED_MODULE
|
||||||
# Make LOCAL_INSTALLED_MODULE depend on NOTICE files if they exist
|
# Make LOCAL_INSTALLED_MODULE depend on NOTICE files if they exist
|
||||||
|
|
Loading…
Reference in New Issue