aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2022-06-10 23:51:22 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-06-10 23:51:22 +0000
commit997ecb87e45c6da1497f8ae41a82f1c9a80d5501 (patch)
tree250c243ad3f2e7428b11bd118b109254cb4aff37
parenta5b3e290e3a017ec431da3ed4003df22ec61b5c6 (diff)
parent52a972709d4f2525255f611cf8b24e7cd0fa1e30 (diff)
downloadbuild-997ecb87e45c6da1497f8ae41a82f1c9a80d5501.tar.gz
Merge changes Ibd737c0d,Ibf5a9869 into tm-dev am: 52a972709d
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/+/18821068 Change-Id: Ic030419bd3ced1960eb1d22bfd24bfea25291da9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--core/distdir.mk57
1 files changed, 53 insertions, 4 deletions
diff --git a/core/distdir.mk b/core/distdir.mk
index 0edeffdf4b..3d48a484a5 100644
--- a/core/distdir.mk
+++ b/core/distdir.mk
@@ -46,11 +46,10 @@ $(foreach file,$(2), \
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) : PRIVATE_ARGUMENT_FILE := $(call intermediates-dir-for,METAPACKAGING,codesharing)/$(1)/arguments
$(1): $(2) $(COMPLIANCE_LISTSHARE)
$(hide) rm -f $$@
mkdir -p $$(dir $$@)
@@ -75,24 +74,74 @@ define _share-projects-dep
$(1): $(2)
endef
+.PHONY: alllicensetexts
+
+define __license-texts-rule
+$(2) : PRIVATE_GOAL := $(1)
+$(2) : PRIVATE_TARGETS := $(3)
+$(2) : PRIVATE_ROOTS := $(4)
+$(2) : PRIVATE_ARGUMENT_FILE := $(call intermediates-dir-for,METAPACKAGING,licensetexts)/$(2)/arguments
+$(2): $(3) $(TEXTNOTICE)
+ $(hide) rm -f $$@
+ mkdir -p $$(dir $$@)
+ mkdir -p $$(dir $$(PRIVATE_ARGUMENT_FILE))
+ $$(if $$(strip $$(PRIVATE_TARGETS)),$$(call dump-words-to-file,\
+ -product="$$(PRIVATE_GOAL)" -title="$$(PRIVATE_GOAL)" \
+ $$(addprefix -strip_prefix ,$$(PRIVATE_ROOTS)) \
+ -strip_prefix=$(PRODUCT_OUT)/ -strip_prefix=$(HOST_OUT)/\
+ $$(PRIVATE_TARGETS),\
+ $$(PRIVATE_ARGUMENT_FILE)))
+ $$(if $$(strip $$(PRIVATE_TARGETS)),OUT_DIR=$(OUT_DIR) $(TEXTNOTICE) -o $$@ @$$(PRIVATE_ARGUMENT_FILE),touch $$@)
+endef
+
+# build list of projects to share in $(2) for dist targets in $(3) for dist goal $(1)
+#
+# $(1): the name of the dist goal
+# $(2): the intermediate project sharing file
+# $(3): the dist files to base the sharing on
+define _license-texts-rule
+$(eval $(call __license-texts-rule,$(1),$(2),$(call corresponding-license-metadata,$(3)),$(sort $(dir $(3)))))
+endef
+
+# Add a build dependency
+#
+# $(1): the goal phony target
+# $(2): the intermediate shareprojects file
+define _license-texts-dep
+$(1): $(2)
+endef
+
define _add_projects_to_share
-$(strip $(eval _idir := $(call intermediates-dir-for,PACKAGING,shareprojects))) \
+$(strip $(eval _idir := $(call intermediates-dir-for,METAPACKAGING,shareprojects))) \
+$(strip $(eval _tdir := $(call intermediates-dir-for,METAPACKAGING,licensetexts))) \
$(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) \
+ $(eval _n := $(_tdir)/$(goal).txt) \
$(call dist-for-goals,$(goal),$(_f):shareprojects/$(basename $(notdir $(_f)))) \
+ $(call dist-for-goals,$(goal),$(_n):licensetexts/$(basename $(notdir $(_n)))) \
$(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 $(call _license-texts-rule,$(goal),$(_n),$(_targets))) \
)\
$(eval _f := $(_idir)/all.shareprojects)\
+$(eval _n := $(_tdir)/all.txt)\
+$(eval _idir :=)\
+$(eval _tdir :=)\
$(eval $(call _share-projects-dep,shareprojects,$(_f))) \
+$(eval $(call _license-texts-dep,alllicensetexts,$(_n))) \
$(call dist-for-goals,droid shareprojects,$(_f):shareprojects/all)\
-$(eval $(call _share-projects-rule,$(_f),$(sort $(_allt))))
+$(call dist-for-goals,droid alllicensetexts,$(_n):licensetexts/all)\
+$(eval _allt := $(sort $(_allt)))\
+$(eval $(call _share-projects-rule,$(_f),$(_allt)))\
+$(eval $(call _license-texts-rule,droid,$(_n),$(_allt)))\
+$(eval _f :=)\
+$(evan _n :=)
endef
#------------------------------------------------------------------