aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Badour <bbadour@google.com>2022-06-13 19:32:53 +0000
committerBob Badour <bbadour@google.com>2022-06-13 21:03:40 +0000
commit79605357390e65945ae3ed5e5aa12789093591e7 (patch)
treede6cca0ec5b70835966444e353cae439c043cfba
parent29d723fb4ace78d6ad8c2a234222b5792479f2fa (diff)
downloadbuild-79605357390e65945ae3ed5e5aa12789093591e7.tar.gz
Revert "Create lists of projects to share per dist target"
Revert submission 18821068 Reason for revert: Advised to switch to using TARGET_BUILD_APPS Reverted Changes: Ibd737c0dd:Record license text for every dist target. Ibf5a9869d:Create lists of projects to share per dist target Change-Id: I4a2c7b3c74b446ce3748217be30da70c060da0dd Merged-in: If56a1fceb5da66b90b7b0ec2275ec429661515b4
-rw-r--r--core/definitions.mk137
-rw-r--r--core/distdir.mk59
-rw-r--r--core/notice_files.mk2
3 files changed, 11 insertions, 187 deletions
diff --git a/core/definitions.mk b/core/definitions.mk
index 84860f9fa4..0c46de9fc6 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -570,21 +570,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
###########################################################
@@ -710,60 +705,6 @@ $(_meta) : $(foreach d,$(_deps),$(call word-colon,1,$(d))) $(foreach n,$(_notice
endef
###########################################################
-## Record missing dependencies for non-module target $(1)
-###########################################################
-define record-missing-non-module-dependencies
-$(strip $(eval _tgt := $(strip $(1))))
-$(strip $(foreach d,$(strip $(ALL_NON_MODULES.$(_tgt).DEPENDENCIES)), \
- $(if $(strip $(ALL_TARGETS.$(d).META_LIC)), \
- , \
- $(eval NON_MODULES_WITHOUT_LICENSE_METADATA += $(d))) \
-))
-endef
-
-###########################################################
-## License metadata build rule for copied target $(1)
-###########################################################
-define copied-target-license-metadata-rule
-$(if $(strip $(ALL_TARGETS.$(1).META_LIC)),,$(call _copied-target-license-metadata-rule,$(1)))
-endef
-
-define _copied-target-license-metadata-rule
-$(strip $(eval _dir := $(call license-metadata-dir)))
-$(strip $(eval _meta := $(call append-path,$(_dir),$(patsubst $(OUT_DIR)%,out%,$(1).meta_lic))))
-$(strip $(eval ALL_TARGETS.$(1).META_LIC:=$(_meta)))
-$(strip $(eval _dep:=))
-$(strip $(foreach s,$(ALL_COPIED_TARGETS.$(1).SOURCES),\
- $(eval _dmeta:=$(ALL_TARGETS.$(s).META_LIC))\
- $(if $(filter 0p,$(_dmeta)),\
- $(if $(filter-out 0p,$(_dep)),,$(eval ALL_TARGETS.$(1).META_LIC:=0p)),\
- $(if $(_dep),\
- $(if $(filter-out $(_dep),$(_dmeta)),$(error cannot copy target from multiple modules: $(1) from $(_dep) and $(_dmeta))),
- $(eval _dep:=$(_dmeta))))))
-$(strip $(if $(strip $(_dep)),,$(error cannot copy target from unknown module: $(1) from $(ALL_COPIED_TARGETS.$(1).SOURCES))))
-
-ifneq (0p,$(ALL_TARGETS.$(1).META_LIC))
-$(_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)
- rm -f $$@
- mkdir -p $$(dir $$@)
- mkdir -p $$(dir $$(PRIVATE_ARGUMENT_FILE))
- $$(call dump-words-to-file,\
- $$(addprefix -i ,$$(PRIVATE_DEST_TARGET))\
- $$(addprefix -s ,$$(PRIVATE_SOURCE_TARGETS))\
- $$(addprefix -d ,$$(PRIVATE_SOURCE_METADATA)),\
- $$(PRIVATE_ARGUMENT_FILE))
- OUT_DIR=$(OUT_DIR) $(COPY_LICENSE_METADATA) \
- @$$(PRIVATE_ARGUMENT_FILE) \
- -o $$@
-
-endif
-endef
-
-###########################################################
## Declare the license metadata for non-module target $(1).
##
## $(2) -- license kinds e.g. SPDX-license-identifier-Apache-2.0
@@ -776,7 +717,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))) \
@@ -817,7 +757,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))) \
@@ -890,7 +829,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
@@ -907,7 +845,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))) \
@@ -919,14 +856,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
@@ -979,9 +914,13 @@ $(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)))) \
+ $(eval $(call report-missing-licenses-rule)) \
+ $(eval $(call report-all-notice-library-names-rule)) \
$(eval $(call build-all-license-metadata-rule)))
endef
@@ -1053,22 +992,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
@@ -2488,47 +2411,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
diff --git a/core/distdir.mk b/core/distdir.mk
index 0edeffdf4b..aad8ff3d65 100644
--- a/core/distdir.mk
+++ b/core/distdir.mk
@@ -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))) \
diff --git a/core/notice_files.mk b/core/notice_files.mk
index 4b67404fd2..c05d4ea0be 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -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) $(my_test_data) $(my_test_config),\
$(eval ALL_TARGETS.$(target).META_LIC := $(module_license_metadata)))