Add soong extra config file

Soong extra config file contains Makefile variables that Soong itself
doesn't need to know. It will be read by product_config module to
provide Makefile variables to build tools e.g. build.prop.

Bug: 346214955
Test: see output of product_config module
Change-Id: I045b2722ae85a10d33b9e6b832f4cc2d6789e59a
This commit is contained in:
Inseob Kim 2024-06-12 14:48:10 +09:00 committed by Bartłomiej Rudecki
parent c5505418b4
commit 8fac570055
Signed by: przekichane
GPG key ID: 751F23C6F014EF76
3 changed files with 113 additions and 1 deletions

View file

@ -1274,11 +1274,17 @@ $(eval include device/tequila/sepolicy/common/sepolicy.mk)
endif
endif
SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.$(TARGET_PRODUCT).variables
SOONG_EXTRA_VARIABLES := $(SOONG_OUT_DIR)/soong.$(TARGET_PRODUCT).extra.variables
ifeq ($(CALLED_FROM_SETUP),true)
include $(BUILD_SYSTEM)/ninja_config.mk
include $(BUILD_SYSTEM)/soong_config.mk
endif
SOONG_VARIABLES :=
SOONG_EXTRA_VARIABLES :=
-include external/ltp/android/ltp_package_list.mk
DEFAULT_DATA_OUT_MODULES := ltp $(ltp_packages)
.KATI_READONLY := DEFAULT_DATA_OUT_MODULES

View file

@ -1,5 +1,4 @@
SOONG_MAKEVARS_MK := $(SOONG_OUT_DIR)/make_vars-$(TARGET_PRODUCT).mk
SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.$(TARGET_PRODUCT).variables
SOONG_ANDROID_MK := $(SOONG_OUT_DIR)/Android-$(TARGET_PRODUCT).mk
include $(BUILD_SYSTEM)/art_config.mk
@ -372,4 +371,6 @@ $(shell if ! cmp -s $(SOONG_VARIABLES).tmp $(SOONG_VARIABLES); then \
rm $(SOONG_VARIABLES).tmp; \
fi)
include $(BUILD_SYSTEM)/soong_extra_config.mk
endif # CONFIGURE_SOONG

105
core/soong_extra_config.mk Normal file
View file

@ -0,0 +1,105 @@
$(call json_start)
$(call add_json_str, BuildFingerprintFile, build_fingerprint.txt)
$(call add_json_str, DeviceCpuVariantRuntime, $(TARGET_CPU_VARIANT_RUNTIME))
$(call add_json_str, DeviceAbiList, $(TARGET_CPU_ABI_LIST))
$(call add_json_str, DeviceAbiList32, $(TARGET_CPU_ABI_LIST_32_BIT))
$(call add_json_str, DeviceAbiList64, $(TARGET_CPU_ABI_LIST_64_BIT))
$(call add_json_str, DeviceSecondaryCpuVariantRuntime, $(TARGET_2ND_CPU_VARIANT_RUNTIME))
$(call add_json_str, Dex2oatTargetCpuVariantRuntime, $(DEX2OAT_TARGET_CPU_VARIANT_RUNTIME))
$(call add_json_str, Dex2oatTargetInstructionSetFeatures, $(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES))
$(call add_json_str, SecondaryDex2oatCpuVariantRuntime, $($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT_RUNTIME))
$(call add_json_str, SecondaryDex2oatInstructionSetFeatures, $($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES))
$(call add_json_str, BoardPlatform, $(TARGET_BOARD_PLATFORM))
$(call add_json_str, BoardShippingApiLevel, $(BOARD_SHIPPING_API_LEVEL))
$(call add_json_str, ShippingApiLevel, $(PRODUCT_SHIPPING_API_LEVEL))
$(call add_json_str, ShippingVendorApiLevel, $(PRODUCT_SHIPPING_VENDOR_API_LEVEL))
$(call add_json_bool,BuildBrokenDupSysprop, $(filter true,$(BUILD_BROKEN_DUP_SYSPROP)))
$(call add_json_str, ProductModel, $(PRODUCT_MODEL))
$(call add_json_str, ProductModelForAttestation, $(PRODUCT_MODEL_FOR_ATTESTATION))
$(call add_json_str, ProductBrandForAttestation, $(PRODUCT_BRAND_FOR_ATTESTATION))
$(call add_json_str, ProductNameForAttestation, $(PRODUCT_NAME_FOR_ATTESTATION))
$(call add_json_str, ProductDeviceForAttestation, $(PRODUCT_DEVICE_FOR_ATTESTATION))
$(call add_json_str, ProductManufacturerForAttestation, $(PRODUCT_MANUFACTURER_FOR_ATTESTATION))
$(call add_json_str, SystemBrand, $(PRODUCT_SYSTEM_BRAND))
$(call add_json_str, SystemDevice, $(PRODUCT_SYSTEM_DEVICE))
$(call add_json_str, SystemManufacturer, $(PRODUCT_SYSTEM_MANUFACTURER))
$(call add_json_str, SystemModel, $(PRODUCT_SYSTEM_MODEL))
$(call add_json_str, SystemName, $(PRODUCT_SYSTEM_NAME))
# Collapses ?= and = operators for system property variables. Also removes double quotes to prevent
# malformed JSON. This change aligns with the existing behavior of sysprop.mk, which passes property
# variables to the echo command, effectively discarding surrounding double quotes.
define collapse-prop-pairs
$(subst ",,$(call collapse-pairs,$(call collapse-pairs,$$($(1)),?=),=))
endef
$(call add_json_list, SystemProperties, $(call collapse-prop-pairs,PRODUCT_SYSTEM_PROPERTIES))
$(call add_json_list, SystemDefaultProperties, $(call collapse-prop-pairs,PRODUCT_SYSTEM_DEFAULT_PROPERTIES))
$(call add_json_list, SystemExtProperties, $(call collapse-prop-pairs,PRODUCT_SYSTEM_EXT_PROPERTIES))
$(call add_json_list, VendorProperties, $(call collapse-prop-pairs,PRODUCT_VENDOR_PROPERTIES))
$(call add_json_list, ProductProperties, $(call collapse-prop-pairs,PRODUCT_PRODUCT_PROPERTIES))
$(call add_json_list, OdmProperties, $(call collapse-prop-pairs,PRODUCT_ODM_PROPERTIES))
$(call add_json_list, OemProperties, $(call collapse-prop-pairs,PRODUCT_OEM_PROPERTIES))
$(call add_json_list, PropertyOverrides, $(call collapse-prop-pairs,PRODUCT_PROPERTY_OVERRIDES))
$(call add_json_str, BootloaderBoardName, $(TARGET_BOOTLOADER_BOARD_NAME))
_config_enable_uffd_gc := \
$(firstword $(OVERRIDE_ENABLE_UFFD_GC) $(PRODUCT_ENABLE_UFFD_GC) default)
$(call add_json_str, EnableUffdGc, $(_config_enable_uffd_gc))
_config_enable_uffd_gc :=
$(call add_json_str, SystemServerCompilerFilter, $(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER))
$(call add_json_bool, Product16KDeveloperOption, $(filter true,$(PRODUCT_16K_DEVELOPER_OPTION)))
$(call add_json_str, RecoveryDefaultRotation, $(TARGET_RECOVERY_DEFAULT_ROTATION))
$(call add_json_str, RecoveryOverscanPercent, $(TARGET_RECOVERY_OVERSCAN_PERCENT))
$(call add_json_str, RecoveryPixelFormat, $(TARGET_RECOVERY_PIXEL_FORMAT))
ifdef AB_OTA_UPDATER
$(call add_json_bool, AbOtaUpdater, $(filter true,$(AB_OTA_UPDATER)))
$(call add_json_str, AbOtaPartitions, $(subst $(space),$(comma),$(sort $(AB_OTA_PARTITIONS))))
endif
ifdef PRODUCT_USE_DYNAMIC_PARTITIONS
$(call add_json_bool, UseDynamicPartitions, $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)))
endif
ifdef PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
$(call add_json_bool, RetrofitDynamicPartitions, $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)))
endif
$(call add_json_bool, DontUseVabcOta, $(filter true,$(BOARD_DONT_USE_VABC_OTA)))
$(call add_json_bool, FullTreble, $(filter true,$(PRODUCT_FULL_TREBLE)))
$(call add_json_bool, NoBionicPageSizeMacro, $(filter true,$(PRODUCT_NO_BIONIC_PAGE_SIZE_MACRO)))
$(call add_json_bool, PropertySplitEnabled, $(filter true,$(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED)))
$(call add_json_str, ScreenDensity, $(TARGET_SCREEN_DENSITY))
$(call add_json_bool, UsesVulkan, $(filter true,$(TARGET_USES_VULKAN)))
$(call add_json_bool, ZygoteForce64, $(filter true,$(ZYGOTE_FORCE_64)))
$(call add_json_str, VendorSecurityPatch, $(VENDOR_SECURITY_PATCH))
$(call add_json_str, VendorImageFileSystemType, $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE))
$(call json_end)
$(shell mkdir -p $(dir $(SOONG_EXTRA_VARIABLES)))
$(file >$(SOONG_EXTRA_VARIABLES).tmp,$(json_contents))
$(shell if ! cmp -s $(SOONG_EXTRA_VARIABLES).tmp $(SOONG_EXTRA_VARIABLES); then \
mv $(SOONG_EXTRA_VARIABLES).tmp $(SOONG_EXTRA_VARIABLES); \
else \
rm $(SOONG_EXTRA_VARIABLES).tmp; \
fi)