From 94f0d12de26b42d34588c83e2995ba6402c3d30f Mon Sep 17 00:00:00 2001 From: Wei Li Date: Mon, 30 Oct 2023 15:35:42 -0700 Subject: [PATCH] Include following files in the SBOM of layoutlib, which are disted in Soong. layoutlib.jar, from module layoutlib icu*.data, from module icu-data_host_i18n_apex libicuuc_stubdata.dll, from module libicuuc_stubdata libicuuc-host.dll, from module libicuuc See https://cs.android.com/search?q=%22targets:%20%5B%5C%22layoutlib%5C%22%5D%22&ss=android%2Fplatform%2Fsuperproject%2Fmain The static dependencies of java_library and cc_library have not been included and will be handled in later CLs. Bug: 303905932 Bug: 303904827 Bug: 303905759 Test: lunch sdk_phone64_arm64-userdebug && m layoutlib dist; CIs Change-Id: I0c04fed2872b674a460a4a08880e67a6311890c4 --- core/layoutlib_data.mk | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/core/layoutlib_data.mk b/core/layoutlib_data.mk index 7321c09b8a..e45f7efe16 100644 --- a/core/layoutlib_data.mk +++ b/core/layoutlib_data.mk @@ -87,6 +87,15 @@ LAYOUTLIB_SBOM := $(call intermediates-dir-for,PACKAGING,layoutlib-sbom,HOST) _layoutlib_font_config_files := $(sort $(wildcard frameworks/base/data/fonts/*.xml)) _layoutlib_fonts_files := $(filter $(TARGET_OUT)/fonts/%.ttf $(TARGET_OUT)/fonts/%.ttc $(TARGET_OUT)/fonts/%.otf, $(INTERNAL_SYSTEMIMAGE_FILES)) _layoutlib_keyboard_files := $(sort $(wildcard frameworks/base/data/keyboards/*.kcm)) + +# Find out files disted with layoutlib in Soong. +### Filter out static libraries for Windows and files already handled in make. +_layoutlib_filter_out_disted := $(addprefix layoutlib_native/,fonts/% keyboards/% build.prop res.zip windows/%.a) +_layoutlib_files_disted_by_soong := \ + $(strip \ + $(foreach p,$(_all_dist_src_dst_pairs), \ + $(if $(filter-out $(_layoutlib_filter_out_disted),$(filter layoutlib_native/% layoutlib.jar,$(call word-colon,2,$p))),$p))) + $(LAYOUTLIB_SBOM)/sbom-metadata.csv: rm -rf $@ echo installed_file,module_path,soong_module_type,is_prebuilt_make_module,product_copy_files,kernel_module_copy_files,is_platform_generated,build_output_path,static_libraries,whole_static_libraries,is_static_lib >> $@ @@ -107,6 +116,17 @@ $(LAYOUTLIB_SBOM)/sbom-metadata.csv: echo data/keyboards/$(notdir $f),frameworks/base/data/keyboards,prebuilt_etc,,,,,$f,,, >> $@; \ ) + $(foreach f,$(_layoutlib_files_disted_by_soong), \ + $(eval _prebuilt_module_file := $(call word-colon,1,$f)) \ + $(eval _dist_file := $(call word-colon,2,$f)) \ + $(eval _dist_file := $(patsubst data/windows/%,data/win/lib64/%,$(patsubst layoutlib_native/%,data/%,$(_dist_file)))) \ + $(eval _dist_file := $(subst layoutlib.jar,data/layoutlib.jar,$(_dist_file))) \ + $(eval _module_name := $(strip $(foreach m,$(ALL_MODULES),$(if $(filter $(_prebuilt_module_file),$(ALL_MODULES.$m.CHECKED)),$m)))) \ + $(eval _module_path := $(strip $(sort $(ALL_MODULES.$(_module_name).PATH)))) \ + $(eval _soong_module_type := $(strip $(sort $(ALL_MODULES.$(_module_name).SOONG_MODULE_TYPE)))) \ + echo $(patsubst layoutlib_native/%,%,$(_dist_file)),$(_module_path),$(_soong_module_type),,,,,$(_prebuilt_module_file),,, >> $@; \ + ) + $(foreach f,$(LAYOUTLIB_RES_FILES), \ $(eval _path := $(subst frameworks/base/core/res,data,$f)) \ echo $(_path),,,,,,Y,$f,,, >> $@; \