From 9b75c9ee1afd333b0a9fc96ac0f5cc6e6989898f Mon Sep 17 00:00:00 2001 From: Yihan Dong Date: Wed, 7 Sep 2022 11:15:01 +0800 Subject: [PATCH] Assign each xts test package a copy license metadata Use a copy license metadata instead of module_license_metadata to make each xts test package names shown in the final xts notice file. Test: m gts reportmissinglicenses Bug: 245474938 Change-Id: Ic5e28763bc4e8448d3e04a80e89db147387164a6 --- core/definitions.mk | 6 +++--- core/notice_files.mk | 8 ++++++-- core/tasks/tools/compatibility.mk | 15 +++++++++++++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/core/definitions.mk b/core/definitions.mk index cd36011447..49ecb1c3da 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -988,9 +988,9 @@ $(strip \ $(foreach t,$(sort $(ALL_0P_TARGETS)), \ $(eval ALL_TARGETS.$(t).META_LIC := 0p) \ ) \ + $(foreach t,$(sort $(ALL_COPIED_TARGETS)),$(eval $(call copied-target-license-metadata-rule,$(t)))) \ $(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 build-all-license-metadata-rule))) endef @@ -3554,11 +3554,11 @@ define create-suite-dependencies $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \ $(eval $(if $(strip $(module_license_metadata)),\ $$(foreach f,$$(my_compat_dist_$(suite)),$$(call declare-copy-target-license-metadata,$$(call word-colon,2,$$(f)),$$(call word-colon,1,$$(f)))),\ - $$(eval my_test_data += $$(foreach f,$$(my_compat_dist_$(suite)), $$(call word-colon,2,$$(f)))) \ + $$(eval my_test_data += $$(my_compat_dist_$(suite))) \ )) \ $(eval $(if $(strip $(module_license_metadata)),\ $$(foreach f,$$(my_compat_dist_config_$(suite)),$$(call declare-copy-target-license-metadata,$$(call word-colon,2,$$(f)),$$(call word-colon,1,$$(f)))),\ - $$(eval my_test_config += $$(foreach f,$$(my_compat_dist_config_$(suite)), $$(call word-colon,2,$$(f)))) \ + $$(eval my_test_config += $$(my_compat_dist_config_$(suite))) \ )) \ $(if $(filter $(suite),$(ALL_COMPATIBILITY_SUITES)),,\ $(eval ALL_COMPATIBILITY_SUITES += $(suite)) \ diff --git a/core/notice_files.mk b/core/notice_files.mk index efc17511c0..46d737ef8e 100644 --- a/core/notice_files.mk +++ b/core/notice_files.mk @@ -127,10 +127,14 @@ module_license_metadata := ifdef my_register_name 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),\ + $(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))),\ $(eval ALL_TARGETS.$(target).META_LIC := $(module_license_metadata))) + $(foreach f,$(my_test_data) $(my_test_config),\ + $(if $(strip $(ALL_TARGETS.$(call word-colon,1,$(f)).META_LIC)), \ + $(call declare-copy-target-license-metadata,$(call word-colon,2,$(f)),$(call word-colon,1,$(f))), \ + $(eval ALL_TARGETS.$(call word-colon,2,$(f)).META_LIC := $(module_license_metadata)))) + ALL_MODULES.$(my_register_name).META_LIC := $(strip $(ALL_MODULES.$(my_register_name).META_LIC) $(module_license_metadata)) ifdef LOCAL_SOONG_LICENSE_METADATA diff --git a/core/tasks/tools/compatibility.mk b/core/tasks/tools/compatibility.mk index 4b8bd16c2e..e56e8bad5e 100644 --- a/core/tasks/tools/compatibility.mk +++ b/core/tasks/tools/compatibility.mk @@ -56,6 +56,17 @@ $(test_suite_jdk): $(SOONG_ZIP) $(call declare-license-metadata,$(test_suite_jdk),SPDX-license-identifier-GPL-2.0-with-classpath-exception,restricted,\ $(test_suite_jdk_dir)/legal/java.base/LICENSE,JDK,prebuilts/jdk/$(notdir $(patsubst %/,%,$(dir $(test_suite_jdk_dir))))) +# Copy license metadata +$(call declare-copy-target-license-metadata,$(out_dir)/$(notdir $(test_suite_jdk)),$(test_suite_jdk)) +$(foreach t,$(test_tools) $(test_suite_prebuilt_tools),\ + $(eval _dst := $(out_dir)/tools/$(notdir $(t)))\ + $(if $(strip $(ALL_TARGETS.$(t).META_LIC)),\ + $(call declare-copy-target-license-metadata,$(_dst),$(t)),\ + $(warning $(t) has no license metadata)\ + )\ +) +test_copied_tools := $(foreach t,$(test_tools) $(test_suite_prebuilt_tools), $(out_dir)/tools/$(notdir $(t))) $(out_dir)/$(notdir $(test_suite_jdk)) + # Include host shared libraries host_shared_libs := $(call copy-many-files, $(COMPATIBILITY.$(test_suite_name).HOST_SHARED_LIBRARY.FILES)) @@ -65,7 +76,7 @@ $(if $(strip $(host_shared_libs)),\ $(eval _src := $(call word-colon,1,$(p)))\ $(eval _dst := $(call word-colon,2,$(p)))\ $(if $(strip $(ALL_TARGETS.$(_src).META_LIC)),\ - $(eval ALL_TARGETS.$(_dst).META_LIC := $(ALL_TARGETS.$(_src).META_LIC)),\ + $(call declare-copy-target-license-metadata,$(_dst),$(_src)),\ $(warning $(_src) has no license metadata for $(_dst))\ )\ )\ @@ -124,7 +135,7 @@ $(compatibility_zip): $(compatibility_zip_deps) | $(ADB) $(ACP) $(call declare-0p-target,$(compatibility_tests_list_zip),) $(call declare-1p-container,$(compatibility_zip),) -$(call declare-container-license-deps,$(compatibility_zip),$(compatibility_zip_deps) $(test_suite_jdk), $(out_dir)/:/) +$(call declare-container-license-deps,$(compatibility_zip),$(compatibility_zip_deps) $(test_copied_tools), $(out_dir)/:/) $(eval $(call html-notice-rule,$(test_suite_notice_html),"Test suites","Notices for files contained in the test suites filesystem image:",$(compatibility_zip),$(compatibility_zip))) $(eval $(call text-notice-rule,$(test_suite_notice_txt),"Test suites","Notices for files contained in the test suites filesystem image:",$(compatibility_zip),$(compatibility_zip)))