Merge "Revert "Revert "Revert "Revert "Create lists of projects to share per dist target""""" am: 6f30351970
am: 7660d6a3a7
Original change: https://android-review.googlesource.com/c/platform/build/+/2124807 Change-Id: I0b6ebdce2ed8243bfed7c7ef1f19e37ceebaf367 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
67fa5b53f4
3 changed files with 121 additions and 13 deletions
|
@ -573,16 +573,21 @@ define license-metadata-dir
|
|||
$(call generated-sources-dir-for,META,lic,)
|
||||
endef
|
||||
|
||||
TARGETS_MISSING_LICENSE_METADATA:=
|
||||
|
||||
###########################################################
|
||||
# License metadata targets corresponding to targets in $(1)
|
||||
###########################################################
|
||||
define corresponding-license-metadata
|
||||
$(strip $(foreach target, $(sort $(1)), \
|
||||
$(strip $(filter-out 0p,$(foreach target, $(sort $(1)), \
|
||||
$(if $(strip $(ALL_MODULES.$(target).META_LIC)), \
|
||||
$(ALL_MODULES.$(target).META_LIC), \
|
||||
$(if $(strip $(ALL_TARGETS.$(target).META_LIC)), \
|
||||
$(ALL_TARGETS.$(target).META_LIC), \
|
||||
$(call append-path,$(call license-metadata-dir),$(patsubst $(OUT_DIR)%,out%,$(target).meta_lic))))))
|
||||
$(eval TARGETS_MISSING_LICENSE_METADATA += $(target)) \
|
||||
) \
|
||||
) \
|
||||
)))
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
|
@ -751,7 +756,7 @@ $(_meta): PRIVATE_DEST_TARGET := $(1)
|
|||
$(_meta): PRIVATE_SOURCE_TARGETS := $(ALL_COPIED_TARGETS.$(1).SOURCES)
|
||||
$(_meta): PRIVATE_SOURCE_METADATA := $(_dep)
|
||||
$(_meta): PRIVATE_ARGUMENT_FILE := $(call intermediates-dir-for,PACKAGING,copynotice)/$(_meta)/arguments
|
||||
$(_meta) : $(_dep)
|
||||
$(_meta) : $(_dep) $(COPY_LICENSE_METADATA)
|
||||
rm -f $$@
|
||||
mkdir -p $$(dir $$@)
|
||||
mkdir -p $$(dir $$(PRIVATE_ARGUMENT_FILE))
|
||||
|
@ -780,6 +785,7 @@ define declare-license-metadata
|
|||
$(strip \
|
||||
$(eval _tgt := $(subst //,/,$(strip $(1)))) \
|
||||
$(eval ALL_NON_MODULES += $(_tgt)) \
|
||||
$(eval ALL_TARGETS.$(_tgt).META_LIC := $(call license-metadata-dir)/$(patsubst $(OUT_DIR)%,out%,$(_tgt)).meta_lic) \
|
||||
$(eval ALL_NON_MODULES.$(_tgt).LICENSE_KINDS := $(strip $(2))) \
|
||||
$(eval ALL_NON_MODULES.$(_tgt).LICENSE_CONDITIONS := $(strip $(3))) \
|
||||
$(eval ALL_NON_MODULES.$(_tgt).NOTICES := $(strip $(4))) \
|
||||
|
@ -820,6 +826,7 @@ define declare-container-license-metadata
|
|||
$(strip \
|
||||
$(eval _tgt := $(subst //,/,$(strip $(1)))) \
|
||||
$(eval ALL_NON_MODULES += $(_tgt)) \
|
||||
$(eval ALL_TARGETS.$(_tgt).META_LIC := $(call license-metadata-dir)/$(patsubst $(OUT_DIR)%,out%,$(_tgt)).meta_lic) \
|
||||
$(eval ALL_NON_MODULES.$(_tgt).LICENSE_KINDS := $(strip $(2))) \
|
||||
$(eval ALL_NON_MODULES.$(_tgt).LICENSE_CONDITIONS := $(strip $(3))) \
|
||||
$(eval ALL_NON_MODULES.$(_tgt).NOTICES := $(strip $(4))) \
|
||||
|
@ -892,6 +899,7 @@ define declare-license-deps
|
|||
$(strip \
|
||||
$(eval _tgt := $(strip $(1))) \
|
||||
$(eval ALL_NON_MODULES += $(_tgt)) \
|
||||
$(eval ALL_TARGETS.$(_tgt).META_LIC := $(call license-metadata-dir)/$(patsubst $(OUT_DIR)%,out%,$(_tgt)).meta_lic) \
|
||||
$(eval ALL_NON_MODULES.$(_tgt).DEPENDENCIES := $(strip $(ALL_NON_MODULES.$(_tgt).DEPENDENCIES) $(2))) \
|
||||
)
|
||||
endef
|
||||
|
@ -908,6 +916,7 @@ define declare-container-license-deps
|
|||
$(strip \
|
||||
$(eval _tgt := $(strip $(1))) \
|
||||
$(eval ALL_NON_MODULES += $(_tgt)) \
|
||||
$(eval ALL_TARGETS.$(_tgt).META_LIC := $(call license-metadata-dir)/$(patsubst $(OUT_DIR)%,out%,$(_tgt)).meta_lic) \
|
||||
$(eval ALL_NON_MODULES.$(_tgt).DEPENDENCIES := $(strip $(ALL_NON_MODULES.$(_tgt).DEPENDENCIES) $(2))) \
|
||||
$(eval ALL_NON_MODULES.$(_tgt).IS_CONTAINER := true) \
|
||||
$(eval ALL_NON_MODULES.$(_tgt).ROOT_MAPPINGS := $(strip $(ALL_NON_MODULES.$(_tgt).ROOT_MAPPINGS) $(3))) \
|
||||
|
@ -919,12 +928,14 @@ endef
|
|||
###########################################################
|
||||
define report-missing-licenses-rule
|
||||
.PHONY: reportmissinglicenses
|
||||
reportmissinglicenses: PRIVATE_NON_MODULES:=$(sort $(NON_MODULES_WITHOUT_LICENSE_METADATA))
|
||||
reportmissinglicenses: PRIVATE_COPIED_FILES:=$(sort $(filter $(NON_MODULES_WITHOUT_LICENSE_METADATA),$(foreach _pair,$(PRODUCT_COPY_FILES), $(PRODUCT_OUT)/$(call word-colon,2,$(_pair)))))
|
||||
reportmissinglicenses: PRIVATE_NON_MODULES:=$(sort $(NON_MODULES_WITHOUT_LICENSE_METADATA) $(TARGETS_MISSING_LICENSE_METADATA))
|
||||
reportmissinglicenses: PRIVATE_COPIED_FILES:=$(sort $(filter $(NON_MODULES_WITHOUT_LICENSE_METADATA) $(TARGETS_MISSING_LICENSE_METADATA),\
|
||||
$(foreach _pair,$(PRODUCT_COPY_FILES), $(PRODUCT_OUT)/$(call word-colon,2,$(_pair)))))
|
||||
reportmissinglicenses:
|
||||
@echo Reporting $$(words $$(PRIVATE_NON_MODULES)) targets without license metadata
|
||||
$$(foreach t,$$(PRIVATE_NON_MODULES),if ! [ -h $$(t) ]; then echo No license metadata for $$(t) >&2; fi;)
|
||||
$$(foreach t,$$(PRIVATE_COPIED_FILES),if ! [ -h $$(t) ]; then echo No license metadata for copied file $$(t) >&2; fi;)
|
||||
echo $$(words $$(PRIVATE_NON_MODULES)) targets missing license metadata >&2
|
||||
|
||||
endef
|
||||
|
||||
|
@ -977,15 +988,9 @@ $(strip \
|
|||
$(foreach t,$(sort $(ALL_0P_TARGETS)), \
|
||||
$(eval ALL_TARGETS.$(t).META_LIC := 0p) \
|
||||
) \
|
||||
$(foreach t,$(sort $(ALL_NON_MODULES)), \
|
||||
$(eval ALL_TARGETS.$(t).META_LIC := $(call append-path,$(_dir),$(patsubst $(OUT_DIR)%,out%,$(t).meta_lic))) \
|
||||
) \
|
||||
$(foreach t,$(sort $(ALL_NON_MODULES)),$(eval $(call non-module-license-metadata-rule,$(t)))) \
|
||||
$(foreach m,$(sort $(ALL_MODULES)),$(eval $(call license-metadata-rule,$(m)))) \
|
||||
$(foreach t,$(sort $(ALL_COPIED_TARGETS)),$(eval $(call copied-target-license-metadata-rule,$(t)))) \
|
||||
$(foreach t,$(sort $(ALL_NON_MODULES)),$(call record-missing-non-module-dependencies,$(t))) \
|
||||
$(eval $(call report-missing-licenses-rule)) \
|
||||
$(eval $(call report-all-notice-library-names-rule)) \
|
||||
$(eval $(call build-all-license-metadata-rule)))
|
||||
endef
|
||||
|
||||
|
@ -1057,6 +1062,22 @@ $(strip \
|
|||
)
|
||||
endef
|
||||
|
||||
# Uses LOCAL_MODULE_CLASS, LOCAL_MODULE, and LOCAL_IS_HOST_MODULE
|
||||
# to determine the intermediates directory.
|
||||
#
|
||||
# $(1): if non-empty, force the intermediates to be COMMON
|
||||
# $(2): if non-empty, force the intermediates to be for the 2nd arch
|
||||
# $(3): if non-empty, force the intermediates to be for the host cross os
|
||||
define local-meta-intermediates-dir
|
||||
$(strip \
|
||||
$(if $(strip $(LOCAL_MODULE_CLASS)),, \
|
||||
$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined before call to local-meta-intermediates-dir)) \
|
||||
$(if $(strip $(LOCAL_MODULE)),, \
|
||||
$(error $(LOCAL_PATH): LOCAL_MODULE not defined before call to local-meta-intermediates-dir)) \
|
||||
$(call intermediates-dir-for,META$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(if $(strip $(LOCAL_IS_HOST_MODULE)),HOST),$(1),$(2),$(3)) \
|
||||
)
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## The generated sources directory. Placing generated
|
||||
## source files directly in the intermediates directory
|
||||
|
@ -2476,7 +2497,47 @@ define dump-words-to-file
|
|||
@$(call emit-line,$(wordlist 38001,38500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 38501,39000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 39001,39500,$(1)),$(2))
|
||||
@$(if $(wordlist 39501,39502,$(1)),$(error Too many words ($(words $(1)))))
|
||||
@$(call emit-line,$(wordlist 39501,40000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 40001,40500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 40501,41000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 41001,41500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 41501,42000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 42001,42500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 42501,43000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 43001,43500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 43501,44000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 44001,44500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 44501,45000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 45001,45500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 45501,46000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 46001,46500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 46501,47000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 47001,47500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 47501,48000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 48001,48500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 48501,49000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 49001,49500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 49501,50000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 50001,50500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 50501,51000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 51001,51500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 51501,52000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 52001,52500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 52501,53000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 53001,53500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 53501,54000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 54001,54500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 54501,55000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 55001,55500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 55501,56000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 56001,56500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 56501,57000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 57001,57500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 57501,58000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 58001,58500,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 58501,59000,$(1)),$(2))
|
||||
@$(call emit-line,$(wordlist 59001,59500,$(1)),$(2))
|
||||
@$(if $(wordlist 59501,59502,$(1)),$(error Too many words ($(words $(1)))))
|
||||
endef
|
||||
# Return jar arguments to compress files in a given directory
|
||||
# $(1): directory
|
||||
|
|
|
@ -45,6 +45,44 @@ $(foreach file,$(2), \
|
|||
$(eval _all_dist_goal_output_pairs += $$(goal):$$(dst))))
|
||||
endef
|
||||
|
||||
.PHONY: shareprojects
|
||||
#shareprojects:
|
||||
|
||||
define __share-projects-rule
|
||||
$(1) : PRIVATE_TARGETS := $(2)
|
||||
$(1) : PRIVATE_ARGUMENT_FILE := $(call intermediates-dir-for,PACKAGING,codesharing)/$(1)/arguments
|
||||
$(1): $(2) $(COMPLIANCE_LISTSHARE)
|
||||
$(hide) rm -f $$@
|
||||
mkdir -p $$(dir $$@)
|
||||
mkdir -p $$(dir $$(PRIVATE_ARGUMENT_FILE))
|
||||
$$(if $$(strip $$(PRIVATE_TARGETS)),$$(call dump-words-to-file,$$(PRIVATE_TARGETS),$$(PRIVATE_ARGUMENT_FILE)))
|
||||
$$(if $$(strip $$(PRIVATE_TARGETS)),OUT_DIR=$(OUT_DIR) $(COMPLIANCE_LISTSHARE) -o $$@ @$$(PRIVATE_ARGUMENT_FILE),touch $$@)
|
||||
endef
|
||||
|
||||
# build list of projects to share in $(1) for dist targets in $(2)
|
||||
#
|
||||
# $(1): the intermediate project sharing file
|
||||
# $(2): the dist files to base the sharing on
|
||||
define _share-projects-rule
|
||||
$(eval $(call __share-projects-rule,$(1),$(call corresponding-license-metadata,$(2))))
|
||||
endef
|
||||
|
||||
define _add_projects_to_share
|
||||
$(strip $(eval _idir := $(call intermediates-dir-for,PACKAGING,shareprojects))) \
|
||||
$(strip $(eval _goals := $(sort $(_all_dist_goals)))) \
|
||||
$(strip $(eval _opairs := $(sort $(_all_dist_goal_output_pairs)))) \
|
||||
$(strip $(eval _dpairs := $(sort $(_all_dist_src_dst_pairs)))) \
|
||||
$(strip $(eval _allt :=)) \
|
||||
$(foreach goal,$(_goals), \
|
||||
$(eval _f := $(_idir)/$(goal).shareprojects) \
|
||||
$(call dist-for-goals,$(goal),$(_f):shareprojects/$(basename $(notdir $(_f)))) \
|
||||
$(eval _targets :=) \
|
||||
$(foreach op,$(filter $(goal):%,$(_opairs)),$(foreach p,$(filter %:$(call word-colon,2,$(op)),$(_dpairs)),$(eval _targets += $(call word-colon,1,$(p))))) \
|
||||
$(eval _allt += $(_targets)) \
|
||||
$(eval $(call _share-projects-rule,$(_f),$(_targets))) \
|
||||
)
|
||||
endef
|
||||
|
||||
#------------------------------------------------------------------
|
||||
# To be used at the end of the build to collect all the uses of
|
||||
# dist-for-goals, and write them into a file for the packaging step to use.
|
||||
|
@ -52,6 +90,15 @@ endef
|
|||
# $(1): The file to write
|
||||
define dist-write-file
|
||||
$(strip \
|
||||
$(call _add_projects_to_share)\
|
||||
$(if $(strip $(ANDROID_REQUIRE_LICENSE_METADATA)),\
|
||||
$(foreach target,$(sort $(TARGETS_MISSING_LICENSE_METADATA)),$(warning target $(target) missing license metadata))\
|
||||
$(if $(strip $(TARGETS_MISSING_LICENSE_METADATA)),\
|
||||
$(if $(filter true error,$(ANDROID_REQUIRE_LICENSE_METADATA)),\
|
||||
$(error $(words $(sort $(TARGETS_MISSING_LICENSE_METADATA))) targets need license metadata))))\
|
||||
$(foreach t,$(sort $(ALL_NON_MODULES)),$(call record-missing-non-module-dependencies,$(t))) \
|
||||
$(eval $(call report-missing-licenses-rule)) \
|
||||
$(eval $(call report-all-notice-library-names-rule)) \
|
||||
$(KATI_obsolete_var dist-for-goals,Cannot be used after dist-write-file) \
|
||||
$(foreach goal,$(sort $(_all_dist_goals)), \
|
||||
$(eval $$(goal): _dist_$$(goal))) \
|
||||
|
|
|
@ -125,7 +125,7 @@ local_path := $(LOCAL_PATH)
|
|||
module_license_metadata :=
|
||||
|
||||
ifdef my_register_name
|
||||
module_license_metadata := $(call local-intermediates-dir)/$(my_register_name).meta_lic
|
||||
module_license_metadata := $(call local-meta-intermediates-dir)/$(my_register_name).meta_lic
|
||||
|
||||
$(foreach target,$(ALL_MODULES.$(my_register_name).BUILT) $(ALL_MODULES.$(my_register_name).INSTALLED) $(foreach bi,$(LOCAL_SOONG_BUILT_INSTALLED),$(call word-colon,1,$(bi))) \
|
||||
$(my_test_data) $(my_test_config),\
|
||||
|
|
Loading…
Reference in a new issue