Merge "Revert "Revert "Revert "Create lists of projects to share per dist target""""
This commit is contained in:
commit
6ebfaa453b
3 changed files with 13 additions and 133 deletions
|
@ -573,21 +573,16 @@ 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 $(filter-out 0p,$(foreach target, $(sort $(1)), \
|
||||
$(strip $(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), \
|
||||
$(eval TARGETS_MISSING_LICENSE_METADATA += $(target)) \
|
||||
) \
|
||||
) \
|
||||
)))
|
||||
$(call append-path,$(call license-metadata-dir),$(patsubst $(OUT_DIR)%,out%,$(target).meta_lic))))))
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
|
@ -756,7 +751,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) $(COPY_LICENSE_METADATA)
|
||||
$(_meta) : $(_dep)
|
||||
rm -f $$@
|
||||
mkdir -p $$(dir $$@)
|
||||
mkdir -p $$(dir $$(PRIVATE_ARGUMENT_FILE))
|
||||
|
@ -785,7 +780,6 @@ 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))) \
|
||||
|
@ -826,7 +820,6 @@ 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))) \
|
||||
|
@ -899,7 +892,6 @@ 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
|
||||
|
@ -916,7 +908,6 @@ 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))) \
|
||||
|
@ -928,14 +919,12 @@ endef
|
|||
###########################################################
|
||||
define report-missing-licenses-rule
|
||||
.PHONY: reportmissinglicenses
|
||||
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: 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:
|
||||
@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
|
||||
|
||||
|
@ -988,9 +977,15 @@ $(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
|
||||
|
||||
|
@ -1062,22 +1057,6 @@ $(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
|
||||
|
@ -2497,47 +2476,7 @@ 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))
|
||||
@$(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)))))
|
||||
@$(if $(wordlist 39501,39502,$(1)),$(error Too many words ($(words $(1)))))
|
||||
endef
|
||||
# Return jar arguments to compress files in a given directory
|
||||
# $(1): directory
|
||||
|
|
|
@ -45,56 +45,6 @@ $(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
|
||||
|
||||
# Add a build dependency
|
||||
#
|
||||
# $(1): the goal phony target
|
||||
# $(2): the intermediate shareprojects file
|
||||
define _share-projects-dep
|
||||
$(1): $(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))) \
|
||||
)\
|
||||
$(eval _f := $(_idir)/all.shareprojects)\
|
||||
$(eval $(call _share-projects-dep,shareprojects,$(_f))) \
|
||||
$(call dist-for-goals,droid shareprojects,$(_f):shareprojects/all)\
|
||||
$(eval $(call _share-projects-rule,$(_f),$(sort $(_allt))))
|
||||
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.
|
||||
|
@ -102,15 +52,6 @@ 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-meta-intermediates-dir)/$(my_register_name).meta_lic
|
||||
module_license_metadata := $(call local-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