Merge "Add macro to support prebuilt vendor_vboot.img" into main
diff --git a/core/main.mk b/core/main.mk
index 62fa53d..8d5fbff 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1925,6 +1925,64 @@
echo '$(_lib_stem).a,$(_module_path),$(_soong_module_type),,,,,$(_built_file),$(_static_libs),$(_whole_static_libs),$(_is_static_lib)' >> $@; \
)
+# Create metadata for SBOM generation in Soong
+.PHONY: make-metadata
+make-metadata: \
+ $(SOONG_OUT_DIR)/metadata/$(TARGET_PRODUCT)/make-metadata.csv \
+ $(SOONG_OUT_DIR)/metadata/$(TARGET_PRODUCT)/make-modules.csv
+
+$(SOONG_OUT_DIR)/metadata/$(TARGET_PRODUCT)/make-metadata.csv:
+ rm -f $@
+ echo 'installed_file,module_path,is_soong_module,is_prebuilt_make_module,product_copy_files,kernel_module_copy_files,is_platform_generated,static_libs,whole_static_libs,license_text' >> $@
+ $(foreach f,$(installed_files),\
+ $(eval _module_name := $(ALL_INSTALLED_FILES.$f)) \
+ $(eval _path_on_device := $(patsubst $(PRODUCT_OUT)/%,%,$f)) \
+ $(eval _build_output_path := $(PRODUCT_OUT)/$(_path_on_device)) \
+ $(eval _module_path := $(strip $(sort $(ALL_MODULES.$(_module_name).PATH)))) \
+ $(eval _is_soong_module := $(ALL_MODULES.$(_module_name).IS_SOONG_MODULE)) \
+ $(eval _is_prebuilt_make_module := $(ALL_MODULES.$(_module_name).IS_PREBUILT_MAKE_MODULE)) \
+ $(eval _product_copy_files := $(sort $(filter %:$(_path_on_device),$(product_copy_files_without_owner)))) \
+ $(eval _kernel_module_copy_files := $(sort $(filter %$(_path_on_device),$(KERNEL_MODULE_COPY_FILES)))) \
+ $(eval _is_build_prop := $(call is-build-prop,$f)) \
+ $(eval _is_notice_file := $(call is-notice-file,$f)) \
+ $(eval _is_dexpreopt_image_profile := $(if $(filter %:/$(_path_on_device),$(DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED)),Y)) \
+ $(eval _is_product_system_other_avbkey := $(if $(findstring $f,$(INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET)),Y)) \
+ $(eval _is_event_log_tags_file := $(if $(findstring $f,$(event_log_tags_file)),Y)) \
+ $(eval _is_system_other_odex_marker := $(if $(findstring $f,$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER)),Y)) \
+ $(eval _is_kernel_modules_blocklist := $(if $(findstring $f,$(ALL_KERNEL_MODULES_BLOCKLIST)),Y)) \
+ $(eval _is_fsverity_build_manifest_apk := $(if $(findstring $f,$(ALL_FSVERITY_BUILD_MANIFEST_APK)),Y)) \
+ $(eval _is_linker_config := $(if $(findstring $f,$(SYSTEM_LINKER_CONFIG) $(vendor_linker_config_file)),Y)) \
+ $(eval _is_partition_compat_symlink := $(if $(findstring $f,$(PARTITION_COMPAT_SYMLINKS)),Y)) \
+ $(eval _is_flags_file := $(if $(findstring $f, $(ALL_FLAGS_FILES)),Y)) \
+ $(eval _is_rootdir_symlink := $(if $(findstring $f, $(ALL_ROOTDIR_SYMLINKS)),Y)) \
+ $(eval _is_platform_generated := $(_is_build_prop)$(_is_notice_file)$(_is_dexpreopt_image_profile)$(_is_product_system_other_avbkey)$(_is_event_log_tags_file)$(_is_system_other_odex_marker)$(_is_kernel_modules_blocklist)$(_is_fsverity_build_manifest_apk)$(_is_linker_config)$(_is_partition_compat_symlink)$(_is_flags_file)$(_is_rootdir_symlink)) \
+ $(eval _static_libs := $(if $(_is_soong_module),,$(ALL_INSTALLED_FILES.$f.STATIC_LIBRARIES))) \
+ $(eval _whole_static_libs := $(if $(_is_soong_module),,$(ALL_INSTALLED_FILES.$f.WHOLE_STATIC_LIBRARIES))) \
+ $(eval _license_text := $(if $(filter $(_build_output_path),$(ALL_NON_MODULES)),$(ALL_NON_MODULES.$(_build_output_path).NOTICES))) \
+ echo '$(_build_output_path),$(_module_path),$(_is_soong_module),$(_is_prebuilt_make_module),$(_product_copy_files),$(_kernel_module_copy_files),$(_is_platform_generated),$(_static_libs),$(_whole_static_libs),$(_license_text)' >> $@; \
+ )
+
+$(SOONG_OUT_DIR)/metadata/$(TARGET_PRODUCT)/make-modules.csv:
+ rm -f $@
+ echo 'name,module_path,module_class,module_type,static_libs,whole_static_libs,built_files,installed_files' >> $@
+ $(foreach m,$(ALL_MODULES), \
+ $(eval _module_name := $m) \
+ $(eval _module_path := $(strip $(sort $(ALL_MODULES.$(_module_name).PATH)))) \
+ $(eval _make_module_class := $(ALL_MODULES.$(_module_name).CLASS)) \
+ $(eval _make_module_type := $(ALL_MODULES.$(_module_name).MAKE_MODULE_TYPE)) \
+ $(eval _static_libs := $(strip $(sort $(ALL_MODULES.$(_module_name).STATIC_LIBS)))) \
+ $(eval _whole_static_libs := $(strip $(sort $(ALL_MODULES.$(_module_name).WHOLE_STATIC_LIBS)))) \
+ $(eval _built_files := $(strip $(sort $(ALL_MODULES.$(_module_name).BUILT)))) \
+ $(eval _installed_files := $(strip $(sort $(ALL_MODULES.$(_module_name).INSTALLED)))) \
+ $(eval _is_soong_module := $(ALL_MODULES.$(_module_name).IS_SOONG_MODULE)) \
+ $(if $(_is_soong_module),, \
+ echo '$(_module_name),$(_module_path),$(_make_module_class),$(_make_module_type),$(_static_libs),$(_whole_static_libs),$(_built_files),$(_installed_files)' >> $@; \
+ ) \
+ )
+
+$(SOONG_OUT_DIR)/metadata/$(TARGET_PRODUCT)/installed_files.stamp: $(installed_files)
+ touch $@
+
# (TODO: b/272358583 find another way of always rebuilding sbom.spdx)
# Remove the always_dirty_file.txt whenever the makefile is evaluated
$(shell rm -f $(PRODUCT_OUT)/always_dirty_file.txt)
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 5befe62..795d3f8 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -413,7 +413,7 @@
flags_health_check \
fsck.erofs \
icu-data_host_i18n_apex \
- icu_tzdata.dat_host_tzdata_apex \
+ tzdata_icu_res_files_host_prebuilts \
idmap2 \
incident_report \
ld.mc \
diff --git a/tools/tool_event_logger/proto/tool_event.proto b/tools/tool_event_logger/proto/tool_event.proto
index 61e28a2..ef71eac 100644
--- a/tools/tool_event_logger/proto/tool_event.proto
+++ b/tools/tool_event_logger/proto/tool_event.proto
@@ -27,6 +27,8 @@
string source_root = 3;
// Name of the tool used.
string tool_tag = 6;
+ // Name of the host workstation.
+ string host_name = 7;
oneof event {
InvocationStarted invocation_started = 4;
diff --git a/tools/tool_event_logger/tool_event_logger.py b/tools/tool_event_logger/tool_event_logger.py
index 65a9696..b249d91 100644
--- a/tools/tool_event_logger/tool_event_logger.py
+++ b/tools/tool_event_logger/tool_event_logger.py
@@ -38,6 +38,7 @@
tool_tag: str,
invocation_id: str,
user_name: str,
+ host_name: str,
source_root: str,
platform_version: str,
python_version: str,
@@ -46,6 +47,7 @@
self.tool_tag = tool_tag
self.invocation_id = invocation_id
self.user_name = user_name
+ self.host_name = host_name
self.source_root = source_root
self.platform_version = platform_version
self.python_version = python_version
@@ -57,6 +59,7 @@
tool_tag=tool_tag,
invocation_id=str(uuid.uuid4()),
user_name=getpass.getuser(),
+ host_name=platform.node(),
source_root=os.environ.get('ANDROID_BUILD_TOP', ''),
platform_version=platform.platform(),
python_version=platform.python_version(),
@@ -110,6 +113,7 @@
tool_tag=self.tool_tag,
invocation_id=self.invocation_id,
user_name=self.user_name,
+ host_name=self.host_name,
source_root=self.source_root,
)
diff --git a/tools/tool_event_logger/tool_event_logger_test.py b/tools/tool_event_logger/tool_event_logger_test.py
index 34b6c35..788812a 100644
--- a/tools/tool_event_logger/tool_event_logger_test.py
+++ b/tools/tool_event_logger/tool_event_logger_test.py
@@ -25,6 +25,7 @@
TEST_INVOCATION_ID = 'test_invocation_id'
TEST_USER_NAME = 'test_user'
+TEST_HOST_NAME = 'test_host_name'
TEST_TOOL_TAG = 'test_tool'
TEST_SOURCE_ROOT = 'test_source_root'
TEST_PLATFORM_VERSION = 'test_platform_version'
@@ -41,6 +42,7 @@
TEST_TOOL_TAG,
TEST_INVOCATION_ID,
TEST_USER_NAME,
+ TEST_HOST_NAME,
TEST_SOURCE_ROOT,
TEST_PLATFORM_VERSION,
TEST_PYTHON_VERSION,
@@ -65,6 +67,7 @@
log_event = tool_event_pb2.ToolEvent.FromString(sent_event.source_extension)
self.assertEqual(log_event.invocation_id, TEST_INVOCATION_ID)
self.assertEqual(log_event.user_name, TEST_USER_NAME)
+ self.assertEqual(log_event.host_name, TEST_HOST_NAME)
self.assertEqual(log_event.tool_tag, TEST_TOOL_TAG)
self.assertEqual(log_event.source_root, TEST_SOURCE_ROOT)