Prepare for switching to notice files generated by Soong and fix allowlist for NOTICE.xml.gz
Bug: 338342381
Bug: 330949782
Test: presubmits
Change-Id: Ieba71b80634bbb7383e89ded0f29d5e2171dcbdd
diff --git a/core/Makefile b/core/Makefile
index f34b7d0..7b4f58d 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1982,7 +1982,7 @@
installed_system_dlkm_notice_xml_gz := $(TARGET_OUT_SYSTEM_DLKM)/etc/NOTICE.xml.gz
ALL_INSTALLED_NOTICE_FILES := \
- $(if $(USE_SOONG_DEFINED_SYSTEM_IMAGE),,$(installed_notice_html_or_xml_gz)) \
+ $(installed_notice_html_or_xml_gz) \
$(installed_vendor_notice_xml_gz) \
$(installed_product_notice_xml_gz) \
$(installed_system_ext_notice_xml_gz) \
@@ -1993,7 +1993,8 @@
# $1 installed file path, e.g. out/target/product/vsoc_x86_64/system_ext/etc/NOTICE.xml.gz
define is-notice-file
-$(if $(findstring $1,$(ALL_INSTALLED_NOTICE_FILES)),Y)
+$(if $(filter true,$(PRODUCT_USE_SOONG_NOTICE_XML)),, \
+ $(if $(findstring $1,$(ALL_INSTALLED_NOTICE_FILES)),Y))
endef
# Notice files are copied to TARGET_OUT_NOTICE_FILES as a side-effect of their module
@@ -2069,9 +2070,7 @@
endif # PRODUCT_NOTICE_SPLIT
-ifneq ($(USE_SOONG_DEFINED_SYSTEM_IMAGE),true)
ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
-endif
need_vendor_notice:=false
ifeq ($(BUILDING_VENDOR_BOOT_IMAGE),true)
diff --git a/core/os_licensing.mk b/core/os_licensing.mk
index d15a3d0..97e55a7 100644
--- a/core/os_licensing.mk
+++ b/core/os_licensing.mk
@@ -17,14 +17,14 @@
$(eval $(call text-notice-rule,$(target_notice_file_txt),"System image",$(system_notice_file_message),$(SYSTEM_NOTICE_DEPS),$(SYSTEM_NOTICE_DEPS)))
-ifneq ($(USE_SOONG_DEFINED_SYSTEM_IMAGE),true)
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(installed_notice_html_or_xml_gz): $(target_notice_file_xml_gz)
$(copy-file-to-target)
endif
endif
$(call declare-1p-target,$(target_notice_file_xml_gz))
-ifneq ($(USE_SOONG_DEFINED_SYSTEM_IMAGE),true)
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(call declare-1p-target,$(installed_notice_html_or_xml_gz))
endif
endif
@@ -44,12 +44,16 @@
"Notices for files contained in all filesystem images except system/system_ext/product/odm/vendor_dlkm/odm_dlkm in this directory:", \
$(VENDOR_NOTICE_DEPS),$(VENDOR_NOTICE_DEPS)))
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz)
$(copy-file-to-target)
+endif
$(call declare-1p-target,$(target_vendor_notice_file_xml_gz))
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(call declare-1p-target,$(installed_vendor_notice_xml_gz))
endif
+endif
.PHONY: odmlicense
odmlicense: $(call corresponding-license-metadata, $(ODM_NOTICE_DEPS)) reportmissinglicenses
@@ -63,12 +67,16 @@
"Notices for files contained in the odm filesystem image in this directory:", \
$(ODM_NOTICE_DEPS),$(ODM_NOTICE_DEPS)))
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(installed_odm_notice_xml_gz): $(target_odm_notice_file_xml_gz)
$(copy-file-to-target)
+endif
$(call declare-1p-target,$(target_odm_notice_file_xml_gz))
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(call declare-1p-target,$(installed_odm_notice_xml_gz))
endif
+endif
.PHONY: oemlicense
oemlicense: $(call corresponding-license-metadata, $(OEM_NOTICE_DEPS)) reportmissinglicenses
@@ -85,12 +93,16 @@
"Notices for files contained in the product filesystem image in this directory:", \
$(PRODUCT_NOTICE_DEPS),$(PRODUCT_NOTICE_DEPS)))
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz)
$(copy-file-to-target)
+endif
$(call declare-1p-target,$(target_product_notice_file_xml_gz))
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(call declare-1p-target,$(installed_product_notice_xml_gz))
endif
+endif
.PHONY: systemextlicense
systemextlicense: $(call corresponding-license-metadata, $(SYSTEM_EXT_NOTICE_DEPS)) reportmissinglicenses
@@ -104,12 +116,16 @@
"Notices for files contained in the system_ext filesystem image in this directory:", \
$(SYSTEM_EXT_NOTICE_DEPS),$(SYSTEM_EXT_NOTICE_DEPS)))
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(installed_system_ext_notice_xml_gz): $(target_system_ext_notice_file_xml_gz)
$(copy-file-to-target)
+endif
$(call declare-1p-target,$(target_system_ext_notice_file_xml_gz))
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(call declare-1p-target,$(installed_system_ext_notice_xml_gz))
endif
+endif
.PHONY: vendor_dlkmlicense
vendor_dlkmlicense: $(call corresponding-license-metadata, $(VENDOR_DLKM_NOTICE_DEPS)) reportmissinglicenses
@@ -123,12 +139,16 @@
"Notices for files contained in the vendor_dlkm filesystem image in this directory:", \
$(VENDOR_DLKM_NOTICE_DEPS),$(VENDOR_DLKM_NOTICE_DEPS)))
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(installed_vendor_dlkm_notice_xml_gz): $(target_vendor_dlkm_notice_file_xml_gz)
$(copy-file-to-target)
+endif
$(call declare-1p-target,$(target_vendor_dlkm_notice_file_xml_gz))
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(call declare-1p-target,$(installed_vendor_dlkm_notice_xml_gz))
endif
+endif
.PHONY: odm_dlkmlicense
odm_dlkmlicense: $(call corresponding-license-metadata, $(ODM_DLKM_NOTICE_DEPS)) reportmissinglicenses
@@ -142,12 +162,16 @@
"Notices for files contained in the odm_dlkm filesystem image in this directory:", \
$(ODM_DLKM_NOTICE_DEPS),$(ODM_DLKM_NOTICE_DEPS)))
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(installed_odm_dlkm_notice_xml_gz): $(target_odm_dlkm_notice_file_xml_gz)
$(copy-file-to-target)
+endif
$(call declare-1p-target,$(target_odm_dlkm_notice_file_xml_gz))
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(call declare-1p-target,$(installed_odm_dlkm_notice_xml_gz))
endif
+endif
.PHONY: system_dlkmlicense
system_dlkmlicense: $(call corresponding-license-metadata, $(SYSTEM_DLKM_NOTICE_DEPS)) reportmissinglicenses
@@ -161,11 +185,15 @@
"Notices for files contained in the system_dlkm filesystem image in this directory:", \
$(SYSTEM_DLKM_NOTICE_DEPS),$(SYSTEM_DLKM_NOTICE_DEPS)))
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(installed_system_dlkm_notice_xml_gz): $(target_system_dlkm_notice_file_xml_gz)
$(copy-file-to-target)
+endif
$(call declare-1p-target,$(target_system_dlkm_notice_file_xml_gz))
+ifneq ($(PRODUCT_USE_SOONG_NOTICE_XML),true)
$(call declare-1p-target,$(installed_sysetm_dlkm_notice_xml_gz))
endif
+endif
endif # not TARGET_BUILD_APPS